From eef7a78d7e499bf1b15c446cad9fe33e96e2eb59 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Wed, 24 Jul 2024 11:19:12 -0400 Subject: [PATCH] Omit interpreter path from output when using managed Python (#5313) Extending https://github.com/astral-sh/uv/pull/5311 to the project API --- crates/uv/src/commands/project/mod.rs | 28 ++++++++++++++++++--------- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/crates/uv/src/commands/project/mod.rs b/crates/uv/src/commands/project/mod.rs index cfe469c6b..735e92423 100644 --- a/crates/uv/src/commands/project/mod.rs +++ b/crates/uv/src/commands/project/mod.rs @@ -207,7 +207,7 @@ impl FoundInterpreter { let reporter = PythonDownloadReporter::single(printer); // Locate the Python interpreter to use in the environment - let interpreter = PythonInstallation::find_or_fetch( + let python = PythonInstallation::find_or_fetch( python_request, EnvironmentPreference::OnlySystem, python_preference, @@ -216,15 +216,25 @@ impl FoundInterpreter { cache, Some(&reporter), ) - .await? - .into_interpreter(); + .await?; - writeln!( - printer.stderr(), - "Using Python {} interpreter at: {}", - interpreter.python_version(), - interpreter.sys_executable().user_display().cyan() - )?; + let managed = python.source().is_managed(); + let interpreter = python.into_interpreter(); + + if managed { + writeln!( + printer.stderr(), + "Using Python {}", + interpreter.python_version().cyan() + )?; + } else { + writeln!( + printer.stderr(), + "Using Python {} interpreter at: {}", + interpreter.python_version(), + interpreter.sys_executable().user_display().cyan() + )?; + } if let Some(requires_python) = requires_python.as_ref() { if !requires_python.contains(interpreter.python_version()) {