Build workspace member sources by default

This commit is contained in:
John Mumm 2025-07-08 15:49:19 +02:00
parent 4cbe52f1c2
commit 85d9b5b62b
No known key found for this signature in database
GPG Key ID: 73D2271AFDC26EA8
5 changed files with 36 additions and 29 deletions

View File

@ -306,7 +306,9 @@ impl LoweredRequirement {
}, },
url, url,
} }
} else if member.pyproject_toml().is_package() { // Workspace member sources should be built by default unless they are explicitly marked
// as `tool.uv.package = false`.
} else if member.pyproject_toml().tool_uv_package().unwrap_or(true) {
RequirementSource::Directory { RequirementSource::Directory {
install_path: install_path.into_boxed_path(), install_path: install_path.into_boxed_path(),
url, url,

View File

@ -12041,7 +12041,7 @@ fn lock_remove_member() -> Result<()> {
[[package]] [[package]]
name = "leaf" name = "leaf"
version = "0.1.0" version = "0.1.0"
source = { virtual = "leaf" } source = { editable = "leaf" }
dependencies = [ dependencies = [
{ name = "anyio" }, { name = "anyio" },
] ]
@ -12058,7 +12058,7 @@ fn lock_remove_member() -> Result<()> {
] ]
[package.metadata] [package.metadata]
requires-dist = [{ name = "leaf", virtual = "leaf" }] requires-dist = [{ name = "leaf", editable = "leaf" }]
[[package]] [[package]]
name = "sniffio" name = "sniffio"

View File

@ -1094,18 +1094,19 @@ fn extra_unconditional() -> Result<()> {
"###); "###);
// This is fine because we are only enabling one // This is fine because we are only enabling one
// extra, and thus, there is no conflict. // extra, and thus, there is no conflict.
uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###" uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Prepared 3 packages in [TIME] Prepared 4 packages in [TIME]
Installed 3 packages in [TIME] Installed 4 packages in [TIME]
+ anyio==4.1.0 + anyio==4.1.0
+ idna==3.6 + idna==3.6
+ proxy1==0.1.0 (from file://[TEMP_DIR]/proxy1)
+ sniffio==1.3.1 + sniffio==1.3.1
"###); ");
// And same thing for the other extra. // And same thing for the other extra.
root_pyproject_toml.write_str( root_pyproject_toml.write_str(
@ -1215,18 +1216,19 @@ fn extra_unconditional_non_conflicting() -> Result<()> {
// `uv sync` wasn't correctly propagating extras in a way // `uv sync` wasn't correctly propagating extras in a way
// that would satisfy the conflict markers that got added // that would satisfy the conflict markers that got added
// to the `proxy1[extra1]` dependency. // to the `proxy1[extra1]` dependency.
uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r###" uv_snapshot!(context.filters(), context.sync().arg("--frozen"), @r"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Prepared 3 packages in [TIME] Prepared 4 packages in [TIME]
Installed 3 packages in [TIME] Installed 4 packages in [TIME]
+ anyio==4.1.0 + anyio==4.1.0
+ idna==3.6 + idna==3.6
+ proxy1==0.1.0 (from file://[TEMP_DIR]/proxy1)
+ sniffio==1.3.1 + sniffio==1.3.1
"###); ");
Ok(()) Ok(())
} }
@ -1301,16 +1303,17 @@ fn extra_unconditional_in_optional() -> Result<()> {
"###); "###);
// This should install `sortedcontainers==2.3.0`. // This should install `sortedcontainers==2.3.0`.
uv_snapshot!(context.filters(), context.sync().arg("--frozen").arg("--extra=x1"), @r###" uv_snapshot!(context.filters(), context.sync().arg("--frozen").arg("--extra=x1"), @r"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Prepared 1 package in [TIME] Prepared 2 packages in [TIME]
Installed 1 package in [TIME] Installed 2 packages in [TIME]
+ proxy1==0.1.0 (from file://[TEMP_DIR]/proxy1)
+ sortedcontainers==2.3.0 + sortedcontainers==2.3.0
"###); ");
// This should install `sortedcontainers==2.4.0`. // This should install `sortedcontainers==2.4.0`.
uv_snapshot!(context.filters(), context.sync().arg("--frozen").arg("--extra=x2"), @r###" uv_snapshot!(context.filters(), context.sync().arg("--frozen").arg("--extra=x2"), @r###"
@ -4460,19 +4463,20 @@ conflicts = [
error: Extra `x2` is not defined in the project's `optional-dependencies` table error: Extra `x2` is not defined in the project's `optional-dependencies` table
"###); "###);
uv_snapshot!(context.filters(), context.sync(), @r###" uv_snapshot!(context.filters(), context.sync(), @r"
success: true success: true
exit_code: 0 exit_code: 0
----- stdout ----- ----- stdout -----
----- stderr ----- ----- stderr -----
Resolved 7 packages in [TIME] Resolved 7 packages in [TIME]
Prepared 3 packages in [TIME] Prepared 4 packages in [TIME]
Installed 3 packages in [TIME] Installed 4 packages in [TIME]
+ anyio==4.3.0 + anyio==4.3.0
+ idna==3.6 + idna==3.6
+ proxy1==0.1.0 (from file://[TEMP_DIR]/proxy1)
+ sniffio==1.3.1 + sniffio==1.3.1
"###); ");
let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap(); let lock = fs_err::read_to_string(context.temp_dir.join("uv.lock")).unwrap();
insta::with_settings!({ insta::with_settings!({
@ -4558,14 +4562,14 @@ conflicts = [
requires-dist = [ requires-dist = [
{ name = "anyio", specifier = ">=4" }, { name = "anyio", specifier = ">=4" },
{ name = "idna", marker = "extra == 'x1'", specifier = "==3.6" }, { name = "idna", marker = "extra == 'x1'", specifier = "==3.6" },
{ name = "proxy1", virtual = "proxy1" }, { name = "proxy1", editable = "proxy1" },
] ]
provides-extras = ["x1"] provides-extras = ["x1"]
[[package]] [[package]]
name = "proxy1" name = "proxy1"
version = "0.1.0" version = "0.1.0"
source = { virtual = "proxy1" } source = { editable = "proxy1" }
[package.optional-dependencies] [package.optional-dependencies]
x2 = [ x2 = [

View File

@ -15772,18 +15772,18 @@ fn project_and_group_workspace_inherit() -> Result<()> {
----- stdout ----- ----- stdout -----
# This file was autogenerated by uv via the following command: # This file was autogenerated by uv via the following command:
# uv pip compile --cache-dir [CACHE_DIR] --group packages/mysubproject/pyproject.toml:foo # uv pip compile --cache-dir [CACHE_DIR] --group packages/mysubproject/pyproject.toml:foo
-e file://[TEMP_DIR]/packages/pytest
# via mysubproject (packages/mysubproject/pyproject.toml:foo)
-e file://[TEMP_DIR]/packages/sniffio
# via
# mysubproject (packages/mysubproject/pyproject.toml:foo)
# anyio
anyio==4.3.0 anyio==4.3.0
# via mysubproject (packages/mysubproject/pyproject.toml:foo) # via mysubproject (packages/mysubproject/pyproject.toml:foo)
idna==3.6 idna==3.6
# via anyio # via anyio
iniconfig==2.0.0 iniconfig==2.0.0
# via mysubproject (packages/mysubproject/pyproject.toml:foo) # via mysubproject (packages/mysubproject/pyproject.toml:foo)
pytest @ file://[TEMP_DIR]/packages/pytest
# via mysubproject (packages/mysubproject/pyproject.toml:foo)
sniffio @ file://[TEMP_DIR]/packages/sniffio
# via
# mysubproject (packages/mysubproject/pyproject.toml:foo)
# anyio
----- stderr ----- ----- stderr -----
Resolved 5 packages in [TIME] Resolved 5 packages in [TIME]

View File

@ -3626,9 +3626,10 @@ fn sync_non_existent_extra_workspace_member() -> Result<()> {
----- stderr ----- ----- stderr -----
Resolved 5 packages in [TIME] Resolved 5 packages in [TIME]
Prepared 3 packages in [TIME] Prepared 4 packages in [TIME]
Installed 3 packages in [TIME] Installed 4 packages in [TIME]
+ anyio==4.3.0 + anyio==4.3.0
+ child==0.1.0 (from file://[TEMP_DIR]/child)
+ idna==3.6 + idna==3.6
+ sniffio==1.3.1 + sniffio==1.3.1
"); ");