# How to use uv to speed up Hatch


[Hatch](https://pydevtools.com/handbook/reference/hatch.md) can use [uv](https://pydevtools.com/handbook/reference/uv.md) 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](https://pydevtools.com/handbook/how-to/how-to-install-uv.md).

## Enable uv in your project

Add `installer = "uv"` to your default environment configuration in `pyproject.toml`:

```toml
[tool.hatch.envs.default]
installer = "uv"
```

This applies to the default environment. To enable uv for a specific environment like `test`:

```toml
[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:

```bash
export HATCH_ENV_TYPE_VIRTUAL_UV_PATH="$(which uv)"
```
```powershell
$env:HATCH_ENV_TYPE_VIRTUAL_UV_PATH = (Get-Command uv).Source
```
Add this to your shell profile to make it permanent.

## Verify it's working

Recreate your environment to confirm uv is active:

```bash
hatch env prune
hatch env create
```

Dependency installation should complete noticeably faster than before.

## Learn more

- [uv: A Complete Guide](https://pydevtools.com/handbook/explanation/uv-complete-guide.md) covers what uv does, how fast it is, the core workflows, and recent releases.
- [Hatch reference page](https://pydevtools.com/handbook/reference/hatch.md)
- [uv reference page](https://pydevtools.com/handbook/reference/uv.md)
- [Hatch installer documentation](https://hatch.pypa.io/latest/how-to/environment/select-installer/)
