Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 7 additions & 4 deletions crates/uv-build-frontend/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -611,11 +611,12 @@ impl SourceBuild {
.as_ref()
.and_then(|build_system| build_system.build_backend.as_deref());

if let Some(backend_path) = pyproject_toml
let backend_path = pyproject_toml
.build_system
.as_ref()
.and_then(|build_system| build_system.backend_path.as_ref())
{
.and_then(|build_system| build_system.backend_path.as_ref());

if let Some(backend_path) = backend_path {
let source_tree = fs_err::canonicalize(source_tree).map_err(Error::Io)?;
for path in backend_path.iter() {
if Path::new(path).is_absolute() {
Expand All @@ -639,8 +640,10 @@ impl SourceBuild {
}

// Only show the warning for first party and URL dependencies, not for registry dependencies
// (which have sources disabled).
// (which have sources disabled). In-tree build backends may wrap `uv_build`, so we don't
// warn for them either.
if !no_sources.all()
&& backend_path.is_none()
&& pyproject_toml
.tool
.as_ref()
Expand Down
45 changes: 45 additions & 0 deletions crates/uv/tests/build/build_backend.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1764,6 +1764,51 @@ fn tool_uv_build_backend_wrong_build_backend() -> Result<()> {
Ok(())
}

/// Don't warn about uv build backend setting when an in-tree build backend, it might be wrapping
/// `uv_build`.
///
/// See <https://github.com/astral-sh/uv/issues/20128>.
#[test]
#[cfg(feature = "test-pypi")]
fn tool_uv_build_backend_in_tree_backend() -> Result<()> {
// We need to use a real `uv_build` package.
let context = uv_test::test_context!("3.12").with_exclude_newer("2025-05-27T00:00:00Z");

let project = context.temp_dir.child("project");
let pyproject_toml = project.child("pyproject.toml");
pyproject_toml.write_str(indoc! {r#"
[project]
name = "project"
version = "0.1.0"

[tool.uv.build-backend]
source-include = ["backend/**"]

[build-system]
requires = ["uv_build>=0.7,<10000"]
build-backend = "backend"
backend-path = ["."]
"#})?;
project.child("src/project/__init__.py").touch()?;
project
.child("backend/__init__.py")
.write_str("from uv_build import *\n")?;

uv_snapshot!(context.filters(), context.build().arg("--no-build-logs").arg(project.path()), @"
success: true
exit_code: 0
----- stdout -----

----- stderr -----
Building source distribution...
Building wheel from source distribution...
Successfully built project/dist/project-0.1.0.tar.gz
Successfully built project/dist/project-0.1.0-py3-none-any.whl
");

Ok(())
}

/// Show a warning when the project uses deprecated `License ::` classifiers.
#[test]
fn warn_on_license_classifier() -> Result<()> {
Expand Down
Loading