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

Show tool versions in uv tool list #4653

Closed
zanieb opened this issue Jun 29, 2024 · 6 comments · Fixed by #4674
Closed

Show tool versions in uv tool list #4653

zanieb opened this issue Jun 29, 2024 · 6 comments · Fixed by #4674
Labels
cli Related to the command line interface good first issue Good for newcomers needs-design Needs discussion, investigation, or design preview Experimental behavior

Comments

@zanieb
Copy link
Member

zanieb commented Jun 29, 2024

In addition to the name, it'd be nice to show the installed version. Should this be behind a flag? Are there other commands like uv pip list or pipx list we should take inspiration from?

A simple example:

$ uv tool list --show-versions
black v20.0.1

Related:

@zanieb zanieb added needs-design Needs discussion, investigation, or design cli Related to the command line interface preview Experimental behavior labels Jun 29, 2024
@zanieb zanieb added the good first issue Good for newcomers label Jun 29, 2024
@blueraft
Copy link
Contributor

The cargo command which includes both the version and entrypoints could be used as an inspiration too.

❯ cargo install --list
sqlx-cli v0.7.3:
    cargo-sqlx
    sqlx

@zanieb
Copy link
Member Author

zanieb commented Jun 30, 2024

Nice, I like the look of that

@caiquejjx
Copy link
Contributor

I think the version should be showed by default because it doesn't add that much of information, the entrypoints maybe we should add a flag like --entrypoints because for cases where we have a lot of tools it might be too much

@charliermarsh
Copy link
Member

Personally I'd probably do:

sqlx-cli==0.7.3:
    cargo-sqlx
    sqlx

Only because sqlx-cli==0.7.3 matches pip freeze. But I don't feel strongly.

@zanieb
Copy link
Member Author

zanieb commented Jun 30, 2024

I don't love the pinned requirement syntax for something that will always be a specific version and isn't meant for consumption by another tool.

@caiquejjx
Copy link
Contributor

I have created a pr based on @blueraft suggestion, lmk if it is the final design we want

zanieb added a commit that referenced this issue Jul 3, 2024
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->
Closes #4654 
## Summary

The purpose of this is to show the entrypoints of each tool when running
`uv tool list` as below:

```
$ uv tool list
black
    black
    blackd

```

I used the proposed formatting as it was written in #4653 by @blueraft.
I had to use spaces instead of tabs in order to make the test
successful. Indeed in the test we are using a raw string and I did not
manage to make the test pass when escaping the tab in the list.rs file
so I used spaces everywhere.

I had a deeper look into #4653 as well but it is more difficult as we
need to get the version of the tool in the Tool object, I will continue
on this next one later.

Please tell me if anything else is needed I tried to follow the
contribution guidelines but I might have forgotten something.
Have a great day!


## Test Plan

`cargo clippy`

then by using the local version of uv as described in the Readme.md. 


```
my-computer :~/mypath/uv$ cargo run -- tool list
   Compiling uv-cli v0.0.1 (/mypath/uv/crates/uv-cli)
   Compiling uv v0.2.18 (/mypath/uv/crates/uv)
    Finished `dev` profile [unoptimized + debuginfo] target(s) in 18.69s
     Running `target/debug/uv tool list`
warning: `uv tool list` is experimental and may change without warning.
black
  black
  blackd
isort
  isort
  isort-identify-imports

```

and 

`cargo test tool_list`

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
zanieb added a commit that referenced this issue Jul 3, 2024
<!--
Thank you for contributing to uv! To help us out with reviewing, please
consider the following:

- Does this pull request include a summary of the change? (See below.)
- Does this pull request include a descriptive title?
- Does this pull request include references to any relevant issues?
-->
Closes #4653

## Summary
Adds the tool version to the list command right beside the tool name

```
$ uv tool list
black v24.2.0
```

Following the proposed format discussed in #4653


## Test Plan
`cargo test tool_list`

<!-- How was it tested? -->

---------

Co-authored-by: Zanie Blue <contact@zanie.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli Related to the command line interface good first issue Good for newcomers needs-design Needs discussion, investigation, or design preview Experimental behavior
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants