Hatch Project Management
Hatch is a modern, extensible Python project manager that centralizes environment management, packaging with Hatchling, versioning, and publishing behind a single command-line interface. It is known for its ability to seamlessly manage multiple environments, handle dependencies, and dynamically download required Python distributions. Currently at version 1.16.5, Hatch maintains an active development and release cadence.
Warnings
- breaking Hatch v1.16.0 dropped official support for Python 3.9. Projects requiring Python 3.9 or older must use an earlier version of Hatch.
- breaking Hatch v1.15.0 dropped official support for Python 3.8. Projects requiring Python 3.8 or older must use an earlier version of Hatch.
- breaking In Hatch v1.16.0, several environment type plugin methods were removed (`build_environment`, `build_environment_exists`, `run_builder`, `construct_build_command`). Custom environment plugins might need updates.
- gotcha Hatch v1.16.5 fixed a breaking change in `virtualenv` by explicitly supporting only the latest version and adding `python-discovery` as a dependency. Older Hatch versions might encounter issues with newer `virtualenv`.
- gotcha Prior to v1.16.3, there were known issues with self-referential dependencies not being recognized and incomplete environments being created when exceptions occurred during environment setup.
Install
-
pip install hatch -
pipx install hatch
Quickstart
# Create a new Python project
hatch new "My Awesome Project"
# Navigate into the project directory
cd "my-awesome-project"
# Run a script (e.g., 'python -m my_awesome_project')
# This assumes a default `run` script is defined in pyproject.toml
hatch run python -c "print('Hello from Hatch!')"
# Or enter a shell environment
# hatch shell