pypa / bandersnatch

A PyPI mirror client according to PEP 381 http://www.python.org/dev/peps/pep-0381/
Academic Free License v3.0
455 stars 141 forks source link

Enhancement: check file size and modification time(upload time) in download_file #821

Closed jiegec closed 3 years ago

jiegec commented 3 years ago

Relevant code: https://github.com/pypa/bandersnatch/blob/cc50bfecfd8b8912c35227aa8124c385ca1239ab/src/bandersnatch/mirror.py#L771-L786

It reads the local file and calculates sha256sum. This might lead to huge pressure to disk. An enhancement would be:

  1. check file size and modification time(upload time) by default
  2. check sha256sum if user explicitly requests in config
cooperlees commented 3 years ago

Thanks for the idea and the PR. As stated on the PR, I want to keep the checksumming as the default and add this as a configuration option. If you implement that I'll merge away!

cooperlees commented 3 years ago

This is merged ready for 5.0. Thanks @jiegec !