Skip to main content

depgraph-extract

CI License: MIT Python Local · no signup Sources

Turn your infrastructure, code, and agent frameworks into a directed dependency graph.

One consistent interface across 15 sources. Every parser returns the same thing — a plain list[tuple[str, str]] edge list — so you can point it at a Docker Compose file, a Terraform directory, an OpenTelemetry trace, or a LangGraph / CrewAI / AutoGen app and get a graph you can drop straight into graphviz, networkx, or your own analysis.

import depgraph_extract

# Auto-detect everything in a directory
edges, sources = depgraph_extract.from_directory(".")
# edges  -> [("web", "api"), ("api", "db"), ...]
# sources -> {"docker-compose": 4, "terraform": 7, "langgraph": 3}

# Or target one source
edges = depgraph_extract.extract.from_docker_compose("docker-compose.yml")
edges = depgraph_extract.extract.from_langgraph("agent.py")
edges = depgraph_extract.extract.from_otel_traces("trace.json")

No graph runtime. No service to sign up for. On the deterministic path, nothing leaves your machine.

Why depgraph-extract?

You already describe your system somewhere — Compose files, Terraform, agent code, OpenTelemetry traces. depgraph-extract turns any of it into the same edge list, so you can:

  • See what depends on what — pipe the graph into graphviz or networkx; no separate diagram tool, no diagram to keep in sync by hand.
  • Read an agent's real control flow — get the graph straight from LangGraph / CrewAI / AutoGen source, statically, without running it or installing the framework.
  • Gate drift in CI — diff the edge list between commits and fail the build when a new dependency, cycle, or single point of failure sneaks in.
  • Feed structural analysis — one normalized graph across every source, ready for centrality, cycle detection, or any graph algorithm you like.

Install

pip install depgraph-extract

That's it — PyYAML is the only dependency (used by the Compose / k8s / Terraform / CloudFormation parsers). The AST- and JSON-based parsers need nothing beyond the standard library.

Run it

No files of your own? Paste this — it needs nothing but pip install depgraph-extract:

import depgraph_extract, tempfile, os

# A tiny LangGraph agent. depgraph-extract parses it by AST — it never runs the file
# and doesn't need langgraph installed.
code = '''
from langgraph.graph import StateGraph
g = StateGraph(dict)
g.set_entry_point("planner")
g.add_edge("planner", "researcher")
g.add_edge("researcher", "writer")
g.set_finish_point("writer")
'''
path = os.path.join(tempfile.mkdtemp(), "agent.py")
open(path, "w").write(code)

for src, dst in depgraph_extract.extract.from_langgraph(path):
    print(f"{src} -> {dst}")
# START -> planner
# planner -> researcher
# researcher -> writer
# writer -> END

Or clone the repo and run the fuller examples/quickstart.py — it parses an agent and a Compose file, auto-detects the whole directory, then blends and dedupes:

git clone https://github.com/jmurray10/depgraph-extract
cd depgraph-extract && pip install -e . && python examples/quickstart.py

What it parses

Category Sources
Agent frameworks LangGraph, CrewAI, AutoGen — by AST, without importing the framework
Containers & orchestration Docker Compose, Kubernetes
Infrastructure as code Terraform, CloudFormation, AWS CDK (Python), Pulumi (Python)
CI / packaging GitHub Actions, package.json (+ workspaces), pyproject.toml / requirements.txt
Code Python imports (with adjustable module depth)
Telemetry OpenTelemetry traces — OTLP, Jaeger, Zipkin

The agent-framework parsers are the reason this exists: extracting the call graph from a LangGraph, CrewAI, or AutoGen file — statically, without running it or installing the framework — is something most graph tools can't do.

Blend sources

Combining extractors often yields the same logical node under several spellings (auth-svc, auth_svc, AuthService). dedupe_edges canonicalizes and merges:

compose = depgraph_extract.extract.from_docker_compose("docker-compose.yml")
traces  = depgraph_extract.extract.from_otel_traces("trace.json")
edges   = depgraph_extract.dedupe_edges(compose + traces, normalize="snake")

One-call discovery

edges, sources, log = depgraph_extract.find_edges(".")

find_edges runs the deterministic scan and returns the edges plus a human-readable log of what it did. If a repo has no recognized infra files, you can opt into an LLM fallback with find_edges(".", llm_fallback=True, provider="claude") — this sends file contents to Anthropic or Google, which is why it's off by default.

Where it goes next

An edge list is the universal input to structural graph analysis. These same parsers power the SemanticEmbed SDK, which encodes each node's structural role and flags single points of failure, amplification cascades, and convergence sinks from topology alone — but depgraph-extract stands on its own: the graph is yours to do anything with.

Contributing

New parsers are the most welcome contribution — see CONTRIBUTING.md for the one-rule parser contract, dev setup, and the PR checklist. Changes are logged in CHANGELOG.md.

git clone https://github.com/jmurray10/depgraph-extract
cd depgraph-extract && pip install -e '.[dev]' && pytest

Contact

Built by Jeff Murray (@jmurray10).

License

MIT — see LICENSE. No patent claims, no signup, no server. The graph is yours.

Metadata

Release files for depgraph-extract 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for depgraph-extract 0.1.0
File Size Uploaded
depgraph_extract-0.1.0.tar.gz 38.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for depgraph-extract 0.1.0
File Interpreter ABI Platform
depgraph_extract-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 63.1 kB

Release files / depgraph_extract-0.1.0.tar.gz

Download URL depgraph_extract-0.1.0.tar.gz
Size 38.1 kB
Tags Source
SHA-256 checksum
How to use checksums
28ea03cf91cac88cac77254c12aab4f941847b8cf1593f547c5a3a812eeba26c
BLAKE2b-256 checksum
How to use checksums
0d0d8e4078024f397ae6a312cc4bb79113005a999463f81a2b7eb53216aa1150
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Release files / depgraph_extract-0.1.0-py3-none-any.whl

Download URL depgraph_extract-0.1.0-py3-none-any.whl
Size 24.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
8be75c68e5e5cd6ef63cfb4dee5d8444839d3d251a194bda85abce5ce091fb49
BLAKE2b-256 checksum
How to use checksums
8f80429f7564671be50a04a4d9c8f7e1cc6f4c6c5b47eb91a9d3d2b042357362
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.12

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Jul 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page