code2llm-rust

AI Cost Tracking

PyPI Version Python License AI Cost Human Time Model

Generated on 2026-10-04 using openrouter/qwen/qwen3-coder-next


High-performance native Rust acceleration extension for code2llm.

Overview

code2llm-rust is a Python C-extension built with PyO3 and Rayon, providing ultra-fast native implementations of core computational bottlenecks in code2llm:

Installation

pip install code2llm-rust

Or build from source:

cd packages/code2llm-rust
maturin develop --release

Python API

import code2llm_rust

# Extract function body
body = code2llm_rust.extract_function_body(source_code, start_line=10)

# Calculate complexity
cc, rank = code2llm_rust.calculate_complexity(body, lang="c_family")

# Batch compute across lines in parallel
results = code2llm_rust.batch_complexity(source_code, [10, 25, 40], lang="c_family")

# Extract calls
calls = code2llm_rust.extract_calls(body)

# Betweenness centrality (Brandes' algorithm)
centrality = code2llm_rust.betweenness_centrality(nodes, edges, k=100, normalized=True)

License

Licensed under Apache-2.0.