Skip to content

Commit

Permalink
Revert "Remove duplicate warning for settings discovery errors (#7384)…
Browse files Browse the repository at this point in the history
…" (#7594)

## Summary

This reverts commit 3060fd2.

These are now _never_ shown to users, because `tracing` isn't set up at
that point. I'm going to try and improve the solution more holistically,
but this is better than the status quo.

Closes #7573.
  • Loading branch information
charliermarsh authored Sep 20, 2024
1 parent 2c6d353 commit 85af273
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 4 deletions.
8 changes: 4 additions & 4 deletions crates/uv-settings/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
use std::ops::Deref;
use std::path::{Path, PathBuf};

use tracing::{debug, warn};
use tracing::debug;

use uv_fs::Simplified;
use uv_warnings::owo_colors::OwoColorize;
use uv_warnings::warn_user;

pub use crate::combine::*;
pub use crate::settings::*;
Expand Down Expand Up @@ -74,7 +74,7 @@ impl FilesystemOptions {
}
Err(Error::PyprojectToml(file, err)) => {
// If we see an invalid `pyproject.toml`, warn but continue.
warn!(
warn_user!(
"Failed to parse `{}` during settings discovery:\n{}",
file.cyan(),
textwrap::indent(&err.to_string(), " ")
Expand Down Expand Up @@ -107,7 +107,7 @@ impl FilesystemOptions {
.and_then(|content| toml::from_str::<PyProjectToml>(&content).ok())
{
if pyproject.tool.is_some_and(|tool| tool.uv.is_some()) {
warn!(
warn_user!(
"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."
);
}
Expand Down
7 changes: 7 additions & 0 deletions crates/uv/tests/lock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13005,6 +13005,13 @@ fn lock_duplicate_sources() -> Result<()> {
----- stdout -----

----- stderr -----
warning: Failed to parse `pyproject.toml` during settings discovery:
TOML parse error at line 9, column 9
|
9 | python-multipart = { url = "https://files.pythonhosted.org/packages/c0/3e/9fbfd74e7f5b54f653f7ca99d44ceb56e718846920162165061c4c22b71a/python_multipart-0.0.8-py3-none-any.whl" }
| ^
duplicate key `python-multipart` in table `tool.uv.sources`

error: Failed to parse: `pyproject.toml`
Caused by: TOML parse error at line 9, column 9
|
Expand Down
9 changes: 9 additions & 0 deletions crates/uv/tests/pip_compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3285,6 +3285,15 @@ fn override_dependency_from_workspace_invalid_syntax() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Failed to parse `pyproject.toml` during settings discovery:
TOML parse error at line 9, column 29
|
9 | override-dependencies = [
| ^
no such comparison operator "=", must be one of ~= == != <= >= < > ===
werkzeug=2.3.0
^^^^^^
error: Failed to parse: `pyproject.toml`
Caused by: TOML parse error at line 9, column 29
|
Expand Down
7 changes: 7 additions & 0 deletions crates/uv/tests/pip_install.rs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ fn invalid_pyproject_toml_syntax() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Failed to parse `pyproject.toml` during settings discovery:
TOML parse error at line 1, column 5
|
1 | 123 - 456
| ^
expected `.`, `=`
error: Failed to parse: `pyproject.toml`
Caused by: TOML parse error at line 1, column 5
|
Expand Down
1 change: 1 addition & 0 deletions crates/uv/tests/show_settings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2950,6 +2950,7 @@ fn resolve_both() -> anyhow::Result<()> {
}
----- stderr -----
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.
"###
);

Expand Down
7 changes: 7 additions & 0 deletions crates/uv/tests/venv.rs
Original file line number Diff line number Diff line change
Expand Up @@ -495,6 +495,13 @@ fn create_venv_warns_user_on_requires_python_discovery_error() -> Result<()> {
----- stdout -----
----- stderr -----
warning: Failed to parse `pyproject.toml` during settings discovery:
TOML parse error at line 1, column 9
|
1 | invalid toml
| ^
expected `.`, `=`
warning: Failed to parse: `pyproject.toml`
Using Python 3.12.[X] interpreter at: [PYTHON-3.12]
Creating virtual environment at: .venv
Expand Down

0 comments on commit 85af273

Please sign in to comment.