Extract, store, and visualize code relationships
Project description
source-graph
Extract, store, and visualize code relationships.
Overview
source-graph treats code as a container of relationships. It extracts relationships from source files, stores them in a structured format, and presents them as an interactive HTML visualization.
Architecture: Extractor → Store → Presenter
Installation
Requires Python 3.9+.
pip install -e .
Usage
CLI
The CLI has two subcommands: extract and serve.
Extract relationships to a database
source-graph extract src/*.py --output build/
This creates build/source_graph.db containing the extracted nodes and relations.
Serve an interactive report from a database
source-graph serve build/source_graph.db
This starts an HTTP server at http://127.0.0.1:8080 that serves the interactive report directly from the database, without generating a file on disk. Use --host and --port to customize the binding.
Library
from source_graph import RelationStore, PythonStructureExtractor
store = RelationStore()
extractor = PythonStructureExtractor()
nodes, relations = extractor.extract("my_module.py")
store.add_nodes(nodes)
store.add_relations(relations)
store.save("output.db")
Development
# Run tests
python -m pytest
# Run on the project itself
bash scripts/run-self-analysis.sh
Milestone 1
- Extractor: Python AST-based structure extraction (file → class → method/function)
- Store: In-memory store with JSON persistence
- Presenter: Interactive HTML with expand/collapse, dimension switching, and hover details
License
MIT
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 Distribution
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 source_graphh-0.0.1.tar.gz.
File metadata
- Download URL: source_graphh-0.0.1.tar.gz
- Upload date:
- Size: 632.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 |
63442b1e5a73521d7a61c4bb74d7d1c1818677dee526a7cd4c43e9831591990e
|
|
| MD5 |
fed1c20477e7b33368707e8ae9d7aa20
|
|
| BLAKE2b-256 |
c1e81162a66afc1f7543cadcb842c92db1ab5c8590b5699f3e531fddcc4b0cb0
|
Provenance
The following attestation bundles were made for source_graphh-0.0.1.tar.gz:
Publisher:
release.yml on SR1s/CoreIntuition
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
source_graphh-0.0.1.tar.gz -
Subject digest:
63442b1e5a73521d7a61c4bb74d7d1c1818677dee526a7cd4c43e9831591990e - Sigstore transparency entry: 1584948146
- Sigstore integration time:
-
Permalink:
SR1s/CoreIntuition@21843292ab6efe5a55c388967cd074fe5676c93d -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/SR1s
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@21843292ab6efe5a55c388967cd074fe5676c93d -
Trigger Event:
release
-
Statement type:
File details
Details for the file source_graphh-0.0.1-py3-none-any.whl.
File metadata
- Download URL: source_graphh-0.0.1-py3-none-any.whl
- Upload date:
- Size: 23.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
e2035459d91cd953e1fd7884c61d14f82f3647b936d10a455faa003593090a0f
|
|
| MD5 |
e263790b4ee897a8dc32f8ee7a070592
|
|
| BLAKE2b-256 |
a9e4817e34fafa56c4a1cb31374e914860986a45deb9d941a0375382b59a80e0
|
Provenance
The following attestation bundles were made for source_graphh-0.0.1-py3-none-any.whl:
Publisher:
release.yml on SR1s/CoreIntuition
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
source_graphh-0.0.1-py3-none-any.whl -
Subject digest:
e2035459d91cd953e1fd7884c61d14f82f3647b936d10a455faa003593090a0f - Sigstore transparency entry: 1584948287
- Sigstore integration time:
-
Permalink:
SR1s/CoreIntuition@21843292ab6efe5a55c388967cd074fe5676c93d -
Branch / Tag:
refs/tags/v0.0.1 - Owner: https://github.com/SR1s
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@21843292ab6efe5a55c388967cd074fe5676c93d -
Trigger Event:
release
-
Statement type: