Skip to content

Commit 6ac5859

Browse files
authored
Improve styling of requires-python warnings (#8240)
Extends #7959 While I was looking at that message, I noticed I didn't love the readability of the existing message and opted to follow-up with a change to them both.
1 parent d5b5b82 commit 6ac5859

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/uv/src/commands/project/lock.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -334,9 +334,9 @@ async fn do_lock(
334334
if requires_python.is_unbounded() {
335335
let default =
336336
RequiresPython::greater_than_equal_version(&interpreter.python_minor_version());
337-
warn_user_once!("The workspace `requires-python` value does not contain a lower bound: `{requires_python}`. Set a lower bound to indicate the minimum compatible Python version (e.g., `{default}`).");
337+
warn_user_once!("The workspace `requires-python` value (`{requires_python}`) does not contain a lower bound. Add a lower bound to indicate the minimum compatible Python version (e.g., `{default}`).");
338338
} else if requires_python.is_exact_without_patch() {
339-
warn_user_once!("The workspace `requires-python` value contains an exact match without a patch version: `{requires_python}`. When omitted, the patch version is implicitly `0`, e.g., `{requires_python}.0`. Did you mean `{requires_python}.*`?");
339+
warn_user_once!("The workspace `requires-python` value (`{requires_python}`) contains an exact match without a patch version. When omitted, the patch version is implicitly `0` (e.g., `{requires_python}.0`). Did you mean `{requires_python}.*`?");
340340
}
341341
requires_python
342342
} else {

crates/uv/tests/it/lock.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3530,7 +3530,7 @@ fn lock_requires_python_exact() -> Result<()> {
35303530

35313531
----- stderr -----
35323532
Using CPython 3.12.[X]
3533-
warning: The workspace `requires-python` value contains an exact match without a patch version: `==3.12`. When omitted, the patch version is implicitly `0`, e.g., `==3.12.[X]`. Did you mean `==3.12.*`?
3533+
warning: The workspace `requires-python` value (`==3.12`) contains an exact match without a patch version. When omitted, the patch version is implicitly `0` (e.g., `==3.12.[X]`). Did you mean `==3.12.*`?
35343534
Resolved 2 packages in [TIME]
35353535
"###);
35363536

@@ -3587,7 +3587,7 @@ fn lock_requires_python_exact() -> Result<()> {
35873587

35883588
----- stderr -----
35893589
Using CPython 3.12.[X]
3590-
warning: The workspace `requires-python` value contains an exact match without a patch version: `==3.12`. When omitted, the patch version is implicitly `0`, e.g., `==3.12.[X]`. Did you mean `==3.12.*`?
3590+
warning: The workspace `requires-python` value (`==3.12`) contains an exact match without a patch version. When omitted, the patch version is implicitly `0` (e.g., `==3.12.[X]`). Did you mean `==3.12.*`?
35913591
Resolved 2 packages in [TIME]
35923592
"###);
35933593

@@ -4139,7 +4139,7 @@ fn lock_requires_python_unbounded() -> Result<()> {
41394139
----- stdout -----
41404140

41414141
----- stderr -----
4142-
warning: The workspace `requires-python` value does not contain a lower bound: `<=3.12`. Set a lower bound to indicate the minimum compatible Python version (e.g., `>=3.11`).
4142+
warning: The workspace `requires-python` value (`<=3.12`) does not contain a lower bound. Add a lower bound to indicate the minimum compatible Python version (e.g., `>=3.11`).
41434143
Resolved 2 packages in [TIME]
41444144
"###);
41454145

@@ -4186,7 +4186,7 @@ fn lock_requires_python_unbounded() -> Result<()> {
41864186
----- stdout -----
41874187

41884188
----- stderr -----
4189-
warning: The workspace `requires-python` value does not contain a lower bound: `<=3.12`. Set a lower bound to indicate the minimum compatible Python version (e.g., `>=3.11`).
4189+
warning: The workspace `requires-python` value (`<=3.12`) does not contain a lower bound. Add a lower bound to indicate the minimum compatible Python version (e.g., `>=3.11`).
41904190
Resolved 2 packages in [TIME]
41914191
"###);
41924192

0 commit comments

Comments
 (0)