-
Notifications
You must be signed in to change notification settings - Fork 250
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Metadata validation API #332
Conversation
* Basic Metadata API done, need to write tests * Basic testing completed * More testing * extract_pkginfo completed for all file types * Unresolved description bug * Parameterized with all metadataformats, added way to extend file type * WIP: Working on Python2 email parser fix * Before split. to_rfc822 not working * Python2 and Python3, not fully working (payload unicode Python2 error) * Python3 all tests passing * Updated typing and fixed one test * Prefix json_form with underscore * _canonicalize doesn't need to be a classmethod * Add back special handling of Description * make self.meta_dict prefixed with _ * Raise NotImplemented for equality instead * Use 'rfc822' instead of 'pkginfo' or 'pkg_info' * Don't need to_dict if it supports __iter__ * Simplify missing multi fields * Raise exception when duplicate descriptions are given * some linting erros * Implemented TypedDict, linting failing * Deleting TypedDict Co-authored-by: Vikram Jayanthi <vikramjayanthi@google.com> Co-authored-by: Dustin Ingram <di@users.noreply.github.com>
FYI: this is failing tests on Windows. |
What's the state of this PR? Is this going to be worked on by author at some point in the future? |
@pradyunsg Unlikely. Getting this merge-able is on my to-do list, but others can take over here as well if they're interested. |
One thing to consider is PEP 621, if it gets accepted, will lead to its own need to have a representation of metadata as fed from TOML data. Now I'm assuming that will be via a So I don't know what ramifications PEP 621 will have on the proposed API as that will shift slightly the data model of what metadata can be (e.g. the |
I'd say we make that treating a separate object compared to what we're getting from the METADATA files. |
It gets a little tricky, though, if that data is then used to emit |
Yeaaaa... We'll cross that design bridge when we get to it tho! |
I'm closing this as stale as c533201 has landed as the way to represent metadata. |
As mentioned in #147, there is currently no metadata validation module in
pypa/packaging
that allows packaging projects such aspip
ortwine
to validate metadata in a standardized way. @di and I built this API to address this problem. The API is based off of @di's and @pfmoore's WIP branches.Currently the API allows for creation of metadata objects from various formats such
RFC822
strings andJSON
s and allows for the conversion between these different formats. It doesn't implement the full validation process but creates the structure to add it.Additionally this doesn't support Python2 because of the sunsetting of Python2 support as well as encoding issues while parsing
RFC822
strings using Python2's email parsing modules.Support for reading metadata from distributions is something we plan to support.