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 entry points in uv tool list #4654

Closed
zanieb opened this issue Jun 29, 2024 · 5 comments · Fixed by #4661
Closed

Show tool entry points in uv tool list #4654

zanieb opened this issue Jun 29, 2024 · 5 comments · Fixed by #4661
Labels
cli Related to the command line interface help wanted Contribution especially encouraged needs-design Needs discussion, investigation, or design preview Experimental behavior

Comments

@zanieb
Copy link
Member

zanieb commented Jun 29, 2024

We should display the name of the executable entry points that are provided by an installed tool e.g.

$ uv tool list
black
    black
    blackd

The format is up for debate, open questions include things like:

  • Should we show the path to the executable?
  • Should this be opt-in or display by default?
  • Should we omit it for tools that provide a single entry points with the same name?

Another idea is like

$ uv tool list
black (provides: black, blackd)

When proposing a design here, we should take into account the output of other tools like pipx.

Related:

@zanieb zanieb added help wanted Contribution especially encouraged needs-design Needs discussion, investigation, or design cli Related to the command line interface preview Experimental behavior labels Jun 29, 2024
This was referenced Jun 29, 2024
@zanieb
Copy link
Member Author

zanieb commented Jun 30, 2024

The proposal to match cargo install --list in #4653 (comment) seems nice.

@moreaupascal56
Copy link
Contributor

moreaupascal56 commented Jun 30, 2024

Hello I would like to have a look and help on this; but I am relatively new to uv and rust so it will not be immediate, if this is urgent I will just collaborate and have a look at the proposed solution to learn about the codebase and be useful someday else :)
Anyway uv is amazing thanks to te dev team !

@zanieb
Copy link
Member Author

zanieb commented Jun 30, 2024

Thanks @moreaupascal56! Appreciate it :)

It's likely someone will tackle this soon (or I will) but feel free to ask questions on the pull request. We'll be tagging more things as good first issue Good for newcomers so keep an eye out.

@T-256
Copy link
Contributor

T-256 commented Jun 30, 2024

The proposal to match cargo install --list in #4653 (comment) seems nice.

I like it, another possible design could be uv tool list show entrypoints instead of installed tools:

$ uv tool list
black
blackd (from black)

By that, no indentions applied to output and user will know what names are available to use.
A benefit from this design is that when entrypoints of a tool don't have self contained:

tool-name = test-cli
entrypoints = tester, testing

with this design it'd be:

$ uv tool list
tester (from test-cli)
testing (from test-cli)

with indentions:

$ uv tool list
test-cli
    tester
    testing

first one prioritizes entrypoints visually, and more looks good into my eyes.

@zanieb
Copy link
Member Author

zanieb commented Jun 30, 2024

I kind of like that, but it gets a little tricky with versions.

Nit: If you've used uv tool install you shouldn't use uv tool run, they're added to your path and invoked directly. To run blackd with uv tool run you'd need uv tool run --from black blackd.

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 <[email protected]>
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 help wanted Contribution especially encouraged 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
@zanieb @moreaupascal56 @T-256 and others