How to use uv to speed up Hatch
Hatch can use uv as its installer backend instead of pip and virtualenv. This makes environment creation and dependency installation significantly faster without changing the rest of your Hatch workflow.
Note
This guide assumes you already have a Hatch project and uv installed.
Enable uv in your project
Add installer = "uv" to your default environment configuration in pyproject.toml:
[tool.hatch.envs.default]
installer = "uv"This applies to the default environment. To enable uv for a specific environment like test:
[tool.hatch.envs.test]
installer = "uv"Enable uv globally with an environment variable
To use uv across all Hatch projects without editing each pyproject.toml, set the HATCH_ENV_TYPE_VIRTUAL_UV_PATH environment variable to the absolute path of your uv binary:
export HATCH_ENV_TYPE_VIRTUAL_UV_PATH="$(which uv)"Add this to your shell profile to make it permanent.
Verify it’s working
Recreate your environment to confirm uv is active:
hatch env prune
hatch env createDependency installation should complete noticeably faster than before.
Learn more
Get Python tooling updates
Subscribe to the newsletter