PyPI Intelligent Mirror
There are many mirroring tools for PyPI.org. The well-known Bandersnatch works fine but cannot ensure dependencies.
That's why PyPIM has been written :
- whitelist
- blacklist
- filter by platforms
- retain only recent releases
- respect the dependencies
But computing dependencies is time and space comsuming. The whole package metadata are required and easy to reach.
Usage: pypim.py [OPTIONS]
Options:
-v, --verbose verbose mode
-nv, --non-verbose no so much verbose
-n, --dry-run dry run
-u, --update update list of packages
-m, --metadata download JSON metadata
-p, --packages mirror packages
-a, --add TEXT package name
-h, --help Show this message and exit.
./pypim.py -u
The script uses the XML-RPC API to fetch the list of packages and their last_serial
(a growing-only internal counter).
Based on the previous list of packages, the script uses the [JSON API](
./pypim.py -m
The script uses the XML-RPC API to download the package metadata.
The response, in JSON, is made of 4 sections:
info
: package descriptionlast_serial
: a numberreleases
: list of releasesurls
: files of the current releases
The metadata is stored in both raw and decoded formats, in two SQLite3 databases.
./pypim.py -p [-a name1] [-a name2[==version]]...
./pypim.py -v --db test.db --test -um
./pypim.py -lf mirror.log -ump -a pyxb==1.2.3 -r <(pip3 freeze) --web /data/mirrors/pypi