Development Guide¶
This page explains how to set up a local development environment for rusty-dot so you can edit both the Rust extension and the Python package and run the full test suite.
Prerequisites¶
Install Rust¶
rusty-dot requires a working Rust toolchain (stable channel). Install it with rustup:
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
source $HOME/.cargo/env
rustup update stable
Verify the installation:
Create a conda environment¶
A minimal conda environment file is provided at environment.yml.
It pins Python to 3.13 and installs the key Python dependencies.
Alternatively, use any Python ≥ 3.9 virtual environment:
Fork and clone the repository¶
Fork rusty-dot on GitHub, then clone your fork:
git clone https://github.com/<your-username>/rusty-dot.git
cd rusty-dot
git remote add upstream https://github.com/Adamtaranto/rusty-dot.git
Install in development mode¶
maturin is the build backend for the Rust extension. Install it and then build the package in editable mode:
pip install maturin
# Build Rust extension + install package in editable mode
maturin develop --extras dev,docs
The --extras dev,docs flag installs all optional development and documentation
dependencies declared in pyproject.toml.
Verify the install:
Note
Always re-run maturin develop after modifying any Rust source files
(src/*.rs). Pure Python changes in python/rusty_dot/ take effect
immediately without a rebuild.
Installing pre-commit hooks¶
rusty-dot uses pre-commit to enforce code quality on every commit. Install the hooks once after cloning:
pip install pre-commit # already included in the dev extras
pre-commit install # install commit-stage hooks
pre-commit install --hook-type pre-push # install push-stage hooks
The hooks include:
| Hook | Stage | What it checks |
|---|---|---|
check-ast / check-yaml / check-toml |
commit | File syntax |
trailing-whitespace / end-of-file-fixer |
commit | Whitespace |
cargo fmt --check |
commit | Rust formatting |
cargo check |
commit | Rust compilation |
cargo clippy -- -D warnings |
commit | Rust linting |
ruff format / ruff check |
commit | Python formatting & linting |
pydocstyle (.pyi stubs only) |
commit | Docstring style |
cargo test --lib |
push | Rust unit tests |
pytest tests/ -x -q |
push | Python test suite |
Run all hooks manually at any time:
Running Python tests¶
To run a specific test file or test function:
Python code style — ruff¶
rusty-dot uses ruff for Python linting and
formatting (configured in pyproject.toml).
Check for issues:
Auto-fix fixable issues:
Format code:
Rust code quality¶
Format¶
Check formatting without modifying files (also used by the pre-commit hook):
Lint (Clippy)¶
Compile check¶
Quickly verify the crate compiles without producing a binary:
Rust unit tests¶
Run the Rust-side library tests:
Run all Rust tests (including integration tests, if any):
Building the documentation locally¶
Install the docs dependencies (included in pip install maturin --extras dev,docs):
Open http://127.0.0.1:8000 in your browser. The site rebuilds automatically when you save a documentation file.
To build a static site: