Contributing#

Python#

Installing#

For development, we use the uv package manager. To install the Python package with development dependencies in editable mode

cd quiche
uv sync --group dev

If necessary, the C++ backend and bindings can also be rebuilt during development using

uv sync --reinstall-package=pyquiche

Testing#

To execute the Python test suite use pytest

cd quiche
pytest

Linting and formatting#

Linting and formatting are handled using ruff. For linting execute

ruff check

and for formatting use

ruff format

The enabled rules are configured in pyproject.toml under [tool.ruff].


C++#

Installing#

For development, follow the usual installation steps for the C++ backend.

Testing#

The Catch2 test suite can be enabled using the CMake build flag QUICHE_BUILD_TESTS.

cd quiche
cmake -B build -D QUICHE_BUILD_TESTS=ON
cmake --build build

Tests are registered with CTest via catch_discover_tests, so you can execute them with

ctest --test-dir build --output-on-failure

The Catch2 binary can also be run directly with ./build/cpp/tests/tests.

Linting and formatting#

Formatting is handled using clang-format, with the style defined in .clang-format. To format a file in place use -i

clang-format -i some_file.cpp

To check a file without writing use --dry-run --Werror

clang-format --dry-run --Werror some_file.cpp

.clang-tidy is provided as a general reference for static analysis; it isn’t currently enforced.


Continuous integration#

Every pull request and push to main runs:

  • Python tests: pytest

  • Python lint: ruff check and ruff format --check

  • C++ tests: build with QUICHE_BUILD_TESTS=ON, then ctest

  • C++ lint: clang-format in check mode

  • Documentation build: using sphinx-build

In addition, pushes to main build wheels for the Python package using cibuildwheel, and the sdist with uv build --sdist.


Documentation#

The documentation lives in docs and is built with sphinx using MyST markdown.

Python API pages are autogenerated from their docstrings with autodoc. When adding a new module, insert a corresponding automodule entry under docs/api. A new subpackage also needs its own page listed in the toctree in docs/api/index.rst.

To install the documentation dependencies

cd quiche
uv sync --group docs

Then build the docs into docs/_build/html

cd docs
uv run --group docs make html

The resulting build files can be removed using make clean.


Styleguide#

Commit messages#

Aim to keep your PRs and commits self-contained and commit messages descriptive. Although not strictly enforced we recommend following the Conventional Commits format.

Changelog#

Changes to the API, behaviour, packaging or build requirements should be recorded in the Unreleased section of CHANGELOG.md, following the Keep a Changelog format.

Docstrings#

Python docstrings should follow numpydoc (with the addition of Properties and Resources sections used for Qualtran bloqs).


Releasing#

  1. Open a PR to main that:

    • Renames the Unreleased section of CHANGELOG.md, adds the release date, and adds a new Unreleased above it with empty category headings.

    • Bumps the VERSION file.

  2. Once merged, tag the merge commit with the version from step 1 (prefixed with v) and push it:

    git tag vX.Y.Z
    git push origin vX.Y.Z
    
  3. The publish-wheels.yml and publish-docs.yml workflows will trigger on the tag, then pause for approval.

Note

A published version is permanent. A release can be yanked (hidden from dependency resolution) but never replaced or re-uploaded, so fixes require a new version number.