A minimal build backend for uv: uv_build (#11446)

uv itself is a large package with many dependencies and lots of
features. To build a package using the uv build backend, you shouldn't
have to download and install the entirety of uv. For platform where we
don't provide wheels, it should be possible and fast to compile the uv
build backend. To that end, we're introducing a python package that
contains a trimmed down version of uv that only contains the build
backend, with a minimal dependency tree in rust.

The `uv_build` package is publish from CI just like uv itself. It is
part of the workspace, but has much less dependencies for its own
binary. We're using cargo deny to enforce that the network stack is not
part of the dependencies. A new build profile ensure we're getting the
minimum possible binary size for a rust binary.

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
This commit is contained in:
konsti 2025-03-06 20:27:20 +01:00 committed by GitHub
parent d4a805544f
commit bf4c7afe8b
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
26 changed files with 842 additions and 96 deletions

View file

@ -1,4 +1,5 @@
mod metadata;
mod serde_verbatim;
mod source_dist;
mod wheel;
@ -394,8 +395,8 @@ mod tests {
license = { file = "license.txt" }
[build-system]
requires = ["uv>=0.5.15,<0.6"]
build-backend = "uv"
requires = ["uv_build>=0.5.15,<0.6"]
build-backend = "uv_build"
"#
},
)
@ -462,8 +463,8 @@ mod tests {
version = "1.0.0"
[build-system]
requires = ["uv>=0.5.15,<0.6"]
build-backend = "uv"
requires = ["uv_build>=0.5.15,<0.6"]
build-backend = "uv_build"
"#
},
)