This provides a plugin for Hatch that creates environments using UV's locked virtual environment capabilities for fast, reproducible Python dependency management.
Table of Contents
-
pyproject.toml
[tool.hatch.env] require = ["hatch-uvenv"]
-
hatch.toml
[env] require = ["hatch-uvenv"]
The environment plugin name is uvenv
.
-
pyproject.toml
[tool.hatch.envs.<env_name>] type = "uvenv"
-
hatch.toml
[envs.<env_name>] type = "uvenv"
UV's locked environments ensure that dependencies are installed in a fast and deterministic manner. The environment will resolve dependencies based on a lockfile, ensuring reproducibility.
Example config:
[envs.<ENV_NAME>]
uv-flags = [
"--all-packages",
]
groups = [
"dependency-group-1",
"dependency-group-2",
]
features = [
"feature-1",
"feature-2",
]