Datasets:
Data as of 13 Nov 2026
Browse files- README.md +134 -0
- own_modules.parquet +3 -0
- projects.parquet +3 -0
- pth_files.parquet +3 -0
- refs.parquet +3 -0
README.md
ADDED
|
@@ -0,0 +1,134 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
license: cc-by-4.0
|
| 3 |
+
pretty_name: py-code.org PyPI code usage
|
| 4 |
+
language:
|
| 5 |
+
- en
|
| 6 |
+
tags:
|
| 7 |
+
- python
|
| 8 |
+
- pypi
|
| 9 |
+
- code
|
| 10 |
+
- dependencies
|
| 11 |
+
size_categories:
|
| 12 |
+
- 10M<n<100M
|
| 13 |
+
configs:
|
| 14 |
+
- config_name: refs
|
| 15 |
+
default: true
|
| 16 |
+
data_files: refs.parquet
|
| 17 |
+
- config_name: projects
|
| 18 |
+
data_files: projects.parquet
|
| 19 |
+
- config_name: own_modules
|
| 20 |
+
data_files: own_modules.parquet
|
| 21 |
+
- config_name: pth_files
|
| 22 |
+
data_files: pth_files.parquet
|
| 23 |
+
---
|
| 24 |
+
|
| 25 |
+
# py-code.org: which PyPI packages use which names
|
| 26 |
+
|
| 27 |
+
For the latest release of 335,146 PyPI projects released between 13 Nov 2025 and 13 Nov 2026,
|
| 28 |
+
these tables list every module, function and class the code imports or reaches by attribute,
|
| 29 |
+
such as `requests.Session` or `numpy.linalg.norm`. This is the data behind the search on
|
| 30 |
+
[py-code.org](https://py-code.org). The scanner that built it is
|
| 31 |
+
[pypi-data/py-code](https://github.com/pypi-data/py-code) (MIT).
|
| 32 |
+
|
| 33 |
+
The tables hold names, counts and file paths. They hold no source code.
|
| 34 |
+
|
| 35 |
+
## Tables
|
| 36 |
+
|
| 37 |
+
### `refs` (38.3 million rows, 763 MB)
|
| 38 |
+
|
| 39 |
+
One row per project and name. Sorted by `name`, then `project`.
|
| 40 |
+
|
| 41 |
+
| Column | Type | Meaning |
|
| 42 |
+
|---|---|---|
|
| 43 |
+
| `project` | string | PyPI project name |
|
| 44 |
+
| `name` | string | Full dotted name, e.g. `requests.Session` |
|
| 45 |
+
| `module` | string | Top-level module of `name`, e.g. `requests` |
|
| 46 |
+
| `files` | int | Number of `.py` files in the project that use `name` |
|
| 47 |
+
| `locations` | list of string | Up to 3 places where it is used, as `path:line` |
|
| 48 |
+
|
| 49 |
+
A name is recorded with every prefix: `os.path.join` also adds `os` and `os.path`. Attribute
|
| 50 |
+
chains are followed up to 4 levels after the imported name. Names from the project's own
|
| 51 |
+
top-level modules are left out, so a package does not count as a user of itself.
|
| 52 |
+
|
| 53 |
+
### `projects` (335,146 rows, 20 MB)
|
| 54 |
+
|
| 55 |
+
| Column | Type | Meaning |
|
| 56 |
+
|---|---|---|
|
| 57 |
+
| `project` | string | PyPI project name |
|
| 58 |
+
| `version` | string | Latest release at scan time |
|
| 59 |
+
| `upload_time` | timestamp | Upload time of the scanned file (UTC) |
|
| 60 |
+
| `requires_python` | string | `Requires-Python` of the release, if set |
|
| 61 |
+
| `summary` | string | PyPI summary, cut at 300 characters |
|
| 62 |
+
| `file` | string | File that was scanned |
|
| 63 |
+
| `file_size` | int | Size of that file in bytes |
|
| 64 |
+
| `py_files` | int | `.py` files in the file |
|
| 65 |
+
| `py_failed` | int | `.py` files that do not parse as current Python (mostly Python 2) |
|
| 66 |
+
| `downloads_30d` | int | Downloads in the 30 days before the scan, for the top 60,000 projects; 0 for the rest |
|
| 67 |
+
|
| 68 |
+
### `own_modules` (382,127 rows)
|
| 69 |
+
|
| 70 |
+
Top-level modules each project provides, from its file layout. Use it to go from an import
|
| 71 |
+
name to a project: `PIL` to `pillow`, `yaml` to `PyYAML`.
|
| 72 |
+
|
| 73 |
+
### `pth_files` (626 rows)
|
| 74 |
+
|
| 75 |
+
`.pth` files that contain an `import` line. Python runs these at every start-up.
|
| 76 |
+
|
| 77 |
+
## How it was built
|
| 78 |
+
|
| 79 |
+
1. List every project whose latest event is newer than the cut-off date (PyPI Simple API and
|
| 80 |
+
XML-RPC changelog).
|
| 81 |
+
2. For each one, take the latest release and pick one file: a pure-Python wheel, then a
|
| 82 |
+
platform wheel, then the source distribution. Wheels are read with HTTP range requests,
|
| 83 |
+
so only the `.py` and `.pth` files are downloaded.
|
| 84 |
+
3. Parse each `.py` file with Python's `ast` module and record imports and attribute access
|
| 85 |
+
on imported names.
|
| 86 |
+
4. Add 30-day download counts from ClickHouse's public PyPI dataset.
|
| 87 |
+
|
| 88 |
+
12.3 million `.py` files were parsed. The scanner's README has the details and the measured run
|
| 89 |
+
times.
|
| 90 |
+
|
| 91 |
+
## Known limits
|
| 92 |
+
|
| 93 |
+
- Only the latest release of each project. Projects with no release in the window are not
|
| 94 |
+
included.
|
| 95 |
+
- Dynamic imports (`importlib.import_module`, `__import__`, `getattr`) are missed.
|
| 96 |
+
- Names reached through variables (`x = np; x.foo`) are missed.
|
| 97 |
+
- Files that do not parse as current Python are counted in `py_failed` but not indexed.
|
| 98 |
+
- Projects whose authors asked to be left out are not included.
|
| 99 |
+
|
| 100 |
+
## Example queries
|
| 101 |
+
|
| 102 |
+
Which packages use `requests.Session`, by downloads:
|
| 103 |
+
|
| 104 |
+
```sql
|
| 105 |
+
SELECT r.project, p.downloads_30d
|
| 106 |
+
FROM refs r JOIN projects p USING (project)
|
| 107 |
+
WHERE r.name = 'requests.Session'
|
| 108 |
+
ORDER BY p.downloads_30d DESC
|
| 109 |
+
LIMIT 20;
|
| 110 |
+
```
|
| 111 |
+
|
| 112 |
+
Which packages still import `distutils`:
|
| 113 |
+
|
| 114 |
+
```sql
|
| 115 |
+
SELECT count(DISTINCT project) FROM refs WHERE module = 'distutils';
|
| 116 |
+
```
|
| 117 |
+
|
| 118 |
+
With DuckDB, without downloading the files first:
|
| 119 |
+
|
| 120 |
+
```sql
|
| 121 |
+
SELECT count(DISTINCT project)
|
| 122 |
+
FROM 'hf://datasets/pypi-data/py-code/refs.parquet'
|
| 123 |
+
WHERE name = 'httpx.AsyncClient';
|
| 124 |
+
```
|
| 125 |
+
|
| 126 |
+
## Removal
|
| 127 |
+
|
| 128 |
+
If you maintain a package and want it left out, email dev@py-code.org from an address listed
|
| 129 |
+
on its PyPI page. It is removed at the next update.
|
| 130 |
+
|
| 131 |
+
## Credit
|
| 132 |
+
|
| 133 |
+
From 2023 to 2026 py-code.org hosted [Tom Forbes](https://tomforb.es)' PyPI Data project. This
|
| 134 |
+
dataset is a new, independent project on the same domain and does not reuse its data.
|
own_modules.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:ea953eedfdcece9e0971744b78c4e3f91747ec4e495397a41a28532d233480c7
|
| 3 |
+
size 4244864
|
projects.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:1074ce5ab96d725a52820b307b559df6b500268ec1324b49a8e688d2f4eed84a
|
| 3 |
+
size 19530196
|
pth_files.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:7374c4bf85e6832b4e4348a2bdabdb5a0f6af71a54774b53c2bab2f764c1e00a
|
| 3 |
+
size 14386
|
refs.parquet
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:5717aa0cf94ed8b53dfd67c72ec0160fb3ba3773b1e35973515842c4e24488e2
|
| 3 |
+
size 763414221
|