Python

Builds and packaging tools

In the Python Packaging User Guide1:

Hatch

Hatch is maintained by PyPA (Python Packing Authority), same as other standard tools like pip, setuptools, virtualenv, and twine.

Installing

You are probably going to want to install Hatch from PyPI rather than your distros package manager, since Hatch is under active development and new versions are released somewhat freqnely.

$ python3 -m pip install --user pipx
$ pipx install hatch

You may of course also install it directly with pip install, though using pipx is a much better approach in general.

Switching project to hatch

Moving a project from poetry to hatch is easy, but not trivial.

Poetry

Poetry is mainly used for managing an application and its dependencies whereas Hatch is more agnostic to the project type and offers plugin-based functionality for the entire workflow (versioning, tox-like environments, publishing) so you can easily build things other than wheel/sdist, test in a Docker container, etc.2

Versioning

Use poetry-bumpversion with Poetry to make managing the project's version easier. Its a plugin for Poetry itself, and thus not tied to the project (which would have been nice) or it's pyproject.toml file.

$ poetry self add poetry-bumpversion

And in your pyproject.toml, configure as needed:

[tool.poetry_bumpversion.file."${module_name}/__init__.py"]
[tool.poetry_bumpversion.file."tests/test_version.py"]

With this example it will update __version__ in ${module_name}/__init__.py to the version in pyproject.toml, and also keep the version number in tests/test_version.py up to date.

References