Skip to content

Feature Request: Add a way to get tool venv specific information when using uv tool #7311

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

Open
taranlu-houzz opened this issue Sep 11, 2024 · 7 comments
Labels
cli Related to the command line interface enhancement New feature or improvement to existing functionality uv tool Related to the uv tool interface

Comments

@taranlu-houzz
Copy link

It would be very helpful to have the following additional functionality as flags for uv tool list:

  • --show-full-dep-tree: show all of the deps installed into the tool venvs.
  • --show-tool-install-command: show the original command used to install the tool (sometimes the package name does not match what is on pypi, e.g. p4python installs the P4 package).

To help differentiate tools installed with a more complicated setup, it is really helpful to have an additional suffix that gets appended to all installed script entry points (pipx does this via the --suffix flag).

Use case:

  • I install coverage with additional pytest deps like this: uv tool install coverage --with pytest --with pytest-spec --with pytest-sugar.
  • This lets me use uvx coverage run -m pytest to run tests with my desired plugins on any project.
  • Depending on how long it has been since I used a tool, it may be hard to recall exactly what is installed in the tool environment (or how it was initially installed).
@zanieb
Copy link
Member

zanieb commented Sep 11, 2024

I think this may be a uv tool show command instead?

We're adding suffix support (#7095)

@zanieb
Copy link
Member

zanieb commented Sep 11, 2024

Thanks for sharing your use-cases!

@zanieb zanieb added enhancement New feature or improvement to existing functionality cli Related to the command line interface uv tool Related to the uv tool interface labels Sep 11, 2024
@taranlu-houzz
Copy link
Author

@zanieb Good to hear! Is uv tool show a new development? I am using uv 0.4.9 (77d278f68 2024-09-10) and that does not appear to be a subcommand yet?

@zanieb
Copy link
Member

zanieb commented Sep 11, 2024

Oh sorry no it doesn't exist but I think it should — I think it'd be a better experience for your use-cases than adding these flags to tool list.

@KyleKing
Copy link

KyleKing commented Oct 10, 2024

I would also like to see something like "show install command". mdformat and poetry have similar plugin behavior to pytest. Comparing pipx and uv:

> pipx install mdformat
> pipx inject mdformat 'mdformat-obsidian[recommended]'
> pipx install poetry
> pipx inject poetry poetry-plugin-sort poetry-relax
> pipx list --include-injected
venvs are in ~/.local/pipx/venvs
apps are exposed on your $PATH at ~/.local/bin
manual pages are exposed at ~/.local/share/man
   package mdformat 0.7.17, installed using Python 3.12.7
    - mdformat
    Injected Packages:
      - mdformat-obsidian 0.1.0
   package poetry 1.8.3, installed using Python 3.12.5
    - poetry
    Injected Packages:
      - poetry-plugin-sort 0.2.1
      - poetry-relax 1.1.0

> uv tool install --with 'mdformat-obsidian[recommended]' mdformat
> uv tool install poetry --with=poetry-plugin-sort --with=poetry-relax
> uv tool list
mdformat v0.7.17
- mdformat
poetry v1.8.3
- poetry

Being able to see this information across all installed tools at once would be really helpful. As a third option to the ones proposed in the original post, maybe there could be a --show-with flag to uv tool list?

> uv tool list --show-version-specifiers --show-with
mdformat v0.7.17 [required: ]
- mdformat
  With:
  - mdformat-obsidian 0.1.0

Or a fourth option of --show-install-options

> uv tool list --show-version-specifiers --show-install-options
mdformat v0.7.17 [required: ]
- mdformat
  Install options:
  --with 'mdformat-obsidian[recommended]'
  <additional `--with`, `--editable`, etc.>

@KyleKing
Copy link

KyleKing commented Oct 10, 2024

One hackish workaround for uv might be to use: (correction: this only worked because I had separately experimented with uv tool run. Tested with uv tool install --with pytest-sugar pytest where where which pytest outputs ~/.local/bin/pytest)

> which mdformat
uv tool run --with 'mdformat-obsidian[recommended]' mdformat

Alternatively, mdformat supports logging the found plugins and respetive versions. However, for pytest, I'm not sure if the plugins can be printed without running pytest.

> mdformat --version
mdformat 0.7.17 (mdformat_frontmatter: 2.0.8, mdformat_simple_breaks: 0.0.1, mdformat_tables: 1.0.0, mdformat_gfm: 0.3.6, mdformat_obsidian: 0.1.0, mdformat_wikilink: 0.2.0, mdformat_web: 0.1.0,
mdformat_beautysh: 0.1.1, mdformat_ruff: 0.1.3, mdformat_config: 0.1.3)

Related to #8028 where uv may not currently remember how a tool was installed

@r-richmond
Copy link

I'm also replacing my pipx usage with UV and I was explicitly looking for UV's equivalent of pipx list --include-injected

FWIW I think @KyleKing 's suggestion of uv tool list --show-with would be perfect but I also see the value in the more complete/verbose --show-install-options.

@zanieb 's since just the --show-with request/suggestion has diverged a little from the OP should a separate issue be made for it or would like to keep it centralized here?

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 enhancement New feature or improvement to existing functionality uv tool Related to the uv tool interface
Projects
None yet
Development

No branches or pull requests

4 participants