Skip to content
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

Add download_info: DirectUrl to InstallRequirement #11137

Merged
merged 5 commits into from
Jun 1, 2022

Conversation

sbidoul
Copy link
Member

@sbidoul sbidoul commented May 22, 2022

This PR adds a download_info: DirectUrl property to InstallRequirement.

It is populated

  • by the preparer when actually downloading the artifact (1st commit)
  • or from a new origin.json file in wheel cache entries (2nd commit)

Note it is always set, i.e. whether the requirement was provided as a direct URL or obtained from an index or find-links.

This property is therefore guaranteed to be set after the resolution step and can be used to produce an installation report containing the URL and hash of downloaded artifacts. Towards #10771 (comment).

Having the original artifact URL (and hash if applicable) recorded in the wheel cache also means we can use it to not disable the wheel cache when hash verification is requested. Towards #5037.

Creating as draft as this needs tests for the interactions with the wheel cache.

@sbidoul
Copy link
Member Author

sbidoul commented May 22, 2022

@pypa/pip-committers before I write the last tests, if anyone is not on board with this approach, please say so :)

@sbidoul sbidoul marked this pull request as ready for review May 29, 2022 13:56
@sbidoul
Copy link
Member Author

sbidoul commented May 29, 2022

I could not find a nice way to make unit tests for the cache integration here, but I added integration tests in #10771. And there will be more integration tests when I finish #11042 as a followup. So this is ready to review.

This should not matter in practice but let's be correct.
Since there is always a cache (the transient or persistent cache),
only the persistent cache matters when deciding if
something is actually cached.
@sbidoul
Copy link
Member Author

sbidoul commented Jun 1, 2022

I'm going ahead and merging this one. Thanks for the review, @uranusjr !

@sbidoul sbidoul merged commit e58a8a5 into pypa:main Jun 1, 2022
@sbidoul sbidoul deleted the download-info-sbi branch June 1, 2022 06:21
@github-actions github-actions bot locked as resolved and limited conversation to collaborators Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants