This release is a pre-release and may not be stable for production use.
symgraph
Static analysis engine that maps Python codebases into a queryable property graph by resolving symbol definitions, inferring types, and tracing call/reference relationships.
Features
- Symbol Extraction: Identifies and catalogs modules, classes, functions, methods, and variables.
- Static Type Inference: Performs a multi-pass analysis (up to 10 iterations) to resolve variable types and function return types across the project.
- Relationship Mapping: Traces connections between symbols, specifically distinguishing between direct calls and symbol references.
- Context-Aware Analysis: Handles
selfreferences within class scopes and resolves method calls based on inferred object types. - Symbol Querying: Provides a detailed lookup for any symbol, showing its definition location and a list of what it uses and what it is used by.
Installation
pip install symgraph
Usage
Once installed, you can use the symgraph command directly from your terminal.
1. Map an Entire Codebase
To generate a full JSON list of all edges (connections) in a directory or file:
symgraph /path/to/your/project
The output is a JSON array where each entry contains the source, destination, and kind of relationship (e.g., call or ref).
2. Inspect a Specific Symbol
To get a comprehensive report on a specific class, function, or variable:
symgraph /path/to/your/project SymbolName
Example Query Result:
[
{
"symbol": "module.ClassName.method_name",
"kind": "method",
"file": "path/to/file.py",
"lines": [10, 20],
"uses": [
{ "name": "other_module.helper_func", "kind": "function" }
],
"used_by": [
{ "name": "main.run", "kind": "function", "via": "ClassName.method_name" }
]
}
]
License
Apache-2.0
Release files for symgraph 0.0.1a0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| symgraph-0.0.1a0.tar.gz | 9.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| symgraph-0.0.1a0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.9 kB
Release files / symgraph-0.0.1a0.tar.gz
| Download URL | symgraph-0.0.1a0.tar.gz |
|---|---|
| Size | 9.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
dc09fb2c1d756e5d477e50c7c1cfa22ee83dbd44a46510cf9bf2332dee2705bb
|
|
BLAKE2b-256 checksum How to use checksums |
36e81bbe67356194aebd735f6152eb0abc4018a86cd959bacf1cb7be658dfe6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|
Release files / symgraph-0.0.1a0-py3-none-any.whl
| Download URL | symgraph-0.0.1a0-py3-none-any.whl |
|---|---|
| Size | 10.3 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
120955cc045ea47b9f76c88bd0c6c12335c2397578ca608a08625721c5e17942
|
|
BLAKE2b-256 checksum How to use checksums |
0a15edab2d3c95badc85dfaaf1c9055bd73a812a8a61fe5b3a652fa94119b328
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.12.8
|