Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Skip invalid tools in uv tool list #5156

Merged
merged 1 commit into from
Jul 18, 2024
Merged

Skip invalid tools in uv tool list #5156

merged 1 commit into from
Jul 18, 2024

Conversation

charliermarsh
Copy link
Member

Summary

Makes the tools() return value include per-tool errors. This makes it easy to skip (rather than failing) in uv tool list, and improves uv tool uninstall to remove those invalid tools, rather than leaving them around. (We already had that behavior for uv tool uninstall ruff with an invalid ruff, but uv tool uninstall --all just left them.)

Closes #5151.

@charliermarsh charliermarsh changed the title Skip invalid tools in uv tool list Skip invalid tools in uv tool list Jul 17, 2024
@charliermarsh charliermarsh added bug Something isn't working preview Experimental behavior labels Jul 17, 2024
@charliermarsh charliermarsh marked this pull request as ready for review July 17, 2024 17:55
@charliermarsh charliermarsh force-pushed the charlie/l branch 4 times, most recently from 3ac204e to 10f554c Compare July 17, 2024 18:28
// Skip invalid tools
let Ok(tool) = tool else {
warn_user!(
"Ignoring malformed tool `{name}` (use {} to remove)",
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
"Ignoring malformed tool `{name}` (use {} to remove)",
"Ignoring malformed tool `{name}` (use `{}` to remove)",

Copy link
Member Author

Choose a reason for hiding this comment

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

It's green though so I intentionally omitted this, what do you think?

Copy link
Member

Choose a reason for hiding this comment

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

Oh. I don't think the color is enough alone (and it's not great for users with colorblindness or colors turned off).

@@ -84,8 +84,7 @@ fn tool_list_missing_receipt() {

----- stderr -----
warning: `uv tool list` is experimental and may change without warning.
warning: Ignoring malformed tool `black`: missing receipt
No tools installed
warning: Ignoring malformed tool `black` (use uv tool uninstall black to remove)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
warning: Ignoring malformed tool `black` (use uv tool uninstall black to remove)
warning: Ignoring malformed tool `black` (use `uv tool uninstall black` to remove)

@charliermarsh charliermarsh enabled auto-merge (squash) July 18, 2024 17:48
@charliermarsh charliermarsh merged commit 4a875af into main Jul 18, 2024
52 checks passed
@charliermarsh charliermarsh deleted the charlie/l branch July 18, 2024 17:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working preview Experimental behavior
Projects
None yet
Development

Successfully merging this pull request may close these issues.

uv tool list should not fail on invalid receipts
2 participants