Testing, linting, and type checking
We use pytest for testing, ruff for linting and mypy for type checking. Pull requests require all three of these things to pass.
Testing
To run the tests, run the following in the base directory of the piqtree repository:
Linting
To run the linting, run the following in the base directory of the piqtree repository:
Type checking
To run type checking, run the following in the base directory of the piqtree repository:
The C++ extension (piqtree._piqtree) is typed by the stub src/piqtree/_piqtree.pyi, which is generated by
nanobind. If you change the bindings in src/piqtree/_libiqtree/_piqtree.cpp,
regenerate the stub after reinstalling with uv sync:
uv run python -m nanobind.stubgen -q --exclude-values -m piqtree._piqtree -o src/piqtree/_piqtree.pyi
The CI's type checking fails if the committed stub is out of date.
Running checks across Python versions
The CI runs the above checks through nox, which uses uv to create a fresh
environment from uv.lock for each supported Python version. To list the available sessions, run:
A specific session can then be run with, e.g., uv run nox -s test-3.14.