Skip to main content

Parse polyglot codebases into queryable kglite knowledge graphs — `import codingest; g = codingest.build('.')` returns a real kglite.KnowledgeGraph.

Project description

codingest

CI crates.io PyPI Docs License: MIT

Parse polyglot codebases into queryable kglite knowledge graphs — tree-sitter parsers for 14 languages, call / type / inheritance / route edges, an optional markdown-docs pass, and multi-git-revision merged graphs.

codingest is the standalone home of KGLite's former in-tree code_tree component. The graph engine (storage backends, the Cypher pipeline, .kgl persistence) and the MCP protocol server are imported from kglite as cargo libraries — this repo owns only the code-tree component itself. Four surfaces ship from one workspace: a CLI, an MCP server, a Python wheel, and a Rust crate.

Documentation: codingest.readthedocs.io

Requirements — kglite ≥ 0.14

codingest builds against 0.14-only engine APIs (kglite::api::code_entities, kglite_mcp_server::run_with_code_tree_hooks) that KGLite added when it removed its in-tree builder. These are not in any 0.13.x release.

  • Rust / crates.io: codingest cannot be published, and a checkout without a sibling ../KGLite cannot build, until kglite 0.14.0 is on crates.io. Local development uses a path dependency on the sister checkout (see Dependency policy).
  • Python wheel: pip install codingest pulls kglite>=0.13 for the loader half of the handoff, but the builder half needs a kglite that understands 0.14 graphs. Install kglite>=0.14 alongside it.

Install

pip install codingest          # Python wheel (grammars bundled) — ALSO installs the `codingest` CLI
cargo install codingest-cli    # pure-Rust `codingest` builder CLI (no Python)
cargo install codingest-mcp    # the code-graph MCP server

