-
Notifications
You must be signed in to change notification settings - Fork 3k
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
Use wheelfile-based pkg_resources.Distribution for metadata #7539
Conversation
@-me when this is ready for review. :) |
4a1ef42
to
bfffb32
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very nice. Code LGTM.
As this should improve performance with large wheels, this could be mentioned in a news file?
One can probably also remove the unpack_file
in the preparer if link.is_wheel
(in a followup)?
pip/src/pip/_internal/operations/prepare.py
Lines 162 to 164 in 08f61a9
# unpack the archive to the build dir location. even when only | |
# downloading archives, they have to be unpacked to parse dependencies | |
unpack_file(from_path, location, content_type) |
It should for |
d9af6ac
to
cd9a678
Compare
pkg_resources.Distribution classes delegate to the IMetadataProvider implementation provided at construction. This is the one we'll use for adapting a ZipFile to pkg_resources.DistInfoDistribution.
cd9a678
to
64f887f
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Feel free to merge if you want to -- these comments aren't blockers.
There's another spot where we do unconditional unpacking, as @sbidoul has helpfully pointed out too. I would've preferred to change that too, in this PR since we're already removing one unnecessary location where we're unpacking -- but doing it in a follow up wouldn't hurt either. :)
Thanks for breaking this up into smaller PRs that were independently reviewed. :)
I would have, but I wanted to move all unpacking out of the individual "unpack_*" functions in |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tested again, works fine. 👍
64f887f
to
561ef79
Compare
We now extract all metadata files from the wheel directly into memory and make them available to the wrapping pkg_resources.Distribution via the DictMetadata introduced earlier.
Actual installation has been using the wheel file directly for some time. The last piece that required an unpacked wheel was metadata. Now that it uses the wheel file directly, we can remove the unpacking after build.
561ef79
to
a94fb53
Compare
Thank you both for reviewing. |
Use wheel-file-based pkg_resources.Distribution for metadata
Adapts the zipfile-compatible wheel metadata functions from #7538 to back a
pkg_resources.Distribution
. This allows us to remove wheel file unpacking everywhere except right before installation.Progresses #6030 and implements simplification described in #7483 (comment).