diff --git a/crates/uv-python/src/version_files.rs b/crates/uv-python/src/version_files.rs index 475afe81c..3c50c42f4 100644 --- a/crates/uv-python/src/version_files.rs +++ b/crates/uv-python/src/version_files.rs @@ -69,7 +69,26 @@ impl PythonVersionFile { working_directory: impl AsRef, options: &DiscoveryOptions<'_>, ) -> Result, std::io::Error> { - let Some(path) = Self::find_nearest(working_directory, options) else { + let Some(path) = Self::find_nearest(&working_directory, options) else { + if let Some(stop_discovery_at) = options.stop_discovery_at { + if stop_discovery_at == working_directory.as_ref() { + debug!( + "No Python version file found in workspace: {}", + working_directory.as_ref().display() + ); + } else { + debug!( + "No Python version file found between working directory `{}` and workspace root `{}`", + working_directory.as_ref().display(), + stop_discovery_at.display() + ); + } + } else { + debug!( + "No Python version file found in ancestors of working directory: {}", + working_directory.as_ref().display() + ); + } // Not found in directory or its ancestors. Looking in user-level config. return Ok(match user_uv_config_dir() { Some(user_dir) => Self::discover_user_config(user_dir, options) diff --git a/crates/uv/tests/it/lock.rs b/crates/uv/tests/it/lock.rs index d6fcb69d6..be2907b94 100644 --- a/crates/uv/tests/it/lock.rs +++ b/crates/uv/tests/it/lock.rs @@ -15745,6 +15745,7 @@ fn lock_explicit_default_index() -> Result<()> { DEBUG uv [VERSION] ([COMMIT] DATE) DEBUG Found workspace root: `[TEMP_DIR]/` DEBUG Adding root workspace member: `[TEMP_DIR]/` + DEBUG No Python version file found in workspace: [TEMP_DIR]/ DEBUG Using Python request `>=3.12` from `requires-python` metadata DEBUG Checking for Python environment at `.venv` DEBUG The virtual environment's Python version satisfies `>=3.12`