About py-code.org
py-code.org indexes the code inside the latest release of PyPI packages so you can ask which packages use a module, function or class.
How the index is built
- For each project, take the latest release that is not yanked, and pick one file: a pure-Python wheel if there is one, otherwise a platform wheel, otherwise the source distribution.
- Read only the
.pyfiles out of it. For wheels this uses HTTP range requests, so large binary wheels cost a few megabytes. - Parse each file with Python's
astmodule and record imported names and attribute access on them, such asnp.linalg.normafterimport numpy as np. - Rank packages by their downloads over the last 30 days, from ClickHouse's public PyPI dataset.
What it misses
- Older releases. Only the latest release of each project is indexed.
- Dynamic use, such as
importlib.import_module("x")orgetattr. - Names reached through variables (
x = np; x.foo). - Files that do not parse as current Python (mostly Python 2 code). The stats page shows how many.
Source code
The scanner that builds the index is open source under the MIT licence: pypi-data/py-code on GitHub. Its README explains each step and how to rebuild the index yourself.
API
Every page reads public JSON from https://data.py-code.org that you can use directly:
/api/idx/<top-level module>.json: every indexed name under a module and the packages that reference it/api/project/<name>.json: one project's imports and users/api/upgrade.json,/api/stats.json,/api/status.json
Remove a package
py-code.org does not store or republish code. For each package it keeps only the names the code imports and calls, with the file and line where each one first appears.
If you maintain a package and want it left out, email dev@py-code.org with its name. Send the email from an address listed on the package's PyPI page, or tell us where we can confirm that you own the project. The package is removed at the next data update and is not scanned again.
History of this domain
From 2023 to early 2026 py-code.org was home to Tom Forbes' PyPI Data project, which mirrored the code of every file ever published to PyPI into git repositories and published datasets about it. Tom retired the project in 2026. This site is a new, independent project on the same domain. It is inspired by his work and is not run by him, and it uses the domain with his agreement. His site's code is available under the MIT licence.
py-code.org is not affiliated with PyPI or the Python Software Foundation.