Skip to main content

Crate brokk_bifrost_python

Crate brokk_bifrost_python 

Source
Expand description

Python language knowledge for Bifrost.

Internal implementation detail of brokk-bifrost; no stability guarantees – depend on brokk-bifrost instead.

This crate sits between brokk_bifrost_core and brokk-bifrost-analysis. It holds Python language knowledge – module identity, the declaration walk, import parsing and binding, the structural spec, test detection, lexical scope bindings, the export/importer usage index, and the usage-graph forward and inverted scans – as plain functions and data. It depends on no other Bifrost crate than core, so nothing here may name IAnalyzer, TreeSitterAnalyzer, or PythonAnalyzer.

Where analysis code would reach for an analyzer handle, the functions here take graph_support::PythonSource (or graph_support::PythonUsageSource once the usage index exists) – a core brokk_bifrost_core::analyzer::CodeUnitIndex plus the memoized per-file products Python resolves through. analyzer/python/ in brokk-bifrost-analysis keeps the shim: the PythonAnalyzer struct and its six moka caches and two OnceLocks, the accessors that implement those two traits, the PythonAdapter forwarding shell, the SPI block, and the downcasts that produce the arguments.

Modules§

adapter
The Python answers behind PythonAdapter.
bindings
clones
Python’s clone-detection token and AST-signature normalization.
declarations
diagnostics
Python’s semantic diagnostics: proof-gated unresolved-name reporting.
graph
Python’s usage-graph scans: the forward per-target scan (extractor/hits) and the whole-workspace inverted per-file walk (inverted), both resolving references through resolver.
graph_support
The language half of Python’s resolution logic: module lookup, the export index, the import binder, base-class resolution and the skeleton renderer, written as free functions over a source trait instead of as methods on PythonAnalyzer.
imports
Python import syntax, binding, and FQN resolution.
queries
Python’s bundled tree-sitter query assets.
structural
Python structural spec: maps tree-sitter-python node types onto the normalized kind vocabulary and extracts role edges from AST fields. See src/analyzer/structural/spec.rs for the contract and .agent/ISSUE_328_SEARCH_AST_EXECPLAN.md for the design.
syntax
test_detection
usage_index
Analyzer-level re-export + importer index for Python, so both usage paths resolve references through analyzer state. Built once from the analyzer’s own module index + export_index_of / import_binder_of and cached on [PythonAnalyzer] (dropped on update/update_all like the other caches).