A codebase graph and codemod library.
Graph-sitter lets Python programs parse whole repositories, build reference and import graphs, query code relationships, and make targeted source edits — with the largest indexes moving into Rust for scale.
$ uvx graph-sitter parse .parse any repofrom graph_sitter import Codebasecodebase = Codebase("./") for fn in codebase.functions:if not fn.usages:fn.remove() # python stays the control planecodebase.commit()A graph-shaped API for codebase automation.
Everything resolves through one editable model of your repository — so analysis and rewrites stay consistent.
Parse real codebases
Load Python, TypeScript, JavaScript, and React repositories into files, directories, and language-aware symbols.
Build the graph
Index imports, exports, function calls, references, usages, and dependencies before touching any source text.
Run guarded codemods
Write transformations that move, rename, delete, and rewrite code while keeping the related graph edges in sync.
Programmatic refactors, analysis, and repo maintenance.
Reach for graph-sitter when a change is too mechanical for hands and too structural for find-and-replace.
- Delete dead code with usage checks
- Move symbols while repairing imports
- Trace API impact across a repo
- Inspect import and reference graphs
- Build custom codebase analytics
- Run checked codemods before writes
Same Python workflow, smaller graph engine.
The resurrection keeps the Python shell intact while moving the heavy lifting into Rust.
Python stays the shell
The authoring experience remains Python: notebooks, scripts, reusable codemods, and the high-level editable API.
Rust handles scale
The rewrite path moves the massive parse and index data structure into a compact Rust backend for large repositories.
uvx is the entrypoint
The target command is uvx graph-sitter for repository parsing, graph inspection, and guarded transformations.
One command surface for parse, inspect, and transform.
The release target is uvx graph-sitter: start with fast parse summaries and graph inspection, then run codemods in explicit check and write modes.
uvx graph-sitter parse . \--language auto --backend rust --format summary uvx graph-sitter transform ./codemods/rename.py --check # branch wheel proof:# uvx --from dist/*.whl graph-sitter parse . --backend rust