Skip to main content

A script to create a partial PyPI mirror

Project description

pypi-mirror is a small script to generate a partial PyPI mirror. It relies on pip to do the most difficult part of the job (downloading a package and its dependencies).

Why?

Because most of the time you don’t need a full PyPI mirror but only a mirror that contains the packages you use. If you want a full PyPI mirror you should look at bandersnatch.

Installation

You can install pypi-mirror using pip:

pip install python-pypi-mirror

Or using conda:

conda install -c conda-forge python-pypi-mirror

How to use it?

The script provides several commands to manage your mirror. To find out which commands are available, type:

pypi-mirror --help

Every command provides its own help message. So for example to get the help message of the download command, type:

pypi-mirror download --help

The commands that you will probably use the most are the download command and the create command. For example to create a mirror which contains the requests package and its dependencies, you can type the following:

pypi-mirror download -d downloads requests
pypi-mirror create -d downloads -m simple

The first command will create a downloads directory into the current directory and use pip to download the requests package and its dependencies into the newly created directory. Then the create command will create a simple directory into the current directory and will build the mirror inside this newly created directory. You can add new packages by repeating this sequence of commands.

To make your mirror available through HTTP, you can point your HTTP server of choice to the simple directory. For exemple, type the following command into the current directory:

python3 -m http.server

It will start a HTTP server that will serve file from the current directory (which should contains the downloads directory and the simple directory). You can then install packages using your brand new mirror using the following command:

pip install -i http://127.0.0.1:8000/simple requests

About versioning

This package use semver to manage version numbering. It means that every times the major number is increased a backward incompatible change has been introduced in the API (the command line is an API). So be careful when upgrading to a new major release as it will surely break your scripts.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

python-pypi-mirror-5.2.0.tar.gz (10.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

python_pypi_mirror-5.2.0-py3-none-any.whl (10.1 kB view details)

Uploaded Python 3

File details

Details for the file python-pypi-mirror-5.2.0.tar.gz.

File metadata

  • Download URL: python-pypi-mirror-5.2.0.tar.gz
  • Upload date:
  • Size: 10.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for python-pypi-mirror-5.2.0.tar.gz
Algorithm Hash digest
SHA256 3a7c04f14e67afdf70cdb7050133e6c34c219620352dde53485ef4fe01b0ca91
MD5 329a783a95f248f1fbb8a3223daf906a
BLAKE2b-256 c5572156ed4b727072522a2d2a367b9a7beeba267d55acbfcd18101745d15dae

See more details on using hashes here.

File details

Details for the file python_pypi_mirror-5.2.0-py3-none-any.whl.

File metadata

  • Download URL: python_pypi_mirror-5.2.0-py3-none-any.whl
  • Upload date:
  • Size: 10.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.8.0 colorama/0.4.4 importlib-metadata/4.6.4 keyring/23.5.0 pkginfo/1.8.2 readme-renderer/34.0 requests-toolbelt/0.9.1 requests/2.25.1 rfc3986/1.5.0 tqdm/4.57.0 urllib3/1.26.5 CPython/3.10.6

File hashes

Hashes for python_pypi_mirror-5.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ce3c93e1255060815681105df6fc9e5a56f31c21515d02a3163285c5160a23ac
MD5 e1e9380a8f5cc08768b0f7d103962a6a
BLAKE2b-256 5205581b92a545ba37d8b09a2f2f3b2e6f5d09229b1b57a689f65706e87ee863

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page