-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Read wheel metadata from wheel directly #7538
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
Read wheel metadata from wheel directly #7538
Conversation
With this parameter we can incrementally update code to rely on the zip file instead of the unpacked source directory.
Since zips don't typically contain directory entries, we want to only operate on files. Adding files to the .dist-info tests means we will be able to reuse them for both cases, while they coexist.
First example of transitioning a directory-aware function to using a zipfile directly. Since we will not need to maintain the unpacked dir going forward, we don't need to worry about making wheel_dist_info_dir "generic", just that the same tests pass for both cases at each commit. To do this neatly we use pytest.fixture(params=[...]), which generates a test for each param. Once we've transitioned the necessary functions we only need to replace the fixture name and remove the dead code.
Since we don't pass the source dir anymore, we can simplify the tests and implementation for wheel_dist_info_dir.
Makes it simpler to substitute in zip-derived WHEEL extraction.
Since we don't pass the source directory anymore, remove the tests and implementation.
This functions as a guard for the rest of our wheel-handling code, ensuring that we will only get past this point if we have a wheel that we should be able to handle version-wise. We return a tuple instead of bundling up the result in a dedicated type because it's the simplest option. The interface will be easy to update later if the need arises.
4a1ef42
to
2f92826
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
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.
👍
tests/unit/test_wheel.py
Outdated
yield make_zip | ||
|
||
|
||
@pytest.fixture(params=[True, False]) |
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.
😮 I did not know this was possible ^^
More preliminary work for direct-from-wheel metadata reading. Now instead of reading
metadata from the unpacked wheel files on disk, we read it from a ZipFile which wraps
the wheel file itself.
In order to ensure a compatible implementation, tests pass in each step as we incrementally:
Progresses #6030 and the simplification of wheel builder mentioned in #7483 (comment).