项目作者: rene-d

项目描述 :
PyPI mirroring
高级语言: Python
项目地址: git://github.com/rene-d/pypim.git
创建时间: 2019-06-30T14:31:36Z
项目社区:https://github.com/rene-d/pypim

开源协议:The Unlicense

下载


PyPIM

PyPI Intelligent Mirror

Introduction

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.

Using PyPIM

  1. Usage: pypim.py [OPTIONS]
  2. Options:
  3. -v, --verbose verbose mode
  4. -nv, --non-verbose no so much verbose
  5. -n, --dry-run dry run
  6. -u, --update update list of packages
  7. -m, --metadata download JSON metadata
  8. -p, --packages mirror packages
  9. -a, --add TEXT package name
  10. -h, --help Show this message and exit.

Fetch the list of packages

  1. ./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).

Download the package metadata

Based on the previous list of packages, the script uses the [JSON API](

  1. ./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 description
  • last_serial : a number
  • releases : list of releases
  • urls: files of the current releases

The metadata is stored in both raw and decoded formats, in two SQLite3 databases.

Download the packages

  1. ./pypim.py -p [-a name1] [-a name2[==version]]...

Exclude packages

Filter by platforms

Keep only recents releases

Respect the dependencies

Add a whitelist

Examples

Sync the test index

  1. ./pypim.py -v --db test.db --test -um

Sync the whole index with our package requirements

  1. ./pypim.py -lf mirror.log -ump -a pyxb==1.2.3 -r <(pip3 freeze) --web /data/mirrors/pypi