Skip to main content

pypi-bulk-download

Download PyPI packages in bulk, filtered by real-world popularity, in parallel, with safe archive unpacking and a JSON manifest. Built for assembling research corpora (security scanning, ecosystem analysis, mirrors) without hand-rolling pip download loops.

Downloads go through pip download, so wheels, sdists, platform tags, and custom indexes behave exactly as pip does. Popularity comes from the public top-pypi-packages 30-day dataset.

Install

pip install pypi-bulk-download

CLI

# Top 50 packages with >= 100k downloads/month, source dists, no deps
pypi-bulk-download --min-downloads 100000 --limit 50 --format sdist --no-deps -o corpus/

# Specific packages, 4 workers, write a manifest
pypi-bulk-download --packages requests flask httpx --workers 4 --save-manifest corpus/manifest.json

# From a requirements file, then safely unpack every archive
pypi-bulk-download -r requirements.txt -o corpus/ --unpack

# See the plan without downloading
pypi-bulk-download --min-downloads 50000 --limit 20 --dry-run

Library

from pypi_bulk_download import fetch_top_packages, download_many, save_manifest

targets = fetch_top_packages(min_downloads=100_000, limit=25)
results = download_many(targets, "corpus/", workers=4, prefer_format="sdist", no_deps=True)
save_manifest(results, "corpus/manifest.json")

print(sum(r.success for r in results), "of", len(results), "downloaded")

Safe unpacking

unpack_archive / unpack_all validate every tar/zip member against path traversal (tar-slip / zip-slip) before extracting — untrusted archives can't write outside their destination folder.

from pypi_bulk_download import unpack_all
unpacked, failed = unpack_all("corpus/", remove_archives=False)

Notes

  • Depends only on requests (plus pip, which you already have).
  • --format sdist falls back to the best wheel when no source distribution exists, rather than failing hard.
  • This tool downloads third-party code. Do not commit the download directory to your own repository; the included .gitignore excludes pkgs/, downloads/, and archive files by default.

License

MIT (this tool). Downloaded packages retain their own licenses.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pypi_bulk_download-0.1.0.tar.gz (8.9 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pypi_bulk_download-0.1.0-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

File details

Details for the file pypi_bulk_download-0.1.0.tar.gz.

File metadata

  • Download URL: pypi_bulk_download-0.1.0.tar.gz
  • Upload date:
  • Size: 8.9 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.11

File hashes

Hashes for pypi_bulk_download-0.1.0.tar.gz
Algorithm Hash digest
SHA256 7db2c444b9e957bcaebafe9a9ec2bfec8d7c42fa140abc3a529fcd9fa0a456eb
MD5 3e67f53e7885c08833ce369cc83f3352
BLAKE2b-256 fc93f6f62bed98c3d41963a7cf7567463a587f20938ffa5a4a7ba832ee506a7a

See more details on using hashes here.

File details

Details for the file pypi_bulk_download-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for pypi_bulk_download-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5cd29fdb243ec8520d09f30319b91c1050df363a891e28a17bcabc9ea19c2751
MD5 ccee57aa6df0764be8721fd83f66b0b2
BLAKE2b-256 9b86a2b110b436372d4e7532ba03ff11c132bc1c86ffe8ee41d89c738c646206

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page