Development Guide
Development Guide¶
This guide covers setting up the development environment, building the native Rust core, running tests, linting, and building documentation.
Environment Setup¶
The project uses mise for task orchestration and uv for Python package management.
The numerical filtering core is written in Rust and compiled via Maturin / PyO3.
# Clone the repository
git clone https://github.com/jr2804/g191-filter.git
cd g191-filter
# Set up tools and sync virtual environment
mise dev
Native Extension Build Workflow¶
The Python interface binds to the Rust crate _native compiled via PyO3:
# Compile release binary and place into site-packages
uvx maturin develop --release
Pure-Rust Build¶
The python Cargo feature (PyO3, numpy, and WAV I/O) is enabled by default.
Rust-only consumers can disable it:
cargo build --no-default-features
This builds the rlib without the Python bindings.
Running Tests¶
Integration and unit tests verify filter coefficients, frequency responses, state consistency, and output equivalence against the ITU-T reference suite.
# Run tests with pytest
uv run pytest
# Or via mise task
mise test
Code Quality & Formatting¶
mise lint # Runs ruff, ty type-checker, and codespell
mise format # Runs pyreorder, ruff format, and ruff isort fixes
mise all # Combined test, lint, and format verification
CLI Development¶
Run the Typer CLI in development mode:
# Show command overview
uv run g191-filter --help
# Stream filter a WAV file
uv run g191-filter filter irs8khz input.wav --output-file output.wav
Documentation Workflow¶
Documentation is built with Zensical (MkDocs-compatible theme engine):
# Local preview with live-reload
mise docs-serve # preview at http://localhost:8000
# Strict static build
mise docs-build # outputs to site/
Regenerating Filter Figures¶
Vector response figures embedded in the documentation are dynamically plotted directly from the filter core using the xy package:
uv run python scripts/gen_filter_figures.py
Packaging & PyPI Publication¶
release.yml builds the source distribution and wheels, publishes them to PyPI
with trusted publishing, and creates
the GitHub release. No PyPI API token is stored in the repository.
The PyPI trusted publisher must use these settings:
| Field | Value |
|---|---|
| PyPI project | g191-filter |
| Owner | jr2804 |
| Repository | g191-filter |
| Workflow | release.yml |
| Environment | pypi |
The matching GitHub environment is pypi (Settings → Environments); add required
reviewers there if releases should wait for approval. The publish job requests
id-token: write for OIDC. For the first upload, configure a pending trusted
publisher on PyPI before pushing a release.
To inspect the distributions locally:
uv build
uvx twine check dist/*
The sdist is built from the Cargo package and excludes development-only trees via
[package] exclude in Cargo.toml.
To land a change without cutting a release, include [skip release] in the head
commit message. The release workflow, including the PyPI upload, is skipped; CI
and docs still run. The workflow's own chore(release): stamp ... commits are
also skipped to prevent release loops.
CI/CD Pipeline¶
| Workflow | Trigger | Scope |
|---|---|---|
CI (ci.yml) |
Push / PR to main |
Python matrix (3.13, 3.14, 3.15-dev) + Rust build + lint + test suite |
Docs (docs.yml) |
Push to main |
Renders figures, builds static site, deploys to GitHub Pages |
Release (release.yml) |
Push to main / manual dispatch |
CalVer stamp, wheel + sdist builds, GitHub release, PyPI publication |