Skip to content

Build environment configuration


You can fully alter the behavior of the environment used by the build command.

Dependencies

Build environments will always have what is required by the build system, targets, and hooks.

You can define dependencies that your builds may require in the environment as well:

[tool.hatch.envs.hatch-build]
dependencies = [
  "cython",
]
[envs.hatch-build]
dependencies = [
  "cython",
]

caution

It's recommended to only use the standard mechanisms to define build dependencies for better compatibility with other tools.

Environment variables

You can define environment variables that will be set during builds:

[tool.hatch.envs.hatch-build.env-vars]
SOURCE_DATE_EPOCH = "1580601600"
[envs.hatch-build.env-vars]
SOURCE_DATE_EPOCH = "1580601600"

Installer

By default, UV is enabled. You may disable that behavior as follows:

[tool.hatch.envs.hatch-build]
installer = "pip"
[envs.hatch-build]
installer = "pip"