LinuxCommandLibrary

hatch

modern Python project manager

TLDR

Create new project

$ hatch new [project-name]
copy
Build package
$ hatch build
copy
Run tests
$ hatch run test
copy
Enter environment
$ hatch shell
copy
Publish to PyPI
$ hatch publish
copy
Show project info
$ hatch status
copy

SYNOPSIS

hatch [options] command [args]

DESCRIPTION

Hatch is a modern Python project manager. It handles project creation, building, publishing, environment management, and testing in a unified tool.
Hatch uses pyproject.toml for configuration and supports PEP standards. It provides reproducible environments and multi-environment testing.

PARAMETERS

new name

Create new project.
build
Build distributions.
publish
Publish to package index.
run cmd
Run command in environment.
shell
Enter project environment.
env subcommand
Manage environments.
test
Run tests across environments.
fmt
Format code.
version
Show/bump version.
clean
Remove build artifacts.

PYPROJECT.TOML

$ [build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "myproject"
version = "0.1.0"

[tool.hatch.envs.default]
dependencies = ["pytest"]

[tool.hatch.envs.default.scripts]
test = "pytest {args}"
copy

CAVEATS

Relatively new; ecosystem still growing. Different workflow from pip/setuptools. Environment management differs from virtualenv. Some plugins may be needed.

HISTORY

Hatch was created by Ofek Lev as a modern replacement for traditional Python packaging tools. It follows current PEP standards and aims to simplify the Python project lifecycle.

SEE ALSO

pip(1), poetry(1), flit(1), pdm(1)

> TERMINAL_GEAR

Curated for the Linux community

Copied to clipboard

> TERMINAL_GEAR

Curated for the Linux community