mirror of
https://github.com/astral-sh/uv.git
synced 2025-07-23 05:05:02 +00:00
Make warnings user-facing (#628)
## Summary Now, `puffin_warnings::warn_once` and `puffin_warnings::warn` will go to `stderr`, as long as the user isn't running under `--quiet`. Previously, these went through `tracing`, and so were only visible when running under `--verbose`.
This commit is contained in:
parent
490fb55ac5
commit
a24eb57e93
16 changed files with 95 additions and 66 deletions
|
@ -16,7 +16,7 @@ workspace = true
|
|||
pep440_rs = { path = "../pep440-rs", features = ["serde"] }
|
||||
pep508_rs = { path = "../pep508-rs", features = ["serde"] }
|
||||
puffin-normalize = { path = "../puffin-normalize" }
|
||||
puffin-macros = { path = "../puffin-macros" }
|
||||
puffin-warnings = { path = "../puffin-warnings" }
|
||||
|
||||
chrono = { workspace = true, features = ["serde"] }
|
||||
mailparse = { workspace = true }
|
||||
|
|
|
@ -6,7 +6,7 @@ use serde::{de, Deserialize, Deserializer, Serialize};
|
|||
|
||||
use pep440_rs::{Pep440Error, VersionSpecifiers};
|
||||
use pep508_rs::{Pep508Error, Requirement};
|
||||
use puffin_macros::warn_once;
|
||||
use puffin_warnings::warn_once;
|
||||
|
||||
/// Ex) `>=7.2.0<8.0.0`
|
||||
static MISSING_COMMA: Lazy<Regex> = Lazy::new(|| Regex::new(r"(\d)([<>=~^!])").unwrap());
|
||||
|
@ -63,8 +63,8 @@ fn parse_with_fixups<Err, T: FromStr<Err = Err>>(input: &str, type_name: &str) -
|
|||
|
||||
if let Ok(requirement) = T::from_str(&patched_input) {
|
||||
warn_once!(
|
||||
"{} to fix invalid {type_name} (before: `{input}`; after: `{patched_input}`)",
|
||||
messages.join(" and ")
|
||||
"Fixing invalid {type_name} by {} (before: `{input}`; after: `{patched_input}`)",
|
||||
messages.join(", ")
|
||||
);
|
||||
return Ok(requirement);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue