Fine-mapping · Python + RustLucaJiang/prusie
On this page

Contributing

This guide covers setting up a development environment, running the test suite, building documentation, packaging wheels, and evaluating performance changes for prusie. Before modifying the numerical core, review the Statistical model and Numerical accuracy specifications.

Development environment

prusie supports CPython 3.10 and newer (standard GIL builds); the pinned development dependencies in requirements-dev.lock target CPython 3.12 on Linux. Ensure that you have the Rust toolchain specified in rust-toolchain.toml, a C compiler, and ar installed. From the repository root:

python3.12 -m venv .venv
. .venv/bin/activate
python -m pip install -r requirements-dev.lock
python -m pip install '.[test,analysis]'

After editing Python or Rust source files, rebuild the local installation with python -m pip install '.[test,analysis]' or maturin develop --release --locked.

Lint and tests

Run the formatting, linting, and unit test suite from the repository root:

ruff check
ruff format --check
cargo fmt --all --check
cargo clippy --locked --workspace --all-targets -- -D warnings
python -m pytest tests
python -m pytest tools/benchmark/_internal
cargo test --locked -- --test-threads=1

The test suite validates prusie against frozen susieR 0.16.6 outputs, an independent NumPy reference solver, and analytical test cases, while also covering input validation, plotting, and HTML report generation. Keep frozen test fixtures unchanged and add regression tests for any bug fixes or numerical edge cases.

Continuous integration builds and tests prusie across Linux, macOS, and Windows, including a Linux portable-math build. To run a live validation against R in CI, trigger the tests-and-packages workflow manually with r_reference=true, which installs the pinned susieR 0.16.6 commit and compares complete alpha matrices across individual-level, sufficient-statistic, and RSS fits.

To run the live R verification locally, install R, jsonlite, and the pinned susieR commit via remotes::install_github, then execute:

Rscript --vanilla tools/check_r_reference.R

Editing and building documentation

Documentation sources are written in Markdown under docs/, and the rendered static HTML files are committed alongside them. With Node.js installed (CI uses v24.18.0), build and preview the documentation site from the repository root:

python -m pip install -r tools/docs-requirements.txt
python tools/build_docs.py
python -m http.server 8000 --bind 127.0.0.1 --directory docs

Open http://127.0.0.1:8000/ in a browser to inspect your changes. tools/build_docs.py pre-renders math expressions using vendored KaTeX, verifies asset hashes, and checks all internal file and section links.

Marked numerical blocks in the documentation are maintained by generator scripts: tools/model_examples.py updates worked numerical examples, and tools/generate_results.py synchronizes benchmark tables with the archived summary JSON files (see Reproducibility).

Building packages

To build a release wheel and source distribution (sdist) and verify that the sdist compiles cleanly into a wheel:

maturin build --release --locked --out dist -i python3.10
maturin sdist --out dist
python -m pip wheel --no-deps dist/*.tar.gz -w sdist-wheel

With PyO3 0.30 and maturin 1.15, extension-module linking is configured automatically. The abi3-py310 target produces a single stable-ABI wheel per platform that works across CPython 3.10–3.15 (GIL builds). Verify the built wheel in a clean virtual environment by running python examples/quickstart.py.

Pushing a version tag vX.Y.Z triggers .github/workflows/release.yml, which builds manylinux_2_28 (x86-64 and ARM64), macOS (Intel and Apple silicon), and Windows (x86-64) wheels plus the sdist, runs the test suite on the oldest and newest supported Python versions, and attaches the artifacts and SHA256SUMS.txt to the corresponding GitHub Release.

Benchmark scripts

tools/benchmark/reproduce.py runs local validation and timing comparisons against susieR (see tools/benchmark/README.md). Full manuscript benchmark pipelines and measurement archives reside in prusie-analysis, while package documentation tables are checked via python tools/generate_results.py --check.

When evaluating a candidate runtime or memory optimization against its parent commit, keep the benchmark panel, fitting options, and hardware fixed, and verify that all numerical accuracy criteria continue to pass. Evaluate performance across both GWAS and eQTL workloads—including large regions and multi-sweep fits—to confirm consistent gains without regressions across variant-count or iteration-count strata.