Hatch
Hatch is a project manager for Python that centralizes environment management, packaging with Hatchling, versioning, and publishing behind a single command-line interface.
Installation and Setup
Install it from the Python Package Index (PyPI):
Shell
$ pipx install hatch
Check the documentation for other installation options.
Key Features
- Manages isolated environments and runs commands inside them with
hatch runandhatch shell. - Builds wheels and sdists via Hatchling, a PEP 517 compilant backend that reads PEP 621 metadata from
[project]. - Supports environment matrices and per-environment dependencies for testing across multiple Python versions.
- Provides version management via
hatch version, including segment bumps like minor, and supports configurable version sources. - Publishes built artifacts to package indexes using
hatch publish.
Usage
A minimal pyproject.toml that builds with Hatchling looks like this:
TOML
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# ...
Create a new project:
Shell
$ hatch new project_name
Create an environment and install declared dependencies:
Shell
$ cd project_name/
$ hatch env create
Build the project:
Shell
$ hatch build
Publish the project to an index:
Shell
$ hatch publish
Run commands inside a managed environment:
Shell
$ hatch run python -V
$ hatch run pytest -q
$ hatch shell
By Leodanis Pozo Ramos • Updated Dec. 17, 2025