Preserve original PKG-INFO contents when creating wheel (instead of calling wheel.metadata.pkginfo_to_metadata)#4701
Conversation
PKG-INFO contents when creating wheel (instead of calling wheel.metadata.pkginfo_to_metadata)PKG-INFO contents when creating wheel (instead of calling wheel.metadata.pkginfo_to_metadata)
2924da8 to
9841171
Compare
|
@agronholm do you have any reservations regarding this approach? |
|
If I understood this correctly, then it's fine by me. It's about time we start ditching the awkward conversion code from egg-info metadata. The only thing preventing me from advancing this myself is mental exhaustion. |
|
I will wait to see the assessment on #4698 before merging the PR. |
|
Given that the |
a8e0012 to
a465e30
Compare
There are 2 aspects to this question. The first one is the existence of The second aspect is that this PR in some way is a step towards generating proper 2.4 metadata directly. What I plan in #4698 is to change |
a465e30 to
089aca9
Compare
|
I will go ahead and merge this so that the follow up PRs can be rebased. |
|
I plan to create a release that consists mostly of this change so that we can receive feedback and see if there is an unintended consequence. |
This seems to be a necessary step towards implementing new versions of metadata (e.g. PEP 685).
As pointed out in #4698, even if we modify
setuptoolsto emit new versions of the metadata,pypa/wheelstill hardcodes version 2.1, which can be problematic.The good news is that recently
setuptoolshas started emitting valid and complete 2.1 metadata on its own (seesetuptools/_core_metadata.py). This PR assumes that it is OK just to reuse the file generated by setuptools without any need to post-process it inbdist_wheel.Summary of changes
test_core_metadatato ensure the generatedPKG-INFOis compatible with standards forMETADATA.PKG-INFOof real-world configuration scenarios, makimg sure they are compatible withwheel.metadata.pkginfo_to_metadata.PKG-INFOto make sure they "round-trip" when subject to the parsing and serialisation methods used bypypa/wheel.setuptools.command.bdist_wheelto simply re-use the already generatedPKG-INFO.Closes
Limitations
There are "minor" differences between
METADATAgenerated bypypa/wheelandPKG-INFOgenerated bysetuptools:I believe that an acceptable level of normalisation, fully compliant with the spec, will be "automatically" achieved once pypa/packaging#845 and pypa/packaging#644 (comment) are handled1.
Pull Request Checklist
newsfragments/.(See documentation for details)
Footnotes
Right now, the specs mandate the extras to be normalised, but not the name. Setuptools relies on
packagingfor the normalisation, so once the potential bug in https://github.com/pypa/packaging/issues/845 is solved, it will be compliant to the spec. Ifpackagingintroduces names normalisation we will also adopt it. ↩