-
Couldn't load subscription status.
- Fork 3.2k
Avoid pip install --dry-run downloading full wheels
#13482
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
Changes from 2 commits
196f992
a844f3b
fc2eb8d
11d2a6f
62a5d16
afa16f2
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1 @@ | ||
| When PEP-658 metadata is available, full distribution download no longer occurs when using dry-run mode on install. | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -130,15 +130,15 @@ def run(self, options: Values, args: list[str]) -> int: | |
|
|
||
| requirement_set = resolver.resolve(reqs, check_supported_wheels=True) | ||
|
|
||
| preparer.prepare_linked_requirements_more(requirement_set.requirements.values()) | ||
|
|
||
| downloaded: list[str] = [] | ||
| for req in requirement_set.requirements.values(): | ||
| if req.satisfied_by is None: | ||
| assert req.name is not None | ||
| preparer.save_linked_requirement(req) | ||
| downloaded.append(req.name) | ||
|
|
||
| preparer.prepare_linked_requirements_more(requirement_set.requirements.values()) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not very familiar with the preparer, could you explain why we need to prepare requirements earlier now? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe this is because the resolver no longer downloads the files and later |
||
|
|
||
| if downloaded: | ||
| write_output("Successfully downloaded %s", " ".join(downloaded)) | ||
|
|
||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -180,11 +180,6 @@ def resolve( | |
|
|
||
| req_set.add_named_requirement(ireq) | ||
|
|
||
| reqs = req_set.all_requirements | ||
| self.factory.preparer.prepare_linked_requirements_more(reqs) | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is the key change - the resolver no longer triggers additional preparation. Instead, we move this responsibility to consumers of the resolve result. Technically, I could have made the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is there any sort of documentation attached to the preparer where we could document this contract? While this change makes sense, it is also a bit arbitrary. |
||
| for req in reqs: | ||
| req.prepared = True | ||
| req.needs_more_preparation = False | ||
| return req_set | ||
|
|
||
| def get_installation_order( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.
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.
This needs to be updated slightly, in-particular all sdists are still downloaded (at least for now), either specifically call out wheels or change to something like:
Or
Further, also add that
pip lockno longer downloads distributions.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.
If there's no update and no objections in the next few days I will update this news items myself.
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.
Technically
piphas no problem fetching metadata for sdists already 😉. So this PR does make--dry-runavoid an sdist download/build 🎉 (this is a pretty substantial benefit as it means you don't need to build the sdist to figure out the dependencies... if only we had any repositories with sdist metadata served ala 658).To prove this, I did the following:
On the pip side, I ran:
With only the following
http.serveroutput:(i.e. the sdist is never downloaded)
Whereas on master (f2b9231):
With the http log:
I proceeded to try
pip lockout on the above setup, but got a failure:I think that is because my package repository didn't include hashes...
This was the changed line in question:
When I added them it correctly generated the lock file without downloading:
🎉
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.
Would you like to mention anything about performance in the what's new? Whilst
pipdoesn't quite reachuvperformance, it is still very reasonable when the cache is cold! The narrative thatpipis much slower might be nice to counter here 😉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.
Interesting about the sdists, I wasn't aware of that impact, I'll try and review later this week.
The Windows test failure looks unrelated. I'll try and make, or review, a PR to fix as soon as I can.