Contributing¶
Contributions are welcome. This document covers the development workflow.
Reporting Bugs¶
Open an issue on GitHub with: - A minimal reproducible example. - The framework and version (e.g., PyTorch 2.10, JAX 0.6). - Expected vs. actual behavior.
Pre-commit Hooks¶
The repo ships a .pre-commit-config.yaml with four categories of hooks:
- File hygiene (
pre-commit-hooks): strips trailing whitespace, ensures a final newline, normalizes line endings, and blocks large files or merge conflict markers. - Config validation (
pre-commit-hooks): checks YAML, JSON, and TOML files for syntax errors before they land in the repo. - Secret scanning (
gitleaks): detects API keys, tokens, and other credentials using regex-based rules. - Lint and format (
ruff-pre-commit): runsruff --fixandruff-formatso every commit already passes CI style checks.
One-time setup after cloning:
uv sync --group dev
uv run pre-commit install
To run all hooks against the full codebase manually:
uv run pre-commit run --all-files
Pull Requests¶
- Fork the repo and create a branch from
dev. - Install dev dependencies and hooks:
uv sync --group dev && uv run pre-commit install - Make your changes.
- Run the test suite:
uv run pytest tests/ - Commit your changes -- pre-commit hooks run automatically and block the commit if any check fails. Fix reported issues, re-stage, and commit again.
- Open a PR against
devwith a clear description of the change.
Code Style¶
- Formatting and linting use ruff (configured in
pyproject.toml). - No em dashes in comments or docstrings. Use
--if needed. - Keep docstrings concise and include input/output shapes.
- New framework implementations should follow the existing module structure under
src/kabsch_horn/<framework>/.
Adding a New Framework¶
- Create
src/kabsch_horn/<framework>/kabsch_svd_nd.pyimplementingkabsch,kabsch_umeyama,kabsch_rmsd, andkabsch_umeyama_rmsd. - Create
src/kabsch_horn/<framework>/horn_quat_3d.pyimplementinghornandhorn_with_scale. - Create
src/kabsch_horn/<framework>/__init__.pyexporting all public functions. - Update
src/kabsch_horn/__init__.pyto re-export with framework suffix. - Add an adapter in
tests/adapters.pyand include it in theframeworkslist. - Verify:
uv run pytest tests/passes for the new framework.
Running Tests¶
# All tests
uv run pytest tests/
# Single file
uv run pytest tests/test_forward_pass_equivalence.py
# Filter by name
uv run pytest tests/ -k "test_identity_mapping"
CI Matrix¶
The test suite runs on two separate runner types:
- Linux (
ubuntu-latest): Covers NumPy, PyTorch, JAX, and TensorFlow across Python 3.10, 3.11, and 3.12. MLX is not installed on Linux (Apple Silicon only). - macOS (
macos-latest, Apple Silicon): Covers all frameworks including MLX, across Python 3.10, 3.11, and 3.12.
If you are contributing MLX changes, verify them locally on Apple Silicon before opening a PR.
Releasing¶
Releases are automated via release-please.
- Merge
devintomainusing conventional commits (feat:,fix:,ci:, etc.). release-pleaseopens or updates a Release PR onmainautomatically, bumpingpyproject.tomland generatingCHANGELOG.mdentries from the commit history.- When you are ready to cut a release, merge the Release PR.
release-pleasecreates the tag and GitHub release automatically.
No manual version bumping or tagging required.