chriskuehl / dumb-pypi

PyPI generator, backed entirely by static files

Home Page:https://chriskuehl.github.io/dumb-pypi/test-repo/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Proposal: expanded package list input syntax

chriskuehl opened this issue · comments

There are a couple of features I'd like to implement (#19 and #20) which require a little more information than just the package name.

I don't want to make dumb-pypi get into the business of calculating hashes or reading metadata from S3 or anything, which is the way this is accomplished by most other PyPI servers. Instead, I propose having an optional input format which is JSON-based, one object per line, like this:

{"filename": "testify-0.11.0.tar.gz", "upload_timestamp": 1512539924, "uploaded_by": "ckuehl", "hash": "md5=2b00042f7481c7b056c4b410d28f33cf"}
{"filename": "WebCore-2.0.0-py2.py3-none-any.whl", "upload_timestamp": 1420074000, "uploaded_by": "root", "hash": "md5=7808a6ea8975f8af4d06a7d9c9ff113d"}

All fields except filename would be optional, and we'd probably still support the simple one-filename-per-line input format that we currently use.

It'd be up to the caller to supply this information. For example, what I would probably do for the internal registry I support is add the hash and uploader as metadata on the S3 object (calculating these at upload time for new files), which I can get for "free" while listing the bucket (the upload date is already available in the default s3 metadata). This avoids having to recalculate hashes or look up for databases or whatever every time I regenerate the registry.

Of course, callers could get this data however they want (or continue not to provide it). But it adds a way to provide it if you want to without adding much complexity to dumb-init (or making it too smart).

@asottile any thoughts?

This seems reasonable :shipit: