mirror of
https://github.com/astral-sh/uv.git
synced 2025-08-04 19:08:04 +00:00
Fix a bug where no warning is output when parsing of workspace settings fails. (#4014)
## Summary See #4013 `uv pip ...` command loads workspace settings from pyproject.toml and uv.toml. Although a warning is implemented to output a warning when parsing fails, it is not actually output. https://github.com/astral-sh/uv/blob/main/crates/uv-workspace/src/workspace.rs#L38-L61 The reason is that the flag to display warnings is enabled after loading the workspace settings. This PR turns on the warning output flag before loading the workspace. ## Test Plan pyproject.toml for test ```toml [project] name = "sample" version = "0.0.0" dependencies = ["ruff"] [tool.uv.pip] # originally string type. index-url = 1 ``` command output (before modification) ```bash uv pip compile pyproject.toml Resolved 1 package in 383ms # This file was autogenerated by uv via the following command: # uv pip compile pyproject.toml ruff==0.4.7 # via sample (pyproject.toml) ``` command output (after modification) ```bash uv pip compile pyproject.toml warning: Failed to parse `pyproject.toml`: TOML parse error at line 7, column 13 | 7 | index-url = true | ^^^^ invalid type: boolean `true`, expected a string Resolved 1 package in 107ms # This file was autogenerated by uv via the following command: # uv pip compile pyproject.toml ruff==0.4.7 # via sample (pyproject.toml) ```
This commit is contained in:
parent
da7d5549a3
commit
41ec302557
4 changed files with 27 additions and 2 deletions
|
@ -17,6 +17,11 @@ pub fn enable() {
|
|||
ENABLED.store(true, std::sync::atomic::Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// Disable user-facing warnings.
|
||||
pub fn disable() {
|
||||
ENABLED.store(false, std::sync::atomic::Ordering::SeqCst);
|
||||
}
|
||||
|
||||
/// Warn a user, if warnings are enabled.
|
||||
#[macro_export]
|
||||
macro_rules! warn_user {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue