trailmark
Parse source code into a queryable graph of functions, classes, calls, and semantic annotations
What it is and what it does
Trailmark converts source code into a queryable directed graph of semantic entities—functions, classes, methods, calls, and annotations—across multiple programming languages. It uses tree-sitter for language-agnostic AST parsing and rustworkx for graph storage and traversal, extracting nodes (functions, classes, structs, etc.), edges (calls, inheritance, imports), and metadata (type annotations, cyclomatic complexity, exception types, docstrings). The package operates in three phases: parse (walk directories and extract code structure), index (load into a rustworkx graph with bidirectional mappings), and query (provide a high-level API for graph traversal and analysis).
The QueryEngine exposes methods to find callers, callees, transitive reachability, call paths between functions, complexity hotspots, entrypoint paths, and attack surface. It also supports semantic annotations (adding custom metadata to nodes), structural diffs between graphs, and integration with SARIF and weAudit findings. This makes it useful for security analysis, code review, impact assessment, and identifying gaps between code assumptions and test coverage.
Use it for:
- Map call chains from user-controlled entrypoints to sensitive functions for security auditing.
- Identify functions with high cyclomatic complexity and trace which code paths reach them.
- Analyze cross-file dependencies and detect circular imports or unexpected coupling.
- Augment static-analysis findings (SARIF, weAudit) with transitive reachability context.
- Generate attack-surface reports showing which functions are reachable from external inputs.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Parses source code into a queryable graph of functions, classes, calls, and semantic annotations using tree-sitter and rustworkx for security and code-structure analysis.
Yes, if you need multi-language code-structure analysis for security or code-review workflows. The package is actively maintained, has no known vulnerabilities, and covers multiple languages. The Python 3.12 requirement and early version number (0.5.0) mean it is not yet universally deployable, but the low install friction and permissive license make it a reasonable choice for teams already on modern Python. Verify performance and accuracy for your specific codebase before relying on it for critical security decisions.
Install
trailmark on PyPI
pip
pip install trailmarkuv
uv add trailmarkpoetry
poetry add trailmarkInstalling trailmark
Before you install
Low install friction with a pure-wheel distribution. Active maintenance (last commit 2026-07-28) and recent releases. Requires Python 3.12+, which is current but not yet universal in production environments.
License in practice
Apache-2.0 permissive license allows commercial and private use with minimal restrictions; suitable for most projects.
Quickstart
pip install trailmark
from trailmark import parse_directory
graph = parse_directory('/path/to/code', language='python')
engine = graph.query_engine()
callers = engine.callers_of('module:function')
Requires Python 3.12 or later; tree-sitter language packs must be installed for each language you parse.
Verify before relying
- Number of supported languages and their specific coverage beyond what the description excerpt lists.
- Performance characteristics and scalability limits for large codebases.
- Whether the package is production-ready or still in active research/development phase.
- Accuracy and coverage of cross-file call resolution and type inference across all supported languages.
Package facts
| License | Apache-2.0 (permissive) |
| Python support | supports the current Python release (>=3.12) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 4 — rustworkx, tree-sitter-language-pack, tree-sitter-sql, tree-sitter |
| Maintenance | actively maintained — 28 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 77,202/month — #14,549 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: trailmark-0.5.0-py3-none-any.whl
Tags
More Security packages
Provides Python bindings to the FreeDesktop.org…
permissive · top 1,000 on PyPI
msalMSAL for Python handles OAuth2 and OpenID…
permissive · top 1,000 on PyPI
joserfcjoserfc implements JOSE standards (JWS, JWE,…
permissive · top 1,000 on PyPI
AuthlibAuthlib provides a complete implementation of…
permissive · top 1,000 on PyPI
argon2-cffi-bindingsProvides low-level CFFI bindings to the…
permissive · top 1,000 on PyPI
adalADAL for Python authenticates applications with…
permissive · top 1,000 on PyPI
graphifyyParses code, docs, PDFs, images, and video into…
permissive · top 5,000 on PyPI
tree-sitter-haskellProvides a tree-sitter parser grammar for…
permissive · top 15,000 on PyPI
code-review-graphBuilds a structural knowledge graph of your…
permissive · top 15,000 on PyPI
asttokensAnnotates Python abstract syntax trees with the…
permissive · top 1,000 on PyPI
benigetBeniget performs compile-time analysis on…
permissive · top 15,000 on PyPI
tree-sitter-swiftProvides a tree-sitter grammar for parsing…
permissive · top 5,000 on PyPI
tree-sitter-javaProvides a Java language grammar for…
permissive · top 5,000 on PyPI
grep-astSearch source code files by pattern and display…
permissive · top 5,000 on PyPI
rustworkxA high-performance graph library for Python,…
permissive · top 5,000 on PyPI
ast-grep-cliast-grep-cli is a command-line tool for…
permissive · top 5,000 on PyPI