Package: pypi-multidl
pypi-multidlThis tool was made to make it easier to download Python packages from one
computer and install them on other computers that are not connected to the
internet (and may run different OSes). This project is not officially endorsed
by anyone (for example, the maintainers of PyPI orpip).Its input is a list of dependency specifications (package name and versions),
and the output is a destination directory populated with all the sdists and
wheels from PyPI that matches the specifications. This directory can then be
used offline withpipusing the-f/--find-linksoption as a lightweight PyPI
mirror.This tool does no dependency resolution. You are expected to usepip-compilefrom thepip-toolspackage (or an equivalent tool) to find all the
dependencies of the dependencies, and pinning down all the exact version.pip-compilecan be used to process asetup.py/setup.cfg/pyproject.tomlfile into arequirements.txtto be used bypypi-multidl.Example Usage: Download Dependencies for a ProjectAssume you have a Python project you want to be able to install offline, and
that its dependencies aren't pinned to specific version. Then begin by compiling
the list of transitive pinned dependencies:cd some-project
pip-compile setup.py # ...or setup.cf, or pyproject.tomlNow you have arequriements.txtfile. Continue to download all the
dependencies to thedeps/directory:pypi-multidl -r requirements.txt -d deps/The project can then be installed offline like this:pip install --no-index --find-links deps/ .Example Usage: List all Distribution Packages Avaiable for a ProjectThepypi-multidltool can also be given dependency specifications directly on
the command line:pypi-multidl --dry-run 'appdirs' 'sphinx >=4.0.0, <5.0.0'LimitationsThe approach used by pypi-multidl does not work in the general case. The
dependency resolution steppip-compileis actually platform-specific. A
package can have different dependencies on different platforms. For example,
Sphinx depends oncolorama, but only on Windows. What you get frompip-compileis the set of dependencies specific for the plaform thatpip-compilewas run on. If no packages have platform-specific dependencies,
then everything should work. Currently,pypi-multidldoes not make any attempt
to validate that therequirements.txtis platform-independent.This tool currently only supports the PEP 691 JSON API via the simple endpoint.Yanked files are never downloaded, not even when pinned using==(see PEP
592).Requires-python and other metadata is not downloaded.This tool only produces a flat directory of files, not a "simple" style
directory tree to be served by a web server.Comparison to other toolsThepip downloadcommand only supports downloading packages for one system at
a time. It also only downloads an sdist or a wheel, but never both.Thepip-downloadertool solves the same problem aspypi-multi, but is
implemented in a different way. It performs dependency resolution usingpipand uses its internal API. It needs to continually be updated wheneverpipchanges in order not to break.Usage with a Local CacheWhen experimenting with downloading from PyPI it is recommended to setup a local
PyPI cache. Thedevpitool is easy to get started with:pip install devpi
devpi-init
devpi-server  # Runs an index on http://localhost:3141/root/pypi/+simple/Leave that running in a terminal (or add it to your init system) and add this to
your pip config:[global]
index-url = http://localhost:3141/root/pypi/+simple/pip,pip-compileandpypi-multidlwill then automatically use the cache.
Note that you also need to pass--no-emit-optionstopip-compileso that it
doen't add an--index-urlline to therequirements.txt(whichpypi-multidldoesn't understand).