@@ -58,11 +58,14 @@ that the downloaded `setuptools` distribution matches the specified hash:
5858$ uv build --build-constraint constraints.txt --require-hashes
5959```
6060
61+ To require hashes for every build dependency, including transitive dependencies, use
62+ ` --require-build-hashes ` instead.
63+
6164### Project build dependency hashes
6265
63- Projects can also specify build constraints in
64- [ ` build-constraint-dependencies ` ] ( ../../reference/settings.md#build-constraint-dependencies ) . To
65- verify a downloaded build dependency, provide its ` requirement ` and ` hashes ` in a table :
66+ For example, to verify build dependencies during project resolution and installation, add hashes to
67+ [ ` build-constraint-dependencies ` ] ( ../../reference/settings.md#build-constraint-dependencies ) in your
68+ workspace's ` pyproject.toml ` :
6669
6770``` toml
6871[tool .uv ]
@@ -72,43 +75,24 @@ build-constraint-dependencies = [
7275]
7376```
7477
75- An entry without hashes can be written as a string, as shown with ` wheel<1 ` above. uv checks the
76- supplied hashes when it downloads pinned build dependencies during project resolution or
77- installation, including builds in ` uv run --with ` environments. These hashes apply to build
78- dependencies. Packages installed in the project environment are verified against their own lockfile
79- hashes.
80-
81- To require hashes for ** every** build dependency, use ` --require-build-hashes ` on supported
82- commands, including those that may build packages while updating a lockfile. You can also set
83- ` UV_REQUIRE_BUILD_HASHES=true ` or configure the workspace root:
84-
85- ``` toml
86- [tool .uv ]
87- require-build-hashes = true
88- ```
89-
90- This option is experimental. Enable ` --preview-features build-dependency-hashes ` to suppress the
91- warning.
78+ uv checks supplied hashes when it downloads pinned build dependencies. Constraints without hashes,
79+ such as ` wheel<1 ` , are also allowed. To require a hash for every build dependency, including
80+ transitive dependencies, set
81+ [ ` require-build-hashes = true ` ] ( ../../reference/settings.md#require-build-hashes ) under ` [tool.uv] `
82+ or pass ` --require-build-hashes ` .
9283
93- Command-line flags take precedence over the environment variable, which takes precedence over
94- configuration. ` --no-require-build-hashes ` and ` UV_REQUIRE_BUILD_HASHES=false ` allow build
95- dependencies without hashes; provided hashes are still checked. Workspace members cannot override
96- the root's configuration. For ` uv pip ` commands, use ` [tool.uv.pip] require-build-hashes = false ` to
97- opt out of the top-level setting.
84+ You'll need to pin each build dependency to an exact version (or use a direct URL) and provide a
85+ hash. Hashes can also come from URL fragments in ` build-system.requires ` , but not from requirements
86+ returned by a build backend.
9887
99- With ` --require-build-hashes ` , provide exact versions or direct URLs and hashes for all build
100- dependencies, including their dependencies. Hashes can also come from URL fragments (e.g.,
101- ` #sha256=... ` ) in ` build-system.requires ` . Hashes in requirements or metadata returned by a build
102- backend, such as through ` get_requires_for_build_wheel ` , do not count: those dependencies need
103- hashes from build constraints or ` build-system.requires ` . Requirements whose environment markers do
104- not match the current environment are ignored.
88+ When build isolation is disabled, uv uses the installed build dependencies without checking their
89+ hashes. uv also does not recheck already-installed packages or previously built wheels. The bundled
90+ ` uv_build ` backend does not need a hash because it is part of the uv executable.
10591
106- When uv uses its bundled ` uv_build ` backend, no hash is required for it: the backend is part of the
107- uv executable, not a separately downloaded package.
92+ !!! note
10893
109- When build isolation is disabled with ` --no-build-isolation ` or ` --no-build-isolation-package ` ,
110- build dependencies must already be installed and their hashes are not checked. Already-installed
111- packages and previously built wheels are not checked.
94+ `--require-build-hashes` is experimental. Use `--preview-features build-dependency-hashes` to
95+ suppress the warning.
11296
11397## Preventing publish to PyPI
11498
0 commit comments