Skip to content

Commit 18c18b8

Browse files
Treat invalid platform as more compatible than invalid Python (#7556)
## Summary I think this is just inverted. It means that when we fail in #7553, we show a message for "invalid Python implementation" (since there are some wheels that don't match), but we should be showing "invalid platform", matching the order of operations in our compatibility check. Closes #7553.
1 parent 5206a33 commit 18c18b8

File tree

2 files changed

+43
-1
lines changed

2 files changed

+43
-1
lines changed

crates/distribution-types/src/prioritized_distribution.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -569,7 +569,7 @@ impl IncompatibleWheel {
569569
},
570570
Self::Tag(tag_self) => match other {
571571
Self::ExcludeNewer(_) => false,
572-
Self::Tag(tag_other) => tag_other > tag_self,
572+
Self::Tag(tag_other) => tag_self > tag_other,
573573
Self::NoBinary | Self::RequiresPython(_, _) | Self::Yanked(_) => true,
574574
},
575575
Self::RequiresPython(_, _) => match other {

crates/uv/tests/pip_compile.rs

+42
Original file line numberDiff line numberDiff line change
@@ -12373,3 +12373,45 @@ fn prune_unreachable() -> Result<()> {
1237312373

1237412374
Ok(())
1237512375
}
12376+
12377+
/// See: <https://github.com/astral-sh/uv/issues/7553>
12378+
#[test]
12379+
fn invalid_platform() -> Result<()> {
12380+
let context = TestContext::new("3.10");
12381+
let requirements_in = context.temp_dir.child("requirements.in");
12382+
requirements_in.write_str("open3d")?;
12383+
12384+
uv_snapshot!(context
12385+
.pip_compile()
12386+
.arg("--python-platform")
12387+
.arg("linux")
12388+
.arg("requirements.in"), @r###"
12389+
success: false
12390+
exit_code: 1
12391+
----- stdout -----
12392+
12393+
----- stderr -----
12394+
× No solution found when resolving dependencies:
12395+
╰─▶ Because only the following versions of open3d are available:
12396+
open3d==0.8.0.0
12397+
open3d==0.9.0.0
12398+
open3d==0.10.0.0
12399+
open3d==0.10.0.1
12400+
open3d==0.11.0
12401+
open3d==0.11.1
12402+
open3d==0.11.2
12403+
open3d==0.12.0
12404+
open3d==0.13.0
12405+
open3d==0.14.1
12406+
open3d==0.15.1
12407+
open3d==0.15.2
12408+
open3d==0.16.0
12409+
open3d==0.16.1
12410+
open3d==0.17.0
12411+
open3d==0.18.0
12412+
and open3d<=0.15.2 has no wheels with a matching Python ABI tag, we can conclude that open3d<0.9.0.0 cannot be used.
12413+
And because open3d>=0.16.0 has no wheels with a matching platform tag and you require open3d, we can conclude that your requirements are unsatisfiable.
12414+
"###);
12415+
12416+
Ok(())
12417+
}

0 commit comments

Comments
 (0)