Bandersnatch documentation

bandersnatch is a PyPI mirror client according to PEP 381 https://www.python.org/dev/peps/pep-0381/.

Bandersnatch hits the XMLRPC API of pypi.org to get all packages with serial or packages since the last run’s serial. bandersnatch then uses the JSON API of PyPI to get shasums and release file paths to download and workout where to layout the package files on a POSIX file system.

As of 6.0:

  • Supports PEP691 - HTML + JSON Simple Index

As of 4.0:

  • Is fully asyncio based (mainly via aiohttp)

  • Only stores PEP503 nomalized packages names for the /simple API

  • Only stores JSON in normalized package name path too

Command line usage

PyPI PEP 381 mirroring client.

bandersnatch [-h] [--version] [-c CONFIG] [--debug] {delete,mirror,verify,sync} ...

bandersnatch optional arguments

  • -h, --help - show this help message and exit

  • --version - show program’s version number and exit

  • -c CONFIG, --config CONFIG - use configuration file (default: %(default)s) (default: /etc/bandersnatch.conf)

  • --debug - Turn on extra logging (DEBUG level)

bandersnatch delete

Consulte metadata (locally or remotely) and delete entire package artifacts.

bandersnatch delete [-h] [--dry-run] [--workers WORKERS] [pypi_packages [pypi_packages ...]]

bandersnatch delete positional arguments

bandersnatch delete optional arguments

  • -h, --help - show this help message and exit

  • --dry-run - Do not download or delete files

  • --workers WORKERS - # of parallel iops [Defaults to bandersnatch.conf] (default: 0)

bandersnatch mirror

Performs a one-time synchronization with the PyPI master server.

bandersnatch mirror [-h] [--force-check]

bandersnatch mirror optional arguments

  • -h, --help - show this help message and exit

  • --force-check - Force bandersnatch to reset the PyPI serial (move serial file to /tmp) to perform a full sync

bandersnatch verify

Read in Metadata and check package file validity

bandersnatch verify [-h] [--delete] [--dry-run] [--json-update] [--workers WORKERS]

bandersnatch verify optional arguments

  • -h, --help - show this help message and exit

  • --delete - Enable deletion of packages not active

  • --dry-run - Do not download or delete files

  • --json-update - Enable updating JSON from PyPI

  • --workers WORKERS - # of parallel iops [Defaults to bandersnatch.conf] (default: 0)

bandersnatch sync

Synchronize specific packages with the PyPI master server.

bandersnatch sync [-h] [--skip-simple-root] package [package ...]

bandersnatch sync positional arguments

  • package - The name of package to sync (default: None)

bandersnatch sync optional arguments

Contents