You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
uv/tests: adds a test with mutually exclusive extras across a workspace
This tests comes from here:
#8976 (comment)
And it was originally thought of by Konsti.
This test case is the motivation for making `package` optional in
`conflicts` instead of forbidding it entirely.
╰─▶ Because dummy[project2] depends on proxy1[project2] and only proxy1[project2]==0.1.0 is available, we can conclude that dummy[project2] depends on proxy1[project2]==0.1.0. (1)
3482
+
3483
+
Because proxy1[project1]==0.1.0 depends on anyio==4.1.0 and proxy1[project2]==0.1.0 depends on anyio==4.2.0, we can conclude that proxy1[project1]==0.1.0 and proxy1[project2]==0.1.0 are incompatible.
3484
+
And because we know from (1) that dummy[project2] depends on proxy1[project2]==0.1.0, we can conclude that dummy[project2] and proxy1[project1]==0.1.0 are incompatible.
3485
+
And because only proxy1[project1]==0.1.0 is available and dummysub[project1] depends on proxy1[project1], we can conclude that dummysub[project1] and dummy[project2] are incompatible.
3486
+
And because your workspace requires dummy[project2] and dummysub[project1], we can conclude that your workspace's requirements are unsatisfiable.
3487
+
"###);
3488
+
3489
+
// Now let's write out the full set of conflicts, taking
3490
+
// advantage of the optional `package` key.
3491
+
root_pyproject_toml.write_str(
3492
+
r#"
3493
+
[project]
3494
+
name = "dummy"
3495
+
version = "0.1.0"
3496
+
requires-python = "==3.12.*"
3497
+
3498
+
[project.optional-dependencies]
3499
+
project1 = [
3500
+
"proxy1[project1]",
3501
+
]
3502
+
project2 = [
3503
+
"proxy1[project2]"
3504
+
]
3505
+
3506
+
[tool.uv.sources]
3507
+
proxy1 = { path = "./proxy1" }
3508
+
dummysub = { workspace = true }
3509
+
3510
+
[tool.uv.workspace]
3511
+
members = ["dummysub"]
3512
+
3513
+
[build-system]
3514
+
requires = ["hatchling"]
3515
+
build-backend = "hatchling.build"
3516
+
3517
+
[tool.uv]
3518
+
conflicts = [
3519
+
[
3520
+
{ extra = "project1" },
3521
+
{ extra = "project2" },
3522
+
],
3523
+
[
3524
+
{ package = "dummysub", extra = "project1" },
3525
+
{ package = "dummysub", extra = "project2" },
3526
+
],
3527
+
[
3528
+
{ extra = "project1" },
3529
+
{ package = "dummysub", extra = "project2" },
3530
+
],
3531
+
[
3532
+
{ package = "dummysub", extra = "project1" },
3533
+
{ extra = "project2" },
3534
+
],
3535
+
]
3536
+
"#,
3537
+
)?;
3538
+
// And we can remove the conflicts from `dummysub` since
0 commit comments