This project uses the Hatch project manager (installation instructions).
Hatch automatically manages dependencies and runs testing, type checking, and other operations in isolated environments.
You can run the tests on your local machine with:
hatch test
The test
command supports options such as -c
for measuring test coverage, -a
for testing with a matrix of Python versions, and appending an argument like tests/test_prompt.py::test_single_prompt
for running a single test.
You can run the mypy static type checker with:
hatch run types:check
You can run the Ruff formatter and linter with:
hatch fmt
This will automatically make safe fixes to your code. If you want to only check your files without making modifications, run hatch fmt --check
.
You can install the pre-commit hooks to automatically run type checking, formatting, and linting on every commit.
First, install [pre-commit][pre-commit], for example, with pipx:
pipx install pre-commit
Then, install the hooks:
pre-commit install
You can use hatch build
to create build artifacts, a source distribution ("sdist") and a built distribution ("wheel").
You can use hatch publish
if you want to manually publish build artifacts to PyPI.
Automated releases are handled by the release workflow which is triggered by pushing a new tag to the repository. To create a new release:
- Bump the version in
src/cleanlab_tlm/__about__.py
. You can use thehatch version
command to do this. - Ensure that the release notes are updated in
CHANGELOG.md
:- You should update the
[Unreleased]
header to the new version and add a new[Unreleased]
section at the top of the file. - You should update the link for the
[Unreleased]
code and add a new link to the code diff for the new version.
- You should update the
- Create a PR and merge these changes into the
main
branch. - After the PR is merged into
main
, create a new release tag by runninggit tag v<output of hatch version>
(i.e.git tag v0.0.1
). - Push the tag to the repository by running
git push origin <tag>
. - This will trigger the release workflow which will build the package, create a release on GitHub, and publish the package version to PyPI. The GitHub release notes will be automatically generated from the changelog.
Testing, type checking, and formatting/linting is checked in CI.