Skip to main content

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

source_graphh-0.0.1.tar.gz (632.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

source_graphh-0.0.1-py3-none-any.whl (23.7 kB view details)

Uploaded Python 3

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

Hashes for source_graphh-0.0.1.tar.gz
Algorithm Hash digest
SHA256 63442b1e5a73521d7a61c4bb74d7d1c1818677dee526a7cd4c43e9831591990e
MD5 fed1c20477e7b33368707e8ae9d7aa20
BLAKE2b-256 c1e81162a66afc1f7543cadcb842c92db1ab5c8590b5699f3e531fddcc4b0cb0

See more details on using hashes here.

Provenance

The following attestation bundles were made for source_graphh-0.0.1.tar.gz:

Publisher: release.yml on SR1s/CoreIntuition

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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

Hashes for source_graphh-0.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 e2035459d91cd953e1fd7884c61d14f82f3647b936d10a455faa003593090a0f
MD5 e263790b4ee897a8dc32f8ee7a070592
BLAKE2b-256 a9e4817e34fafa56c4a1cb31374e914860986a45deb9d941a0375382b59a80e0

See more details on using hashes here.

Provenance

The following attestation bundles were made for source_graphh-0.0.1-py3-none-any.whl:

Publisher: release.yml on SR1s/CoreIntuition

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page