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:

  1. local/hosted caching of package indexes.

  2. 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.

  3. 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:

  1. Fast & local installs by downloading all the requirements for a project and then pointing pip at those downloaded files instead of going to PyPI.

  2. 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

devpi

multiple indexes with inheritance; syncing, replication, fail-over; package upload

bandersnatch

simpleindex

custom plugin enables caching; re-routing to other package indexes

PyPI Cloud

unmaintained; authentication, authorisation

Pulp-python

plugin for Pulp; multiple proxied indexes; package upload

proxpi

multiple proxied indexes

nginx_pypi_cache

multiple proxied indexes

Flask-Pypi-Proxy

unmaintained

Apache

using mod_rewrite and mod_cache_disk, you can cache requests to package indexes through an Apache server