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(pluspip, which you already have). --format sdistfalls 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
.gitignoreexcludespkgs/,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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7db2c444b9e957bcaebafe9a9ec2bfec8d7c42fa140abc3a529fcd9fa0a456eb
|
|
| MD5 |
3e67f53e7885c08833ce369cc83f3352
|
|
| BLAKE2b-256 |
fc93f6f62bed98c3d41963a7cf7567463a587f20938ffa5a4a7ba832ee506a7a
|
File details
Details for the file pypi_bulk_download-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pypi_bulk_download-0.1.0-py3-none-any.whl
- Upload date:
- Size: 10.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
twine/6.2.0 CPython/3.10.11
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5cd29fdb243ec8520d09f30319b91c1050df363a891e28a17bcabc9ea19c2751
|
|
| MD5 |
ccee57aa6df0764be8721fd83f66b0b2
|
|
| BLAKE2b-256 |
9b86a2b110b436372d4e7532ba03ff11c132bc1c86ffe8ee41d89c738c646206
|