-
-
Notifications
You must be signed in to change notification settings - Fork 611
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
Cache hashes for --generate-hashes
#641
Conversation
2a7a757
to
86a15d4
Compare
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.
Tested: Works and improved speed greatly with --generate-hashes
.
LGTM 👍
Thanks for that first contribution @justicz, nice work! |
does this include the new hash of the new wheel in the case that someone uploads a .tar.gz, then later a wheel? |
This change doesn’t handle the case where new distributions are uploaded later for the same version. Is that going to be a problem?
It’s definitely a good observation, but IMO that sounds like it will be a pretty uncommon issue.
|
I often hit this scenario. Because I regularly find packages without wheels and I go and poke the maintainer to go release them |
OK. In that particular case, would it be acceptable for you to just delete the hashes in the generated output file for that package? Then they'll just be regenerated the usual, slow way. I would tend to think that this change provides the better UX 99% of the time. |
A (btw @graingert thanks for the observation, and for poking maintainers for wheels too 😄 ) |
Edit: Oh, never mind -- I missed that your comment was talking about versions and hash pins separately. In that case, my point about increasing security by not updating hashes still stands I think. |
@justicz Your point on increased security sounds right to me, but don't quote me on this, I don't consider myself enough of a security guy to argue that it's better or worse in terms of security. |
Improves the speed of
pip-compile --generate-hashes
by caching the hashes we already have.If hashes for a particular dependency have already been generated, and are available in the output file, this PR skips pulling all of the packages again from PyPI, dramatically increasing the speed of
pip-compile
when the--generate-hashes
flag is passed.This has the added benefit of improving security; if
pip-compile --generate-hashes
is run regularly as part of a build pipeline, hashes will be guaranteed stay the same unless the version has been explicitly updated.Helps resolve #521
Maintainer Edit - Changelog:
Improved the speed of
pip-compile --generate-hashes
by caching the hashes from an existing output file.