--- pretty_name: PyPI Code Graphs (v4) language: - code - en tags: - python - pypi - code - graph - static-analysis - libcst - parquet size_categories: - 100M` to pin a release. Streaming avoids downloading the full corpus. The `train` split is a **storage convention**, not a validated training split. Do not use random node/row splits to measure cross-package generalization: related packages, vendored code, and near duplicates can leak across them. Construct splits by package and code families before training or evaluation. For a complete local shard and a per-file graph, see [`examples/pypi_graphs.py`](examples/pypi_graphs.py). It downloads only the requested shard, retains candidate lists, and can retrieve the corresponding source record. The files are ordinary Parquet; no custom dataset loading script is required. ## Graph interpretation `source_id` joins `files`, `units`, and `edges` and identifies one source file. `unit_id` identifies a definition occurrence. `parent_unit_id` supplies the definition hierarchy; a synthetic module node has no parent. This is a **per-file definition and static-call graph**, not an expression-level AST, a dataflow graph, or a resolved whole-package runtime call graph. * `contains`: one parent and one child; `target_unit_ids` is a singleton. These hierarchy links are exact for the extracted definitions. * `calls`: a syntactic call expression belongs to `source_unit_id` and retains its resolution label. `target_unit_ids` can be empty, singleton, or contain alternative local targets. **Do not turn alternative candidates into multiple confirmed edges.** * Resolution labels are `local`, `local_heuristic`, `import`, `builtin`, `local_unresolved`, and `unresolved`. The same-class `self`/`cls` shortcut is labeled `local_heuristic`; general chained attribute calls are not assumed resolved. * `candidate_qualified_names` preserves external/builtin/ambiguous name evidence without inventing nodes for external packages. * Repeated calls with the same aggregation key are collapsed; `occurrences` records multiplicity and `line`/`column` retain the first position. This is not a complete call-site trace. `call_site_kind` distinguishes `body`, `decorator`, `default`, `annotation`, `class_header`, `class_body`, and `module_body` contexts. See [`SCHEMA.md`](SCHEMA.md) and [`schemas.json`](schemas.json) for fields and types. The raw tables keep topology separate from code-bearing node attributes, so they can support embedding and graph learning views without serializing target IDs into embedding text. A future model-specific view still needs deliberate feature masking, negative sampling, and leakage-safe splits; those choices are not baked into this release. ## Code representation and identity LibCST preserves identifier spelling, literals, docstrings, annotations, decorators, imports and ordering. Ordinary comments and blank lines are removed by the normalizer; shebang/encoding directives and type comments are retained when present upstream. No identifiers are alpha-renamed and no code is executed. Isolated unit representations stub nested child definitions while retaining surrounding executable and declarative statements. Full-file normalized text is omitted by this build's default; retrieve the upstream-cleaned text through the `source` table. `source_id` is a versioned deterministic digest of `(package, path, filename)`. `content_hash` separately detects changes to source text. `unit_id` incorporates the source identity and scoped definition path with same-name occurrence ordinals; it does not merge identical code in different files. Scoped structural hashes describe the full unit, isolated unit, header, isolated body, and ordered child structure. They remain sensitive to names, literals, and annotations; they are not semantic equivalence proofs. ## Coverage and failures | File status | Files | Interpretation | | --- | ---: | --- | | `ok` | 1,733,207 | Completed extraction | | `syntax_error` | 35,202 | Retained file record; no graph | | `skipped_pathological` | 1,088 | Above the 1,000,000-character limit; retained file record | | `analysis_error` | 6 | Retained unexpected-error record; no graph | | `metadata_error` | 1 | Partial graph: 203 definitions and 202 containment links; no call analysis | There are **1,733,208 module roots**, including the partial metadata-error graph. Consumers requiring fully analyzed files should filter `files.parse_status == "ok"` and join that filter into the other tables. Failed/skipped files remain recoverable from the source table. Python-2 syntax was not automatically converted. ## Provenance and validation Upstream: `vikp/pypi_clean` at `c59858d4234adcf51e843623cdca78ed9ae094c5`. The upstream card describes a selection of Python, Markdown, reStructuredText and rendered notebooks from package archives, with leading comments/licenses removed. The `source` configuration is a byte-for-byte copy of its 64 Parquet files; it is not the original unmodified package archives. Extraction used CPython **3.14.6**, LibCST **1.9.0**, and PyArrow **25.0.0**. The exact extractor modules are included under [`extractor/`](extractor/README.md). Transform fingerprint: `d63b9351e4ca57e605b58ad05c7a81d2aade032340fd95564c98944f8ed44b76`. Release checks covered all partitions and all values: completed-build checksums, upstream source checksums, globally unique file/node IDs, schema/version validity, source spans, per-file counts, endpoint locality, the complete containment hierarchy, and full Arrow value equality after repacking. See [`audit/corpus-audit.json`](audit/corpus-audit.json), [`audit/span-bounds.json`](audit/span-bounds.json), [`audit/diagnostic-check.json`](audit/diagnostic-check.json), and `manifest.json`. Static resolution labels express the extractor's evidence, not a guarantee of runtime behavior. ## Licensing and reuse **There is no blanket license grant for the collected package code.** The upstream snapshot does not supply per-package license metadata and reports removing leading license comments. Package names and archive paths are retained to help users recover the original projects and their terms. This release does not establish that every package is permissively licensed. See [`LICENSE_NOTES.md`](LICENSE_NOTES.md). For attribution, cite this repository with its commit SHA, the pinned upstream snapshot, and the originating packages as applicable. Corrections can be reported through the dataset's community discussions, preferably with `source_id`/`unit_id`.