Skip to content

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

pelson
Copy link
Contributor

@pelson pelson commented Jul 15, 2025

Closes #12603.

  • Removed "more preparation" (downloading) from the resolver to prevent downloading before dry-run validation
  • Added distribution caching to InstallRequirement with set_dist() and get_dist() methods to preserve metadata-only distributions
  • Set download_info during metadata-only fetching to ensure it's available for commands like pip lock and --report without requiring full downloads

@@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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 preparer aware of the fact that we don't want to download anything, but the preparer is already a grab-bag of flags, and it felt cleaner to do it this way.

@notatallshaw
Copy link
Member

Thanks for opening the pull request with pip, I'm certainly happy to see this PR, but please be aware it might take a moment for a pip maintainer to review this, as we all do this on a volunteer basis.

 * Removed "more preparation" (downloading) from the resolver to prevent downloading before dry-run validation
 * Added distribution caching to `InstallRequirement` with `set_dist()` and `get_dist()` methods to preserve metadata-only distributions
 * Set `download_info` during metadata-only fetching to ensure it's available for commands like `pip lock` and `--report` without requiring full downloads

Closes pypa#12603.
@pelson pelson force-pushed the feature/no-download-for-dry-run branch from ff4715b to 196f992 Compare July 15, 2025 03:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Pip install --dry-run shouldn't download full wheels when metadata file available
2 participants