Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.9k
Hash cache#1896
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Hash cache#1896
Uh oh!
There was an error while loading.Please reload this page.
Conversation
jtratner commentedApr 3, 2018
Reduces warm lock time from 13.5 minutes (where hash component took 12-13 minutes) to 1.3 minutes! (of which the hash component takes 30s) |
ed4e4f0 to8950e07Comparetechalchemy commentedApr 4, 2018
@ncoghlan would you mind giving this a once over for security concerns? This is a sizeable performance gain |
techalchemy commentedApr 6, 2018
@jtratner@vphilippon I see that pip-tools has brought in some local repository hashing upstream, is this going to be impacted by that at all if we bring it over? seehttps://github.com/jazzband/pip-tools/blob/master/piptools/repositories/local.py#L67-L78 -- defget_hashes(self,ireq):key=key_from_req(ireq.req)existing_pin=self.existing_pins.get(key)ifexisting_pinandireq_satisfied_by_existing_pin(ireq,existing_pin):hashes=existing_pin.options.get('hashes', {})hexdigests=hashes.get(FAVORITE_HASH)ifhexdigests:return {':'.join([FAVORITE_HASH,hexdigest])forhexdigestinhexdigests }returnself.repository.get_hashes(ireq) |
jtratner commentedApr 6, 2018 via email
I see that pip-tools has brought in some local repository hashing upstream, is this going to be impacted by that at all if we bring it over?Good point. Aside from making the diff more complicated, I think it’s fine.It’s slightly obscured, but the hash key is based on the full URL includingthe fragment (and is only cached if the fragment provided some kind ofchecksum) so it’s effectively like caching on a web ETag. Ie the serverwould have to be lying to us about the hash, but we are already trustingthe server to give us the right stuff. …On Thu, Apr 5, 2018 at 7:00 PM Dan Ryan ***@***.***> wrote:@jtratner <https://github.com/jtratner>@vphilippon <https://github.com/vphilippon> I see that pip-tools has brought in some local repository hashing upstream, is this going to be impacted by that at all if we bring it over? seehttps://github.com/jazzband/pip-tools/blob/master/piptools/repositories/local.py#L67-L78 -- def get_hashes(self, ireq): key = key_from_req(ireq.req) existing_pin = self.existing_pins.get(key) if existing_pin and ireq_satisfied_by_existing_pin(ireq, existing_pin): hashes = existing_pin.options.get('hashes', {}) hexdigests = hashes.get(FAVORITE_HASH) if hexdigests: return { ':'.join([FAVORITE_HASH, hexdigest]) for hexdigest in hexdigests } return self.repository.get_hashes(ireq) — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1896 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABhjq7K_gEWddCR_Z08-7IOzmWvbONyRks5tlswfgaJpZM4TFUBe> . |
techalchemy commentedApr 6, 2018
Ok let’s get the test fixes finalized (possibly contingent upon integration test failures getting sorted) and then merged and then we can get this and everything else current and tested properly |
ncoghlan commentedApr 6, 2018
+1 from me
|
jtratner commentedApr 7, 2018 via email
Once you merge in the fix tests branch I’ll clean this up :) …On Fri, Apr 6, 2018 at 8:45 AM Nick Coghlan ***@***.***> wrote: +1 from me - on the server side, as@jratner <https://github.com/jratner> notes, pipenv is already trusting that to provide correct artifacts, trusting it for hashes makes sense too. The PEP 503 URL scheme + artifact hashes means that collisions really shouldn't happen (if you wanted to be particularly paranoid, you may decide to reject the use of md5 hashes for caching purposes) - locally, you can mess with a build by messing with the lookup cache, but that's already possible by messing directly with pip's caches. Build machines really need to be trusted and secured environments if you're concerned about that kind of attack vector. — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub <#1896 (comment)>, or mute the thread <https://github.com/notifications/unsubscribe-auth/ABhjq6fMySAn5k54emnxRw8fwAl01sbiks5tl42NgaJpZM4TFUBe> . |
techalchemy commentedApr 7, 2018
plz rebase :D |
techalchemy commentedApr 8, 2018
I merged in master since it was doable automatically although I see now you want to clean this up first so I'll just leave it |
Re-use pip's safe file cache to store hash values for packages.
Set up is:
https://pypi.python.org/mypkg/whatever-path.whl#md5=....)I will remove print statements before merging.
Gotta think about how to test this too...