skillfed

trailmark

Parse source code into a queryable graph of functions, classes, calls, and semantic annotations

trailmark v0.5.0 77.2K downloads/30d#14,549 on PyPI465
Permissive license Apache-2.0 Active released

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 trailmark

uv

uv add trailmark

poetry

poetry add trailmark

Installing 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

code graph parsingstatic analysis ASTfunction call graphsource code structure querymulti-language code analysissecurity code mappingcall path analysis
static-analysiscode-graphsecurity-audit

More Security packages