pip-tools icon indicating copy to clipboard operation
pip-tools copied to clipboard

Get hash from link

Open michael-k opened this issue 2 years ago • 5 comments

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 or skip-changelog as they determine changelog listing.
  • [ ] Assign the PR to an existing or new milestone for the target version (following Semantic Versioning).

michael-k avatar Aug 19 '22 13:08 michael-k

We've used that now for a while in production with AWS CodeArtifact and it did not cause any problems.

michael-k avatar Oct 12 '22 17:10 michael-k

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!

hajapy avatar Nov 01 '22 00:11 hajapy

LGTM. Can it be rebased with the latest changes?

@atugushev any thoughts on this?

duoi avatar Nov 15 '22 04:11 duoi

Can it be rebased with the latest changes?

Done; but wasn't really necessary :shrug:

michael-k avatar Nov 17 '22 22:11 michael-k

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.

atugushev avatar Nov 19 '22 14:11 atugushev