The Python wheel bundles the codingest terminal command (the codingest-cli Rust library is linked into the wheel's extension), so pip install codingest alone gives you both import codingest and codingest build/status — the cargo install codingest-cli route is only needed for a pure-Rust install. This makes the pip-only flow pip install kglite codingest && kglite skill install self-sufficient (the installed code-review skill shells out to codingest build/status).

(All become available once kglite 0.14.0 is published — see Requirements.)

Quick start

CLI

# Build a code graph from a checkout
codingest build /path/to/repo
# → /path/to/repo/.kglite/code-review.kgl

# Build committed content at specific revisions (multi-rev merged graph)
codingest build /path/to/repo --revs v1.0 v2.0

# Check whether an existing graph is stale relative to the tree
codingest status /path/to/repo

Then query or describe the .kgl with kglite (kglite.load(...), the kglite shell, or any MCP/Bolt client).

MCP server

# Serve a live code-graph workbench over stdio for an MCP client / agent
codingest-mcp --root-dir /path/to/repo

codingest-mcp embeds the kglite-mcp-server tool surface (set_root_dir, graph_overview, cypher_query, read_code_source, …) and injects the codingest builder, so set_root_dir builds a graph. Running plain kglite-mcp-server against a workspace refuses to build — it has no in-tree builder anymore. See the MCP docs.

Python wheel

import codingest

g = codingest.build(".")                 # returns a real kglite.KnowledgeGraph
g.cypher("MATCH (f:Function) RETURN f.name LIMIT 10")
codingest.build(".", save_to="code.kgl") # also persist the .kgl
codingest.build(".", rev="v1.0")         # build a git revision (or revs=[...])
codingest.repo_tree("owner/name")        # clone a GitHub repo and build

The .kgl-bytes handoff. The codingest and kglite wheels are two separate compiled extensions and can't share live Rust objects, so build() constructs the graph with codingest's native builder, serializes it to a .kgl, then calls the installed kglite wheel's load() and returns that object — a genuine kglite.KnowledgeGraph, so every downstream kglite API works.

Bundled CLI. The same wheel also provides the codingest terminal command (a codingest/cli.py console-script shim forwarding into the linked codingest-cli library), so codingest build/status works straight after pip install codingest — identical semantics to cargo install codingest-cli.

Rust crate

[dependencies]
codingest = "0.1"   # needs kglite 0.14 on crates.io (see Requirements)
kglite = "0.14"
use codingest::build_code_tree; // = builder::run_with_options
let graph = build_code_tree(dir, /*verbose=*/false, /*include_tests=*/true,
                            /*save_to=*/None, /*max_loc=*/None, /*include_docs=*/false)?;
// Query with kglite's Cypher pipeline, persist with kglite::api::io, …

Workspace layout

Crate What it is
crates/codingest The component library (codingest): builder, parsers, manifest reader, docs pass, multi-rev merge, cross-language edges. Extracted from the former KGLite/crates/kglite/src/code_tree/ (removed upstream 2026-07-16) and re-targeted at the public kglite::api facade. Ships the codingest_stats + codingest_bench binaries.
crates/codingest-cli codingest binary — build a checkout or git revision(s) into a .kgl graph, status to check staleness.
crates/codingest-mcp codingest-mcp binary — the full MCP tool surface imported from the kglite-mcp-server library, with the codingest builder injected.
crates/codingest-py PyO3 wrapper built by maturin into the codingest wheel (pip install codingest). Python package source is codingest/; pyproject.toml drives the maturin build. Not published to crates.io (publish = false).

CI-equivalent local gate: make gate

make gate is the single-entry-point local gate that mirrors CI (cargo fmt --check, cargo clippy --workspace --all-targets -- -D warnings, workspace build + test incl. the golden oracle) and adds codingest-specific checks (determinism reproducer, codingest_bench parity smoke, the wheel build + the tests/python acceptance suite). Run it before pushing. Individual steps are also targets (make clippy, make determinism, …); make fmt auto-formats.

The golden-digest oracle

KGLite deleted its in-tree code_tree builder on 2026-07-16, so the old two-builder parity sweep is gone. The authority it enforced was frozen while the builders were still verified identical, into per-corpus SHA-256 digests under crates/codingest/tests/goldens/ (committed fixtures — no network). The golden_parity test builds each corpus with only the codingest builder, digests a canonical exhaustive graph rendering, and compares to the frozen golden. The multi-rev fixture is guarded instead by rev_self_consistency. Regenerate goldens only for deliberate builder-behavior changes: cargo test -p codingest --test parity -- --ignored capture_goldens (details in crates/codingest/tests/goldens/README.md).

Dependency policy

kglite and kglite-mcp-server are path dependencies on the sister checkout ../KGLite with a version = "0.13" crates.io fallback. The fallback is kept at 0.13 (not 0.14) only because the local sister checkout is still versioned 0.13.4 while carrying the 0.14 APIs — a path dep's version requirement must be satisfiable by the path crate, so 0.14 would break the local build today. When kglite 0.14.0 ships, the maintainer bumps both fallbacks to 0.14 and flips the CODINGEST_KGLITE_READY CI variable (see the workspace Cargo.toml note and .github/workflows/ci.yml).

Parity with the (now-removed) in-tree component

codingest was extracted to be feature- and performance-identical to kglite's in-tree code_tree. KGLite removed that module on 2026-07-16, so parity is now enforced against a frozen record of its last-known-good output rather than live cross-comparison. See PARITY.md (stats-diff + timing), BENCHMARKS.md (build-time + Cypher benchmarks), crates/codingest/tests/parity.rs (the golden oracle), and docs/mcp-parity.md (the MCP↔builder coupling and the hook).

tests/python-legacy/ preserves KGLite's full 47-file kglite.code_tree behavioral suite verbatim as the dormant behavioral spec — the source of truth for what the Python builder guaranteed (see its README).

License

MIT © Kristian dF Kollsgård. codingest is an independent project; it depends on kglite at runtime but is not otherwise affiliated with it.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distributions

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

codingest-0.1.0-cp310-abi3-win_amd64.whl (5.1 MB view details)

Uploaded CPython 3.10+Windows x86-64

codingest-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl (5.0 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.28+ ARM64

codingest-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl (5.3 MB view details)

Uploaded CPython 3.10+manylinux: glibc 2.17+ x86-64

codingest-0.1.0-cp310-abi3-macosx_11_0_arm64.whl (4.9 MB view details)

Uploaded CPython 3.10+macOS 11.0+ ARM64

codingest-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl (5.1 MB view details)

Uploaded CPython 3.10+macOS 10.12+ x86-64

File details

Details for the file codingest-0.1.0-cp310-abi3-win_amd64.whl.

File metadata

  • Download URL: codingest-0.1.0-cp310-abi3-win_amd64.whl
  • Upload date:
  • Size: 5.1 MB
  • Tags: CPython 3.10+, Windows x86-64
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for codingest-0.1.0-cp310-abi3-win_amd64.whl
Algorithm Hash digest
SHA256 98036ef3f4846ec69abb1d15cc75509604c24879c5e0b9c7078a4b257e41cb60
MD5 ddd81e45c1f0f326ff27f24d407fb5ee
BLAKE2b-256 2a87c02240f94ab20e27f97888fe10ec798338d024d84860a4d967eba6e7f736

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.0-cp310-abi3-win_amd64.whl:

Publisher: release.yml on kkollsga/codingest

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

File details

Details for the file codingest-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl.

File metadata

File hashes

Hashes for codingest-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl
Algorithm Hash digest
SHA256 e78fb95294e817609c32de5f5938d450d25e9e937c1f775a662d1ed659f05e23
MD5 45ffb3aa0796c9dd913d382b7e9f6151
BLAKE2b-256 5f179d079ed2bcc988f61cd4e0eb40fafc8ab5dc603b159851fa52a9bf245466

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.0-cp310-abi3-manylinux_2_28_aarch64.whl:

Publisher: release.yml on kkollsga/codingest

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

File details

Details for the file codingest-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl.

File metadata

File hashes

Hashes for codingest-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
Algorithm Hash digest
SHA256 fcafe74b957a8455846a0b2f8c243942d7bcaf0b5355946bb413d41c6a2b2bd6
MD5 f21abec44de5fc1ed5aae8102872f562
BLAKE2b-256 0d5117f37a4a7be7bf1708a3d9894af849d3b1b7e1801b5eaa0faed57ab4baa1

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.0-cp310-abi3-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

Publisher: release.yml on kkollsga/codingest

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

File details

Details for the file codingest-0.1.0-cp310-abi3-macosx_11_0_arm64.whl.

File metadata

File hashes

Hashes for codingest-0.1.0-cp310-abi3-macosx_11_0_arm64.whl
Algorithm Hash digest
SHA256 3bdc075aca42da85560503258e13b65b693ee4cab089a936f0fdcd3b574a3bb3
MD5 7a06677c6f75ac9a880a9e1fe6623118
BLAKE2b-256 7f2fa5c712bb371bb32b40365ee50f9251d470ac363d685cb633b3bda577e99b

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.0-cp310-abi3-macosx_11_0_arm64.whl:

Publisher: release.yml on kkollsga/codingest

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

File details

Details for the file codingest-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl.

File metadata

File hashes

Hashes for codingest-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl
Algorithm Hash digest
SHA256 76188e9eb7cb5685eea176204aa81673d0376abce46116023048cbc500d206f5
MD5 8c8efc2bb34b4452c09790aa243b69a8
BLAKE2b-256 2120621a9234cba82ad3405ed15ea273b2c3e992f73e7cc5149a6b8b41c086d0

See more details on using hashes here.

Provenance

The following attestation bundles were made for codingest-0.1.0-cp310-abi3-macosx_10_12_x86_64.whl:

Publisher: release.yml on kkollsga/codingest

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