Skip to content

Conversation

@sinsniwal
Copy link

Summary

Resolves : #16783

That message is only visible if uv found no managed Python installations. If you had Python installed (even if it was fully up-to-date), requests would not be empty, and the code would skip this block and move on to the resolution phase.

The output message "There are no installed versions to upgrade" was ambiguous. It was unclear whether uv could not find any installed versions or if the existing versions were simply already up-to-date as mentioned in issue.

So updated the message to
"No Python installations found; run `uv python install` to install a Python version.
to explicitly indicate when no uv-managed Python installations exist.

Test Plan

Updated the existing test snapshot in python_upgrade_without_version to match the new output string. Verified that tests pass locally with cargo test.

writeln!(
printer.stderr(),
"There are no installed versions to upgrade"
"No Python installations found; run `uv python install` to install a Python version."
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this case entirely redundant with the one above?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, makes sense. I've applied those changes in the new commit.

Comment on lines 307 to 311
writeln!(
printer.stderr(),
"There are no installed versions to upgrade"
"No Python installations found; run `uv python install` to install a Python version."
)?;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if we should use our hint: ... styling for the second part of the message?

We should style the command with color like we do for other commands in output.

nit: I'd probably say "use" instead of "run".

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sure , i have added those changes in the new commit, thanks.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The hint formatting I was referring to is like

write!(
f,
"\n\n{}{} Consider recreating the environment (e.g., with `{}`)",
"hint".bold().cyan(),
":".bold(),
"uv venv".green()
)?;

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Made the changes

@zanieb zanieb added the error messages Messaging when something goes wrong label Nov 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

error messages Messaging when something goes wrong

Projects

None yet

Development

Successfully merging this pull request may close these issues.

uv python upgrade output message is ambiguous

2 participants