Skip to main content

Turn your infrastructure, code, and agent frameworks into a directed dependency graph — one edge-list API across 15 sources.

Project description

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.

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

depgraph_extract-0.1.0.tar.gz (38.1 kB view details)

Uploaded Source

Built Distribution

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

depgraph_extract-0.1.0-py3-none-any.whl (24.9 kB view details)

Uploaded Python 3

File details

Details for the file depgraph_extract-0.1.0.tar.gz.

File metadata

  • Download URL: depgraph_extract-0.1.0.tar.gz
  • Upload date:
  • Size: 38.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for depgraph_extract-0.1.0.tar.gz
Algorithm Hash digest
SHA256 28ea03cf91cac88cac77254c12aab4f941847b8cf1593f547c5a3a812eeba26c
MD5 e766487907bf2c5c31b654a9b8b666cf
BLAKE2b-256 0d0d8e4078024f397ae6a312cc4bb79113005a999463f81a2b7eb53216aa1150

See more details on using hashes here.

Provenance

The following attestation bundles were made for depgraph_extract-0.1.0.tar.gz:

Publisher: publish.yml on jmurray10/depgraph-extract

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

File details

Details for the file depgraph_extract-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for depgraph_extract-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8be75c68e5e5cd6ef63cfb4dee5d8444839d3d251a194bda85abce5ce091fb49
MD5 22516047565b2601c5d8043dc7841c7b
BLAKE2b-256 8f80429f7564671be50a04a4d9c8f7e1cc6f4c6c5b47eb91a9d3d2b042357362

See more details on using hashes here.

Provenance

The following attestation bundles were made for depgraph_extract-0.1.0-py3-none-any.whl:

Publisher: publish.yml on jmurray10/depgraph-extract

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