Skip to main content Switch to mobile version synapse-ast 0.1.0 AST-driven dependency tracer and token calculator for AI-assisted coding workflows.
pip install synapse-ast==0.1.0 Copy PIP instructions
AST-driven dependency tracer and token calculator for AI-assisted coding workflows.
Instead of dumping entire folders into an LLM's context window, synapse walks your Python codebase's import graph (including src/ layouts, relative imports, __init__.py re-exports, and namespace packages) and extracts only the files — or referenced symbols — transitively relevant to your target file, with token counts so you know exactly what you're spending.
pip install synapse-ast For local development with tests:
pip install -e ".[dev]" pytest Usage
synapse --version synapse map . # scan a repo, print structural summary synapse map . --json # machine-readable JSON summary synapse pack path/to/file.py # pack dependency chain to stdout synapse pack file.py --depth 3 --budget 8000 # limit depth and warn if over token budget synapse pack file.py --symbols # slice dependencies to referenced defs/classes synapse pack file.py --format markdown # text | markdown | xml | json synapse pack file.py --exclude-type-checking # skip `if TYPE_CHECKING:` imports synapse pack file.py --output clipboard # copy to clipboard (or --output file --out-file out.txt) Key options
--root
--depth, -d
--budget, -b
--symbols / --full-files: slice dependency files (depth >= 1) to only referenced functions, classes, constants, and imports while keeping the target intact (default: --full-files).
--format, -f
--output, -o
--strip-comments / --keep-comments, --strip-docstrings / --keep-docstrings, --strip-blank / --keep-blank.
--include-type-checking / --exclude-type-checking: include or exclude if TYPE_CHECKING: blocks (default: include).
--no-cache: ignore and bypass .synapse/cache.json for a full re-parse.
Clean stdout/stderr split on pack: only packed code goes to stdout so synapse pack file.py > context.txt stays clean; cache stats, token tables, and warnings go to stderr.
Offline tiktoken fallback: cl100k_base is used when available; if tiktoken cannot download its BPE table (e.g. offline/corporate proxy), synapse degrades gracefully to an approximate ~4 chars/token estimate and labels the output as approximate on stderr.
Caching (.synapse/): parsed AST symbol maps are cached in .synapse/cache.json using mtime + SHA-256 invalidation, and .synapse/ is automatically added to .gitignore on first cached run.
Released: Dec 3, 2026
MIT View SPDX License List
ast cli context-window dependency-graph llm tiktoken
Development Status 4 - Beta
Intended Audience Developers
License OSI Approved :: MIT License
Operating System OS Independent
Programming Language Python :: 3
Topic Software Development :: Code Generators
Release files for synapse-ast 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
Built distribution (wheel)
Total release size: 66.9 kB
Release files / synapse_ast-0.1.0.tar.gz
Release files / synapse_ast-0.1.0-py3-none-any.whl
Security for synapse-ast 0.1.0
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.
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.
Release history Release notifications | RSS feed
Dec 3, 2026 2 release files No provenance
"PyPI", "Python Package Index", and the blocks logos are registered trademarks of the Python Software Foundation.
© 2026 Python Software Foundation
Deployed from 107c339











