Package index mirrors and caches¶
- 页面状态
不完全的
- 最后审查
2014-12-24
Mirroring or caching of PyPI can be used to speed up local package installation, allow offline work, handle corporate firewalls or just plain Internet flakiness.
Three options are available in this area:
pip provides local caching options,
devpi provides higher-level caching option, potentially shared amongst many users or machines, and
bandersnatch provides a local complete mirror of all PyPI packages.
Caching with pip¶
pip provides a number of facilities for speeding up installation by using local cached copies of packages:
Fast & local installs by downloading all the requirements for a project and then pointing pip at those downloaded files instead of going to PyPI.
A variation on the above which pre-builds the installation files for the requirements using python -m pip wheel:
python -m pip wheel --wheel-dir=/tmp/wheelhouse SomeProject python -m pip install --no-index --find-links=/tmp/wheelhouse SomeProject
Caching with devpi¶
devpi is a caching proxy server which you run on your laptop, or some other machine you know will always be available to you. See the devpi documentation for getting started.
Complete mirror with bandersnatch¶
bandersnatch will set up a complete local mirror of all PyPI packages (externally-hosted packages are not mirrored). See the bandersnatch documentation for getting that going.
A benefit of devpi is that it will create a mirror which includes packages that are external to PyPI, unlike bandersnatch which will only cache packages hosted on PyPI.