Source code to structural graph facts — Python bindings
Project description
code2graph Python bindings
code2graph-rs exposes the Rust extractor and resolver as Python values. It returns neutral symbols, references, and edges; it performs no storage or policy work.
Identity wire format
Facts and graphs encode SymbolId losslessly. Global identities use an object with version: 1, scip, and lang; local identities use version: 1, scip, and file. The scip value stays compatible with SCIP tooling, but SCIP has no language or local-file coordinate, so applications must retain the whole object when persisting or forwarding facts. Deserialization also accepts the legacy plain SCIP string for compatibility, though it cannot preserve those identity coordinates. GraphIndex deliberately rejects that lossy form for identity lookup and traversal.
GraphIndex queries
GraphIndex accepts a resolved CodeGraph dictionary whose symbol and edge IDs are lossless structural-ID dictionaries. Python method names and serde payload fields use snake_case:
index = GraphIndex(graph)
index.symbol(symbol_id) # a locally defined symbol or None
index.symbols_named("run")
index.ids_with_scip(symbol_id["scip"]) # plural: SCIP display strings can collide
index.incoming(symbol_id, 50, "Call", "Scoped", "ScopeGraph")
index.outgoing(symbol_id, 50)
index.impact(symbol_id, 3, 100, "Call", "Scoped", "ScopeGraph")
Global IDs are { "version": 1, "scip": ..., "lang": ... }; local IDs are { "version": 1, "scip": ..., "file": ... }. ids_with_scip is plural because globals with different lang coordinates and locals with different file coordinates can have identical SCIP display strings. Edges may also contain endpoint-only IDs: they are traversable, but symbol returns None for them.
incoming, outgoing, and impact accept optional role, min_confidence, and provenance filters. Valid role values are Call, IsImplementation, Import, ModuleRef, TypeRef, Read, and Write; confidence values are Heuristic, NameOnly, Scoped, and Exact; provenance values are SymbolTable, ScopeGraph, FfiBridge, Conformance, NormalizedName, and External. All provided filters are conjoined. Omitted filters allow every role/provenance and use Heuristic as the confidence floor. limit must be a positive u32; output order is deterministic. impact follows incoming edges, excludes the seed, terminates cycles, and returns { "steps": ..., "truncated": ... }. truncated is true only if a depth or node bound omitted a matching reachable ID; no visited field is returned.
After maturin develop, or after installing the wheel produced by maturin build, run python -m unittest bindings/python/tests/test_query.py from the repository root to exercise this surface.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
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 code2graph_rs-0.0.0b15.tar.gz.
File metadata
- Download URL: code2graph_rs-0.0.0b15.tar.gz
- Upload date:
- Size: 573.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b45b3c72eb1e8ba42f0eaecd7dea1d93348f377c4ea3693c42d9fa87c72f1727
|
|
| MD5 |
103a07890536ad71dea4dbb2acdf1a0c
|
|
| BLAKE2b-256 |
cf53102bd79af1b3e31eb665eb2007cd7782a01fa7f0bed07e113da6a01c04e5
|
Provenance
The following attestation bundles were made for code2graph_rs-0.0.0b15.tar.gz:
Publisher:
release.yml on NodeDB-Lab/code2graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code2graph_rs-0.0.0b15.tar.gz -
Subject digest:
b45b3c72eb1e8ba42f0eaecd7dea1d93348f377c4ea3693c42d9fa87c72f1727 - Sigstore transparency entry: 2200277874
- Sigstore integration time:
-
Permalink:
NodeDB-Lab/code2graph@ca9dea22656f5a8e94db4fd488ab564745293adf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NodeDB-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca9dea22656f5a8e94db4fd488ab564745293adf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file code2graph_rs-0.0.0b15-cp39-abi3-win_amd64.whl.
File metadata
- Download URL: code2graph_rs-0.0.0b15-cp39-abi3-win_amd64.whl
- Upload date:
- Size: 5.1 MB
- Tags: CPython 3.9+, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8640975eb0606fcf15150a4faca271fffc34ec7dc0e3dd97241f11cb9a91768
|
|
| MD5 |
6431a4c075dcbddb26352fbf45bf7e56
|
|
| BLAKE2b-256 |
7163482d268d11ed06b7e53990b3d55f3e637e125c4dd9aac909234eb496861b
|
Provenance
The following attestation bundles were made for code2graph_rs-0.0.0b15-cp39-abi3-win_amd64.whl:
Publisher:
release.yml on NodeDB-Lab/code2graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code2graph_rs-0.0.0b15-cp39-abi3-win_amd64.whl -
Subject digest:
b8640975eb0606fcf15150a4faca271fffc34ec7dc0e3dd97241f11cb9a91768 - Sigstore transparency entry: 2200278446
- Sigstore integration time:
-
Permalink:
NodeDB-Lab/code2graph@ca9dea22656f5a8e94db4fd488ab564745293adf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NodeDB-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca9dea22656f5a8e94db4fd488ab564745293adf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file code2graph_rs-0.0.0b15-cp39-abi3-musllinux_1_2_x86_64.whl.
File metadata
- Download URL: code2graph_rs-0.0.0b15-cp39-abi3-musllinux_1_2_x86_64.whl
- Upload date:
- Size: 5.6 MB
- Tags: CPython 3.9+, musllinux: musl 1.2+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
8b72da0dadfc38ca635d3f136f33ea1843124ba3bd882f2f63c8591ccd08829a
|
|
| MD5 |
52b5cf5d41e7e7869016273c1c4299fe
|
|
| BLAKE2b-256 |
c38ace28b655a17dd701693b217ef5128e5fda65c9daf81d2888bdb15cfaa911
|
Provenance
The following attestation bundles were made for code2graph_rs-0.0.0b15-cp39-abi3-musllinux_1_2_x86_64.whl:
Publisher:
release.yml on NodeDB-Lab/code2graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code2graph_rs-0.0.0b15-cp39-abi3-musllinux_1_2_x86_64.whl -
Subject digest:
8b72da0dadfc38ca635d3f136f33ea1843124ba3bd882f2f63c8591ccd08829a - Sigstore transparency entry: 2200278139
- Sigstore integration time:
-
Permalink:
NodeDB-Lab/code2graph@ca9dea22656f5a8e94db4fd488ab564745293adf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NodeDB-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca9dea22656f5a8e94db4fd488ab564745293adf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.
File metadata
- Download URL: code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
- Upload date:
- Size: 5.3 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ce701773a453226c81b087f5236043082a336931e2154a1d047500a18f02d69
|
|
| MD5 |
600f77cfbc60bc91db10be3e611a6302
|
|
| BLAKE2b-256 |
310d882eca022957277ad41b0c50597ea60c18c2f73b0fcef13b22c00250caa7
|
Provenance
The following attestation bundles were made for code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:
Publisher:
release.yml on NodeDB-Lab/code2graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl -
Subject digest:
7ce701773a453226c81b087f5236043082a336931e2154a1d047500a18f02d69 - Sigstore transparency entry: 2200278793
- Sigstore integration time:
-
Permalink:
NodeDB-Lab/code2graph@ca9dea22656f5a8e94db4fd488ab564745293adf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NodeDB-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca9dea22656f5a8e94db4fd488ab564745293adf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl.
File metadata
- Download URL: code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.9+, manylinux: glibc 2.17+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
08cf4f2f223ab2971949f595d610ea8dce7f5786a749992ba1487e296d01014f
|
|
| MD5 |
49500d74acfac476909ed7284e33c96f
|
|
| BLAKE2b-256 |
c358ce893232c23712fb065c3526da827420e19d154ffb3e800fe21763819c66
|
Provenance
The following attestation bundles were made for code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl:
Publisher:
release.yml on NodeDB-Lab/code2graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code2graph_rs-0.0.0b15-cp39-abi3-manylinux_2_17_aarch64.manylinux2014_aarch64.whl -
Subject digest:
08cf4f2f223ab2971949f595d610ea8dce7f5786a749992ba1487e296d01014f - Sigstore transparency entry: 2200278005
- Sigstore integration time:
-
Permalink:
NodeDB-Lab/code2graph@ca9dea22656f5a8e94db4fd488ab564745293adf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NodeDB-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca9dea22656f5a8e94db4fd488ab564745293adf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file code2graph_rs-0.0.0b15-cp39-abi3-macosx_11_0_arm64.whl.
File metadata
- Download URL: code2graph_rs-0.0.0b15-cp39-abi3-macosx_11_0_arm64.whl
- Upload date:
- Size: 5.4 MB
- Tags: CPython 3.9+, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4364970419cd0d8b1829542746f081650e0ca9bf4b820fb06bcf04afd0ef1d12
|
|
| MD5 |
e08d3eff034dfc6a410c81d54123f58c
|
|
| BLAKE2b-256 |
1d9cc383d31d2adfc3be01352cffac69373126433812f183b833457283f1c207
|
Provenance
The following attestation bundles were made for code2graph_rs-0.0.0b15-cp39-abi3-macosx_11_0_arm64.whl:
Publisher:
release.yml on NodeDB-Lab/code2graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code2graph_rs-0.0.0b15-cp39-abi3-macosx_11_0_arm64.whl -
Subject digest:
4364970419cd0d8b1829542746f081650e0ca9bf4b820fb06bcf04afd0ef1d12 - Sigstore transparency entry: 2200278601
- Sigstore integration time:
-
Permalink:
NodeDB-Lab/code2graph@ca9dea22656f5a8e94db4fd488ab564745293adf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NodeDB-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca9dea22656f5a8e94db4fd488ab564745293adf -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file code2graph_rs-0.0.0b15-cp39-abi3-macosx_10_12_x86_64.whl.
File metadata
- Download URL: code2graph_rs-0.0.0b15-cp39-abi3-macosx_10_12_x86_64.whl
- Upload date:
- Size: 5.2 MB
- Tags: CPython 3.9+, macOS 10.12+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
cac775e9e0e249ec37e3306cd6b554bda77bc4d44a0c651cccb80cbec3719569
|
|
| MD5 |
36c18a4320443195c825dc1da63c85b9
|
|
| BLAKE2b-256 |
f338d44fce107fbe86e5de670a1065872b78b060a171b85127dc08c315966e17
|
Provenance
The following attestation bundles were made for code2graph_rs-0.0.0b15-cp39-abi3-macosx_10_12_x86_64.whl:
Publisher:
release.yml on NodeDB-Lab/code2graph
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
code2graph_rs-0.0.0b15-cp39-abi3-macosx_10_12_x86_64.whl -
Subject digest:
cac775e9e0e249ec37e3306cd6b554bda77bc4d44a0c651cccb80cbec3719569 - Sigstore transparency entry: 2200278265
- Sigstore integration time:
-
Permalink:
NodeDB-Lab/code2graph@ca9dea22656f5a8e94db4fd488ab564745293adf -
Branch / Tag:
refs/heads/main - Owner: https://github.com/NodeDB-Lab
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@ca9dea22656f5a8e94db4fd488ab564745293adf -
Trigger Event:
workflow_dispatch
-
Statement type: