Don't re-download packages if they already exist in the index
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:
- The
InstallCommand.runmethod setsRequirementSet.ignore_dependencies=Truewhen the--downloadoption is set. However we do want requirements to be checked, just checked against our own set of packages. - The
InstallRequirement.check_if_existsmethod 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.
If you set a find-links for /var/www/pypi/ or whatever it should "redownload" from that instead.
@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.
Any idea on getting this in ? : p