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](https://github.com/pypa/bandersnatch.git).

# Installation

You can install pypi-mirror using pip:

`sh pip install python-pypi-mirror `

# How to use it?

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

`sh pypi-mirror --help `

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

`sh 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:

` sh pypi-mirror -d downloads download requests pypi-mirror -d downloads create -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:

`sh 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:

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

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-2.0.0.tar.gz (6.1 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-2.0.0-py3-none-any.whl (7.5 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: python-pypi-mirror-2.0.0.tar.gz
  • Upload date:
  • Size: 6.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

File hashes

Hashes for python-pypi-mirror-2.0.0.tar.gz
Algorithm Hash digest
SHA256 f05d5ca07f3cd14fd33109cb4bb17d86f2588891ec722d407a7804d3455a96fc
MD5 0fbbbcb773a97aeb15473e46eab624c4
BLAKE2b-256 4615bde6889d27c00bd166a2147ad9326e68f00dbec48809a88f9021b7f022af

See more details on using hashes here.

File details

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

File metadata

  • Download URL: python_pypi_mirror-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 7.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.21.0 setuptools/28.8.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4

File hashes

Hashes for python_pypi_mirror-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5b335ed394688afcd623b3b3a315c70c23ef6f15b08a9b46d5269c6d0d6eb08e
MD5 175bf486477e66c8578462a412e10747
BLAKE2b-256 39fb73cb4def38cfd4ff8114e596546688244b2715238bdd34719a3dfee25e16

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