Development Guide#
Prerequisites#
Python: 3.10–3.13
Rust: Stable toolchain with
cargomaturin:
pip install maturinVirtual environment:
python -m venv .venv(recommended)Platforms: Windows, Linux, macOS
Quickstart (Windows PowerShell)#
.venv/Scripts/Activate.ps1
maturin develop -m crates/lacuna-py/Cargo.toml
cargo test -q
pytest -q python/tests
Quickstart (macOS/Linux)#
python -m venv .venv
source .venv/bin/activate
pip install maturin
maturin develop -m crates/lacuna-py/Cargo.toml
cargo test -q
pytest -q python/tests
Development build#
maturin develop -m crates/lacuna-py/Cargo.tomlCompiles Rust crates and installs the Python module into the active venv for iterative dev.
Testing#
Rust tests:
cargo test -qPython tests:
pytest -q python/tests
Formatting and linting#
Rust format:
cargo fmt --allRust lint (Clippy):
cargo clippy -q --all-targets --all-features
Benchmarks#
Run benchmark scripts directly, e.g.:
python python/benchmarks/benchmark_spmv.pypython python/benchmarks/benchmark_spmm.py
Building wheels#
Windows:
./scripts/build_wheels.ps1macOS/Linux:
bash ./scripts/build_wheels.sh
Repository layout (high level)#
crates/Rust crateslacuna-core/core data structures and reference kernelslacuna-kernels/optimized parallel/SIMD kernelslacuna-io/IO utilitieslacuna-py/PyO3 bindings
python/Python packagelacun/and tests/benchmarksdocs/Sphinx docs (MyST Markdown)scripts/helper scripts (wheels, release, datasets)
Contribution workflow#
Create a feature branch.
Develop with
maturin developand an active venv.Run
cargo test -qandpytest -q python/tests.Ensure
cargo fmtandcargo clippypass.Open a PR with a short description of changes and benchmarks if relevant.