`uv run` and `uv tool run` should list available scripts and executables
Rye has this neat feature: https://rye.astral.sh/guide/commands/run/
@charliermarsh what is the difference between uv run and uv tool run? I can't seem to find it in the docs, and they seem to have different behavior.
Neither is documented right now nor intended to be used -- they're both under active development. But uv run is "run a command within this project's environment", while uv tool run is "run a globally-installed tool" (similar to pipx).
uv tool run will also run a tool in an ephemeral environment, it's like pipx run or npx.
I actually don't know if we need this, we have uv tool list. Do we want uv tool run to fall back to this?
It probably makes more sense than starting a python REPL (which I think we should remove?)
I think uv tool run and uv run just show help.
I think uv tool run should list the available executables, to start. That seems straightforward.
Not sure about uv run, it's a little less obvious what should happen there, since (unlike Rye) we don't have "scripts". We could list entrypoints, but, IDK.
The uv tool run part should be doable now, at least.
Gosh, I'd sure love this. The error message here, e.g., when I haven't installed django yet is not helpful:
❯ uv run django-admin startproject mysite
Using Python 3.11.7
Creating virtualenv at: .venv
error: Failed to spawn: `django-admin`
Caused by: No such file or directory (os error 2)
I think we can at least list things in the virtual environment bin?
Agreed. Let's start with that. Help wanted!
Looks like this got implemented as fallback to uv tool list when uv tool run has no arg, but I find it really unintuitive
$ uv --version
uv 0.4.6 (84f25e8cf 2024-09-05)
$ uv tool run
pytest v8.3.2
- py.test
- pytest
At least add a message before like you didn't specify any command to run, here are the ones you have
Hello team,
I am willing to contribute to this issue,
According to me:
1.) uv tool run should list all the globally installed tools
2.) Not sure about the uv run command and what is the entry-points you discussed earlier?
Can you assign this task to me?
uv tool run already does this.
We're not sure what we we want to do for uv run, but I think we'd want to either list things in .venv/bin or the entrypoints of all the packages in the environment.
https://packaging.python.org/en/latest/specifications/entry-points/
https://github.com/astral-sh/uv/blob/4f2349119cf341eedf738d06a50ed136a5f207db/crates/uv/src/commands/tool/run.rs#L244-L258