Skip to content

Latest commit

 

History

History
93 lines (66 loc) · 2.39 KB

CONTRIBUTING.md

File metadata and controls

93 lines (66 loc) · 2.39 KB

Contributing to ITKPythonPackage

Getting Started

Clone the repository and install the pre-commit hooks:

git clone https://github.com/InsightSoftwareConsortium/ITKPythonPackage.git
cd ITKPythonPackage

Install Pixi for managing the build environment:

curl -fsSL https://pixi.sh/install.sh | bash
pixi install

Install pre-commit hooks

pixi run pre-commit-install
# optionally run pre-commit hooks
pixi run pre-commit-run

Development Workflow

Code Style

Pre-commit hooks enforce all formatting and linting automatically on commit:

  • Python: Ruff (formatting, linting, and import sorting)
  • Shell: ShellCheck (linting), shfmt (formatting)
  • TOML: Taplo (formatting)

Run against all files manually:

pre-commit run --all-files

Commit Messages

This project uses the ITK commit message convention, PREFIX: Description, enforced by Commitizen:

ENH: Add support for Python 3.12 wheels
BUG: Correct cmake args not propagating to module builds
COMP: Update pre-commit hook versions
DOC: Clarify aarch64 build requirements

Valid prefixes are BUG:, COMP:, DOC:, ENH:, PERF: and STYLE:, and the description starts with a capital letter. Commitizen will reject commits that don't follow this format.

Building Docs

pip install -r docs/requirements-docs.txt
sphinx-build -W -b html docs docs/_build/html

Running Checks with Nox

Nox runs the same checks without a pixi environment. With uv installed:

uvx nox -l               # list sessions
uvx nox                  # lint and tests (Python 3.11 to 3.14)
uvx nox -s tests-3.11    # one Python version
uvx nox -s docs          # build the docs as CI does
uvx nox -s docs -- --serve

Arguments after -- go to the underlying tool, for example uvx nox -s tests-3.12 -- -k configure. Wheel builds are not nox sessions; use pixi run -e <platform-env> build-itk-wheels, naming the environment as AGENTS.md describes.

Submitting a Pull Request

  1. Create a branch from main
  2. Make your changes and ensure pre-commit run --all-files passes
  3. Open a PR, fill out the template, including which platforms you tested on
  4. CI will run pre-commit checks automatically

Questions

For build questions or general ITK support, use the ITK Discourse forum.