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
Add required environment marker example to hint (#16244)
## Summary
fixes issue #15938
- show platform wheel hint with a concrete
`tool.uv.required-environments` example so users know how to configure
compatibility
- add `WheelTagHint::suggest_environment_marker` to pick a sensible
environment marker based on the available wheel tags
- update the `sync_required_environment_hint` integration snapshot to
expect the new multi-line hint
## Test Plan
cargo test --package uv --test it --
sync::sync_required_environment_hint
let platform_machine = markers.platform_machine();
5395
+
5396
+
// Generate the marker string based on actual environment values
5397
+
if platform_machine.is_empty(){
5398
+
format!("sys_platform == '{sys_platform}'")
5399
+
}else{
5400
+
format!("sys_platform == '{sys_platform}' and platform_machine == '{platform_machine}'")
5401
+
}
5402
+
}
5376
5403
}
5377
5404
5378
5405
impl std::fmt::DisplayforWheelTagHint{
@@ -5517,9 +5544,11 @@ impl std::fmt::Display for WheelTagHint {
5517
5544
version,
5518
5545
tags,
5519
5546
best,
5547
+
markers,
5520
5548
} => {
5521
5549
let s = if tags.len() == 1{""}else{"s"};
5522
5550
ifletSome(best) = best {
5551
+
let example_marker = Self::suggest_environment_marker(markers);
5523
5552
let best = ifletSome(pretty) = best.pretty(){
5524
5553
format!("{} (`{}`)", pretty.cyan(), best.cyan())
5525
5554
}else{
@@ -5530,16 +5559,17 @@ impl std::fmt::Display for WheelTagHint {
5530
5559
}else{
5531
5560
format!("`{}`", package.cyan())
5532
5561
};
5533
-
writeln!(
5562
+
write!(
5534
5563
f,
5535
-
"{}{} You're on {}, but {} only has wheels for the following platform{s}: {}; consider adding your platform to `{}` to ensure uv resolves to a version with compatible wheels",
5564
+
"{}{} You're on {}, but {} only has wheels for the following platform{s}: {}; consider adding {} to `{}` to ensure uv resolves to a version with compatible wheels",
error: Distribution `no-sdist-no-wheels-with-matching-platform-a==1.0.0 @ registry+https://astral-sh.github.io/packse/PACKSE_VERSION/simple-html/` can't be installed because it doesn't have a source distribution or wheel for the current platform
12089
12093
12090
-
hint: You're on [PLATFORM] (`[TAG]`), but `no-sdist-no-wheels-with-matching-platform-a` (v1.0.0) only has wheels for the following platform: `macosx_10_0_ppc64`; consider adding your platform to `tool.uv.required-environments` to ensure uv resolves to a version with compatible wheels
12091
-
");
12094
+
hint: You're on [PLATFORM] (`[TAG]`), but `no-sdist-no-wheels-with-matching-platform-a` (v1.0.0) only has wheels for the following platform: `macosx_10_0_ppc64`; consider adding "sys_platform == '[PLATFORM]' and platform_machine == '[MACHINE]'" to `tool.uv.required-environments` to ensure uv resolves to a version with compatible wheels
0 commit comments