Download PyPI
You can download the code of one package in seconds or mirror all of PyPI. Pick the smallest option that answers your question.
Option 1: only the .py files of one package
A wheel is a zip file, and a zip file lists its contents at the end. This script reads that list with HTTP range requests, then downloads only the .py files. It needs Python 3 and nothing else. py-code.org builds its index the same way.
$ wget https://py-code.org/download/py_files.py $ python3 py_files.py urllib3 urllib3-code urllib3/__init__.py urllib3/_base_connection.py …
The script makes one request per file, so it suits small and medium packages. For a package with thousands of files, download the whole wheel instead. Read the script before you run it.
Option 2: whole packages
pip downloads a release without installing it:
$ pip download --no-deps --no-binary :all: requests # source distribution $ pip download --no-deps requests # wheel
To read the files in a browser without downloading anything, use PyPI Inspector. Every project page on this site links to it.
Option 3: all of PyPI
bandersnatch, the PyPA's mirroring tool, downloads every file on PyPI and keeps the copy up to date. Most of that is compiled binaries. In 2024 the PyPI Data project measured the contents of PyPI at 78 TiB uncompressed, and about three quarters of it was binary files. Check you have the disk space first.
What happened to the git download?
From 2023 to 2026 this page offered a download.sh script that cloned PyPI's code from about 270 GitHub repositories. Those repositories were removed in 2026, so the script no longer works. The Repositories page has the details, and the Datasets page lists what is still available.