Skip to content

Commit

Permalink
Omit interpreter path from output when using managed Python (#5313)
Browse files Browse the repository at this point in the history
Extending #5311 to the project API
  • Loading branch information
zanieb committed Jul 24, 2024
1 parent d642705 commit eef7a78
Showing 1 changed file with 20 additions and 10 deletions.
30 changes: 20 additions & 10 deletions crates/uv/src/commands/project/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -216,15 +216,25 @@ impl FoundInterpreter {
cache,
Some(&reporter),
)
.await?
.into_interpreter();

writeln!(
printer.stderr(),
"Using Python {} interpreter at: {}",
interpreter.python_version(),
interpreter.sys_executable().user_display().cyan()
)?;
.await?;

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()) {
Expand Down

0 comments on commit eef7a78

Please sign in to comment.