File: README.md
Hatch
Hatch is a modern, extensible Python project manager.
Features
- Standardized build system with reproducible builds by default
- Robust environment management with support for custom scripts and UV
- Configurable Python distribution management
- Test execution with known best practices
- Static analysis with sane defaults
- Built-in Python script runner
- Easy publishing to PyPI or other indices
- Version management
- Best practice project generation
- Responsive CLI, ~2-3x faster than equivalent tools
See the Why Hatch? page for more information.
Documentation
The documentation is made with Material for MkDocs and is hosted by GitHub Pages.
License
Hatch is distributed under the terms of the MIT license.
File: docs/index.md
Hatch
{ role="img" }
Hatch is a modern, extensible Python project manager. See the Why Hatch? page for more information.
:material-hammer-wrench:{ .lg .middle } Build system
Reproducible builds by default with a rich ecosystem of plugins
:material-lock:{ .lg .middle } Environments
Robust environment management with support for custom scripts and UV
:material-language-python:{ .lg .middle } Python management
Choose between easy manual installations or automatic as part of environments
:octicons-shield-check-24:{ .lg .middle } Testing
Test execution with known best practices
:material-magnify-scan:{ .lg .middle } Static analysis
Static analysis backed by Ruff with up-to-date, sane defaults
:material-console-line:{ .lg .middle } Script runner
Execute Python scripts with specific dependencies and Python versions
:material-publish:{ .lg .middle } Publishing
Easily upload to PyPI or other indices
:octicons-number-24:{ .lg .middle } Versioning
Streamlined workflow for bumping versions
:octicons-project-template-24:{ .lg .middle } Project generation
Create new projects from templates with known best practices
:material-speedometer:{ .lg .middle } Responsive CLI
Hatch is up to 3x faster than equivalent tools
License
Hatch is distributed under the terms of the MIT license.
Navigation
Documentation for specific MAJOR.MINOR versions can be chosen by using the dropdown on the top of every page. The dev version reflects changes that have not yet been released.
Also, desktop readers can use special keyboard shortcuts:
| Keys | Action |
|---|---|
| Navigate to the "previous" page | |
| Navigate to the "next" page | |
| Display the search modal |
File: docs/intro.md
Introduction
Setup
Projects can be set up for use by Hatch using the new command.
New project
Let's say you want to create a project named Hatch Demo. You would run:
hatch new "Hatch Demo"This would create the following structure in your current working directory:
hatch-demo
โโโ src
โ โโโ hatch_demo
โ โโโ __about__.py
โ โโโ __init__.py
โโโ tests
โ โโโ __init__.py
โโโ LICENSE.txt
โโโ README.md
โโโ pyproject.toml!!! tip
There are many ways to customize project generation.
Existing project
To initialize an existing project, enter the directory containing the project and run the following:
hatch new --initIf your project has a setup.py file the command will automatically migrate setuptools configuration for you. Otherwise, this will interactively guide you through the setup process.
Project metadata
Next you'll want to define more of your project's metadata located in the pyproject.toml file. You can specify things like its license, the supported versions of Python, and URLs referring to various parts of your project, like documentation.
Dependencies
The last step of the setup process is to define any dependencies that you'd like your project to begin with.
Configuration
All project-specific configuration recognized by Hatch can be defined in either the pyproject.toml file, or a file named hatch.toml where options are not contained within the tool.hatch table:
[tool.hatch]
option = "..."
[tool.hatch.table1]
option = "..."
[tool.hatch.table2]
option = "..."Top level keys in the latter file take precedence when defined in both.
!!! tip
If you want to make your file more compact, you can use dotted keys, turning the above example into:
```toml config-example
[tool.hatch]
option = "..."
table1.option = "..."
table2.option = "..."
```