Package index mirrors and caches¶
- Page Status:
Incomplete
- Last Reviewed:
2023-11-08
Mirroring or caching of PyPI (and other package indexes) can be used to speed up local package installation, allow offline work, handle corporate firewalls or just plain Internet flakiness.
There are multiple classes of options in this area:
local/hosted caching of package indexes.
local/hosted mirroring of a package index. A mirror is a (whole or partial) copy of a package index, which can be used in place of the original index.
private package index with fall-through to public package indexes (for example, to mitigate dependency confusion attacks), also known as a proxy.
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 python3 -m pip wheel:
python3 -m pip wheel --wheel-dir=/tmp/wheelhouse SomeProject python3 -m pip install --no-index --find-links=/tmp/wheelhouse SomeProject
Existing projects¶
Project |
Cache |
Mirror |
Proxy |
Additional notes |
---|---|---|---|---|
✔ |
✔ |
multiple indexes with inheritance; syncing, replication, fail-over; package upload |
||
✔ |
✔ |
|||
✔ |
custom plugin enables caching; re-routing to other package indexes |
|||
✔ |
✔ |
unmaintained; authentication, authorisation |
||
✔ |
✔ |
plugin for Pulp; multiple proxied indexes; package upload |
||
✔ |
✔ |
multiple proxied indexes |
||
✔ |
✔ |
multiple proxied indexes |
||
✔ |
✔ |
unmaintained |
||
✔ |
✔ |
using mod_rewrite and mod_cache_disk, you can cache requests to package indexes through an Apache server |