From ad7c6b57e883c77ce92f00e462e6d8cb741018d2 Mon Sep 17 00:00:00 2001 From: Charlie Marsh Date: Thu, 18 Jul 2024 14:10:06 -0400 Subject: [PATCH] Make missing project table a tracing warning --- crates/uv-distribution/src/workspace.rs | 29 +++++++++++-------------- 1 file changed, 13 insertions(+), 16 deletions(-) diff --git a/crates/uv-distribution/src/workspace.rs b/crates/uv-distribution/src/workspace.rs index b2b4256425a2..6029d66ce17c 100644 --- a/crates/uv-distribution/src/workspace.rs +++ b/crates/uv-distribution/src/workspace.rs @@ -6,7 +6,7 @@ use std::path::{Path, PathBuf}; use either::Either; use glob::{glob, GlobError, PatternError}; use rustc_hash::FxHashSet; -use tracing::{debug, trace}; +use tracing::{debug, trace, warn}; use pep508_rs::{RequirementOrigin, VerbatimUrl}; use pypi_types::{Requirement, RequirementSource}; @@ -833,7 +833,7 @@ async fn find_workspace( Ok(None) } else { // We require that a `project.toml` file either declares a workspace or a project. - warn_user!( + warn!( "pyproject.toml does not contain `project` table: `{}`", pyproject_path.simplified_display() ); @@ -863,10 +863,9 @@ fn check_nested_workspaces(inner_workspace_root: &Path, stop_discovery_at: Optio let contents = match fs_err::read_to_string(&pyproject_toml_path) { Ok(contents) => contents, Err(err) => { - warn_user!( - "Unreadable pyproject.toml `{}`: {}", - pyproject_toml_path.user_display(), - err + warn!( + "Unreadable pyproject.toml `{}`: {err}", + pyproject_toml_path.simplified_display() ); return; } @@ -874,10 +873,9 @@ fn check_nested_workspaces(inner_workspace_root: &Path, stop_discovery_at: Optio let pyproject_toml: PyProjectToml = match toml::from_str(&contents) { Ok(contents) => contents, Err(err) => { - warn_user!( - "Invalid pyproject.toml `{}`: {}", - pyproject_toml_path.user_display(), - err + warn!( + "Invalid pyproject.toml `{}`: {err}", + pyproject_toml_path.simplified_display() ); return; } @@ -896,18 +894,17 @@ fn check_nested_workspaces(inner_workspace_root: &Path, stop_discovery_at: Optio ) { Ok(contents) => contents, Err(err) => { - warn_user!( - "Invalid pyproject.toml `{}`: {}", - pyproject_toml_path.user_display(), - err + warn!( + "Invalid pyproject.toml `{}`: {err}", + pyproject_toml_path.simplified_display() ); return; } }; if !is_excluded { warn_user!( - "Outer workspace including existing workspace, nested workspaces are not supported: `{}`", - pyproject_toml_path.user_display(), + "Nested workspaces are not supported, but outer workspace includes existing workspace: `{}`", + pyproject_toml_path.user_display().cyan(), ); } }