Skip to content

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):

Language: Shell
$ pipx install hatch

Check the documentation for other installation options.

Key Features

  • Manages isolated environments and runs commands inside them with hatch run and hatch 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:

Language: TOML
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

# ...

Create a new project:

Language: Shell
$ hatch new project_name

Create an environment and install declared dependencies:

Language: Shell
$ cd project_name/
$ hatch env create

Build the project:

Language: Shell
$ hatch build

Publish the project to an index:

Language: Shell
$ hatch publish

Run commands inside a managed environment:

Language: Shell
$ hatch run python -V
$ hatch run pytest -q
$ hatch shell
Everyday Project Packaging With pyproject.toml

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.

intermediate best-practices tools


By Leodanis Pozo Ramos • Updated July 24, 2026
Morty Proxy This is a proxified and sanitized view of the page, visit original site.