Skip to content

Commit d85e2a9

Browse files
committed
Revert "Remove duplicate warning for settings discovery errors (#7384)"
This reverts commit 3060fd2.
1 parent 7a25a82 commit d85e2a9

6 files changed

Lines changed: 35 additions & 4 deletions

File tree

crates/uv-settings/src/lib.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
use std::ops::Deref;
22
use std::path::{Path, PathBuf};
33

4-
use tracing::{debug, warn};
4+
use tracing::debug;
55

66
use uv_fs::Simplified;
7-
use uv_warnings::owo_colors::OwoColorize;
7+
use uv_warnings::warn_user;
88

99
pub use crate::combine::*;
1010
pub use crate::settings::*;
@@ -74,7 +74,7 @@ impl FilesystemOptions {
7474
}
7575
Err(Error::PyprojectToml(file, err)) => {
7676
// If we see an invalid `pyproject.toml`, warn but continue.
77-
warn!(
77+
warn_user!(
7878
"Failed to parse `{}` during settings discovery:\n{}",
7979
file.cyan(),
8080
textwrap::indent(&err.to_string(), " ")
@@ -107,7 +107,7 @@ impl FilesystemOptions {
107107
.and_then(|content| toml::from_str::<PyProjectToml>(&content).ok())
108108
{
109109
if pyproject.tool.is_some_and(|tool| tool.uv.is_some()) {
110-
warn!(
110+
warn_user!(
111111
"Found both a `uv.toml` file and a `[tool.uv]` section in an adjacent `pyproject.toml`. The `[tool.uv]` section will be ignored in favor of the `uv.toml` file."
112112
);
113113
}

crates/uv/tests/lock.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13005,6 +13005,13 @@ fn lock_duplicate_sources() -> Result<()> {
1300513005
----- stdout -----
1300613006

1300713007
----- stderr -----
13008+
warning: Failed to parse `pyproject.toml` during settings discovery:
13009+
TOML parse error at line 9, column 9
13010+
|
13011+
9 | python-multipart = { url = "https://files.pythonhosted.org/packages/c0/3e/9fbfd74e7f5b54f653f7ca99d44ceb56e718846920162165061c4c22b71a/python_multipart-0.0.8-py3-none-any.whl" }
13012+
| ^
13013+
duplicate key `python-multipart` in table `tool.uv.sources`
13014+
1300813015
error: Failed to parse: `pyproject.toml`
1300913016
Caused by: TOML parse error at line 9, column 9
1301013017
|

crates/uv/tests/pip_compile.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3285,6 +3285,15 @@ fn override_dependency_from_workspace_invalid_syntax() -> Result<()> {
32853285
----- stdout -----
32863286
32873287
----- stderr -----
3288+
warning: Failed to parse `pyproject.toml` during settings discovery:
3289+
TOML parse error at line 9, column 29
3290+
|
3291+
9 | override-dependencies = [
3292+
| ^
3293+
no such comparison operator "=", must be one of ~= == != <= >= < > ===
3294+
werkzeug=2.3.0
3295+
^^^^^^
3296+
32883297
error: Failed to parse: `pyproject.toml`
32893298
Caused by: TOML parse error at line 9, column 29
32903299
|

crates/uv/tests/pip_install.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,13 @@ fn invalid_pyproject_toml_syntax() -> Result<()> {
9292
----- stdout -----
9393
9494
----- stderr -----
95+
warning: Failed to parse `pyproject.toml` during settings discovery:
96+
TOML parse error at line 1, column 5
97+
|
98+
1 | 123 - 456
99+
| ^
100+
expected `.`, `=`
101+
95102
error: Failed to parse: `pyproject.toml`
96103
Caused by: TOML parse error at line 1, column 5
97104
|

crates/uv/tests/show_settings.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2950,6 +2950,7 @@ fn resolve_both() -> anyhow::Result<()> {
29502950
}
29512951
29522952
----- stderr -----
2953+
warning: Found both a `uv.toml` file and a `[tool.uv]` section in an adjacent `pyproject.toml`. The `[tool.uv]` section will be ignored in favor of the `uv.toml` file.
29532954
"###
29542955
);
29552956

crates/uv/tests/venv.rs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -495,6 +495,13 @@ fn create_venv_warns_user_on_requires_python_discovery_error() -> Result<()> {
495495
----- stdout -----
496496
497497
----- stderr -----
498+
warning: Failed to parse `pyproject.toml` during settings discovery:
499+
TOML parse error at line 1, column 9
500+
|
501+
1 | invalid toml
502+
| ^
503+
expected `.`, `=`
504+
498505
warning: Failed to parse: `pyproject.toml`
499506
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
500507
Creating virtual environment at: .venv

0 commit comments

Comments
 (0)