Skip to content

Commit 71b5ba1

Browse files
authored
Stabilize the uv build backend (#14311)
The uv build backend has gone through some feedback cycles, we expect no more major configuration changes, and we're ready to take the next step: The uv build backend in stable. This PR stabilizes: * Using `uv_build` as build backend * The documentation of the uv build backend * The direct build fast path, where uv doesn't use PEP 517 if you're using `uv_build` in a compatible version. * `uv build --list`, which is limited to `uv_build`. It does not: * Make `uv_build` the default on `uv init` * Make `--package` the default on `uv init`
1 parent 5f2857a commit 71b5ba1

File tree

7 files changed

+9
-45
lines changed

7 files changed

+9
-45
lines changed

crates/uv-build-backend/src/settings.rs

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,6 @@ use uv_macros::OptionsMetadata;
44

55
/// Settings for the uv build backend (`uv_build`).
66
///
7-
/// !!! note
8-
///
9-
/// The uv build backend is currently in preview and may change in any future release.
10-
///
117
/// Note that those settings only apply when using the `uv_build` backend, other build backends
128
/// (such as hatchling) have their own configuration.
139
///

crates/uv-dispatch/src/lib.rs

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -453,12 +453,6 @@ impl BuildContext for BuildDispatch<'_> {
453453
build_kind: BuildKind,
454454
version_id: Option<&'data str>,
455455
) -> Result<Option<DistFilename>, BuildDispatchError> {
456-
// Direct builds are a preview feature with the uv build backend.
457-
if self.preview.is_disabled() {
458-
trace!("Preview is disabled, not checking for direct build");
459-
return Ok(None);
460-
}
461-
462456
let source_tree = if let Some(subdir) = subdirectory {
463457
source.join(subdir)
464458
} else {

crates/uv/src/commands/build_frontend.rs

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -187,15 +187,6 @@ async fn build_impl(
187187
printer: Printer,
188188
preview: PreviewMode,
189189
) -> Result<BuildResult> {
190-
if list && preview.is_disabled() {
191-
// We need the direct build for list and that is preview only.
192-
writeln!(
193-
printer.stderr(),
194-
"The `--list` option is only available in preview mode; add the `--preview` flag to use `--list`"
195-
)?;
196-
return Ok(BuildResult::Failure);
197-
}
198-
199190
// Extract the resolver settings.
200191
let ResolverSettings {
201192
index_locations,
@@ -605,10 +596,7 @@ async fn build_package(
605596
}
606597

607598
BuildAction::List
608-
} else if preview.is_enabled()
609-
&& !force_pep517
610-
&& check_direct_build(source.path(), source.path().user_display())
611-
{
599+
} else if !force_pep517 && check_direct_build(source.path(), source.path().user_display()) {
612600
BuildAction::DirectBuild
613601
} else {
614602
BuildAction::Pep517

crates/uv/tests/it/build_backend.rs

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,6 @@ fn preserve_executable_bit() -> Result<()> {
224224
.init()
225225
.arg("--build-backend")
226226
.arg("uv")
227-
.arg("--preview")
228227
.arg(&project_dir)
229228
.assert()
230229
.success();
@@ -316,8 +315,7 @@ fn rename_module() -> Result<()> {
316315
uv_snapshot!(context
317316
.build_backend()
318317
.arg("build-wheel")
319-
.arg(temp_dir.path())
320-
.env("UV_PREVIEW", "1"), @r###"
318+
.arg(temp_dir.path()), @r###"
321319
success: true
322320
exit_code: 0
323321
----- stdout -----
@@ -391,8 +389,7 @@ fn rename_module_editable_build() -> Result<()> {
391389
uv_snapshot!(context
392390
.build_backend()
393391
.arg("build-editable")
394-
.arg(temp_dir.path())
395-
.env("UV_PREVIEW", "1"), @r###"
392+
.arg(temp_dir.path()), @r###"
396393
success: true
397394
exit_code: 0
398395
----- stdout -----
@@ -568,8 +565,7 @@ fn build_sdist_with_long_path() -> Result<()> {
568565
uv_snapshot!(context
569566
.build_backend()
570567
.arg("build-sdist")
571-
.arg(temp_dir.path())
572-
.env("UV_PREVIEW", "1"), @r###"
568+
.arg(temp_dir.path()), @r###"
573569
success: true
574570
exit_code: 0
575571
----- stdout -----
@@ -602,8 +598,7 @@ fn sdist_error_without_module() -> Result<()> {
602598
uv_snapshot!(context
603599
.build_backend()
604600
.arg("build-sdist")
605-
.arg(temp_dir.path())
606-
.env("UV_PREVIEW", "1"), @r"
601+
.arg(temp_dir.path()), @r"
607602
success: false
608603
exit_code: 2
609604
----- stdout -----
@@ -617,8 +612,7 @@ fn sdist_error_without_module() -> Result<()> {
617612
uv_snapshot!(context
618613
.build_backend()
619614
.arg("build-sdist")
620-
.arg(temp_dir.path())
621-
.env("UV_PREVIEW", "1"), @r"
615+
.arg(temp_dir.path()), @r"
622616
success: false
623617
exit_code: 2
624618
----- stdout -----
@@ -682,7 +676,6 @@ fn complex_namespace_packages() -> Result<()> {
682676

683677
context
684678
.build()
685-
.arg("--preview")
686679
.arg(project.path())
687680
.arg("--out-dir")
688681
.arg(dist.path())
@@ -731,7 +724,6 @@ fn complex_namespace_packages() -> Result<()> {
731724
context.filters(),
732725
context
733726
.pip_install()
734-
.arg("--preview")
735727
.arg("-e")
736728
.arg("complex-project-part_a")
737729
.arg("-e")
@@ -778,7 +770,6 @@ fn symlinked_file() -> Result<()> {
778770
let project = context.temp_dir.child("project");
779771
context
780772
.init()
781-
.arg("--preview")
782773
.arg("--build-backend")
783774
.arg("uv")
784775
.arg(project.path())

docs/concepts/build-backend.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,8 @@
22

33
!!! note
44

5-
The uv build backend is currently in preview and may change without warning.
6-
7-
When preview mode is not enabled, uv uses [hatchling](https://pypi.org/project/hatchling/) as the default build backend.
5+
Currently, the default build backend for `uv init` is
6+
[hatchling](https://pypi.org/project/hatchling/). This will change to `uv` in a future version.
87

98
A build backend transforms a source tree (i.e., a directory) into a source distribution or a wheel.
109

docs/reference/settings.md

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -396,10 +396,6 @@ pydantic = { path = "/path/to/pydantic", editable = true }
396396

397397
Settings for the uv build backend (`uv_build`).
398398

399-
!!! note
400-
401-
The uv build backend is currently in preview and may change in any future release.
402-
403399
Note that those settings only apply when using the `uv_build` backend, other build backends
404400
(such as hatchling) have their own configuration.
405401

uv.schema.json

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)