Contributing¶
Developer Guide¶
Setup¶
This project uses hatch to manage the development environment and build and publish releases. Make sure hatch is installed first:
Now you can enter the development environment using:
This will install development dependencies in an isolated environment and drop you into a shell (use exit to leave).
Pre-commit¶
Use pre-commit to run linting, type-checking, and formatting:
...or install it to run automatically before every commit with:
You can run pre-commit hooks separately and pass additional arguments to them. For example, to run ruff-format on a single file:
Testing¶
Unit tests are not run by pre-commit, but can be run manually using hatch scripts:
Measure test coverage with:
Any additional arguments are passed to pytest. For example, to run a subset of tests matching a keyword:
Documentation¶
Documentation is built with mkdocs. During development, you can run a live-reloading server with:
The API reference is generated from Numpy-style docstrings using mkdocstrings. New classes can be added to the API reference by creating a new markdown file in the docs/pages/api directory, adding that file to the nav tree in docs/mkdocs.yml, and including the docstring in the markdown file:
Whenever the docs are updated, they will be automatically rebuilt and deployed by ReadTheDocs. Build status can be monitored here.
Releasing¶
First, use hatch to update the version number in a new release branch and merge into main.
Checkout main and confirm that it is up-to-date with the remote, including the bumped version. Finally, create and push the release tag.
Pushing the updated tag will trigger a workflow that publishes the release to PyPI.