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):
$ 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 compliant 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:
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
# ...
Create a new project:
$ hatch new project_name
Create an environment and install declared dependencies:
$ cd project_name/
$ hatch env create
Build the project:
$ hatch build
Publish the project to an index:
$ hatch publish
Run commands inside a managed environment:
$ hatch run python -V
$ hatch run pytest -q
$ hatch shell
Related Resources
Course
Everyday Project Packaging With pyproject.toml
In this Code Conversation video course, you'll learn how to package your everyday projects with pyproject.toml. Playing on the same team as the import system means you can call your project from anywhere, ensure consistent imports, and have one file that'll work for many build systems.
By Leodanis Pozo Ramos • Updated July 24, 2026