Contributing Guide¶
Thank you for considering a contribution to Heterodyne. This document describes the workflow, conventions, and quality gates that every change must pass before it can be merged.
Development Setup¶
git clone https://github.com/imewei/heterodyne.git
cd heterodyne
make dev # Runs uv sync and installs in editable mode
This creates a local .venv managed by uv. Never install into global
or user site-packages.
Branch Naming¶
Use a descriptive prefix so that CI jobs and reviewers can triage at a glance:
feature/<short-description>– new functionalityfix/<short-description>– bug fixesdocs/<short-description>– documentation-only changesrefactor/<short-description>– code restructuring with no behavior changetest/<short-description>– test additions or improvements
Commit Conventions¶
Follow the Conventional Commits style:
feat(core): add log-space clipping for half_tr computation
fix(nlsq): correct Jacobian norm storage in sequential strategy
docs(config): add CMC-only template to configuration guide
test(opt): add unit tests for CMA-ES fixes
chore(deps): bump version and update uv.lock
The scope in parentheses should match a top-level package directory
(core, optimization, config, data, cli, viz, etc.).
Code Style¶
The following conventions are enforced across the codebase:
from __future__ import annotationsin every module.strict=Trueon allzip()calls.MappingProxyTypefor immutable registries, typed asMapping[str, T]for MyPy compatibility.raise ... from Nonefor exception translation (e.g.,ValueErrortoKeyError).cast()fromtypingfordict.get()returns ondict[str, Any]configs.JAX functions that return traced values use
# type: ignore[no-any-return]where MyPy cannot infer the concrete type.No wildcard imports (
from module import *is prohibited).
Ruff is the single linting and formatting tool. Run it locally before pushing:
uv run ruff check .
uv run ruff format --check .
Pull Request Checklist¶
Before requesting review, verify every item:
make qualitypasses (Ruff lint + MyPy type-check).make testpasses (unit tests).New or changed behavior has corresponding test coverage.
Documentation is updated if the change affects user-facing behavior or configuration options.
Commit messages follow the conventional commit format.
The branch is rebased on
mainwith no merge conflicts.
Code Review¶
At least one maintainer approval is required.
CI must be green on all matrix entries (Python 3.12, 3.13).
Conversations must be resolved before merge.