pip-tools
pip-tools copied to clipboard
Get hash from link
If the JSON API isn't available (eg. for devpi, Artifactory, AWS CodeArtifact), get the hash of a wheel/archive from the URL if available instead of hash.
This resolves jazzband/pip-tools#1135
Contributor checklist
- [x] Provided the tests for the changes.
- [x] Assure PR title is short, clear, and good to be included in the user-oriented changelog
Maintainer checklist
- [x] Assure one of these labels is present:
backwards incompatible
,feature
,enhancement
,deprecation
,bug
,dependency
,docs
orskip-changelog
as they determine changelog listing. - [ ] Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).
We've used that now for a while in production with AWS CodeArtifact and it did not cause any problems.
I locally patched pip-tools with this change and confirmed it eliminated a lot of downloading and hashing work when using pip-compile with AWS CodeArtifact.
I still noticed there is a bit of extra time spent attempting to use the json api before falling back to the links. I wonder if we could opt out of the json api to skip making all those unnecessary api calls, or perhaps switch the order around to first use the hash in the link? Regardless, this additional small optimization would be tiny compared to the gains achieved by the change as-is. Would definitely like to see this in an upcoming pip-tools release!
LGTM. Can it be rebased with the latest changes?
@atugushev any thoughts on this?
Can it be rebased with the latest changes?
Done; but wasn't really necessary :shrug:
or perhaps switch the order around to first use the hash in the link?
@hajapy Good idea. We can improve this after #1723 being merged.