pip2pi icon indicating copy to clipboard operation
pip2pi copied to clipboard

Don't re-download packages if they already exist in the index

Open wolever opened this issue 11 years ago • 3 comments

For example, so that pip2pi example.com:/var/www/pypi/ foo==1.2 will only download foo==1.2 packages if it do not exist in example.com:/var/www/pyp/.

After some poking around, it doesn't look like there's a straightforward way to do this. To continue calling pip's install command directly:

  1. The InstallCommand.run method sets RequirementSet.ignore_dependencies=True when the --download option is set. However we do want requirements to be checked, just checked against our own set of packages.
  2. The InstallRequirement.check_if_exists method would need to be overridden so that it checks against a set we provide instead of whatever logic it's using right now.

Alternatively we could re-implement significant parts of InstallCommand.run. But that would involve copy+pasting quite a bit of code, and even then I don't think those APIs are public… so that could become a maintenance nightmare.

wolever avatar Aug 04 '14 03:08 wolever

If you set a find-links for /var/www/pypi/ or whatever it should "redownload" from that instead.

dstufft avatar Aug 04 '14 23:08 dstufft

@dstufft The difficulty is that /var/www/pypi/ may be on a remote machine. I'll need to build a list of the remote packages (ex, foo==1.2, foo==1.3, bar==1.0) for Other Reasons, so ideally there would be some way to get pip to check dependencies against that list before re-downloading.

wolever avatar Aug 05 '14 21:08 wolever

Any idea on getting this in ? : p

ekarlso avatar Sep 18 '14 12:09 ekarlso