-
Notifications
You must be signed in to change notification settings - Fork 996
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
Should uvx
use a project dependency if available?
#7186
Comments
My preference is to reserve |
Isn't this just
Except |
Sorry, I'm on my phone so I can't try things. Reworded my previous comment right after posting. Didn't know npx could run commands without installing. I don't personally use it now but did a few years ago, when npx came out it was used just for easily running installed binaries in the project. For global installations I rather use the
|
Yep that's the suggestion this issue tracks. |
Currently Meaning it will either call I don't know if that is feasible as these commands have different options. My original suggestion was to have a 3rd command but I am seeing it as more confusing to the end user than a smarter |
The idea here is that |
This actually seems to be two different questions, no?
Because so far as I can see (with my limited knowledge of the problem) it would be theoretically possible to do 1 but not 2, no? I.e. reuse the installed wheel but still run it in an isolated environment? While I'm here, my feedback would be that this seems to me on the face of it not such a great idea. The whole "tool" interface is already a little challenging for newcomers conceptually (was for me, anyway). Assuming that both 1) and 2) are being proposed, this proposal would muddy the waters and make it even more confusing, as the behaviour of Sometimes it makes a big difference whether a tool-like package runs in an environment or not (e.g. If anything I would say that If using the project dependency with |
I've been using uv run lately to have tools available in the current env of a project without having it installed as a dependency. Tools such as ones that are useful once in a blue moon such as checking for licenses of libs:
This is what I would hope for uvx to be when running inside a project. Notice this must run in the project env to find the libraries. Reading the docs: Relationship to uv run For uv run to behave like uvx, it would require So why can't uvx just have a This would be very easy to implement and save us a lot of keystrokes and mental gymnastics to remember the usage. |
Right now,
uvx
will run in an isolated environment even if the target tool is installed in the current project. For example,uvx ruff
will not use the version of Ruff declared in the project (e.g., withuv add ruff==0.3.0
). If we're in a project, it might make sense to respect the version there instead of ignoring it?This may be a reasonable way to support defining tools in projects until we design and implement "project-level tool definitions" per #3560.
Related:
uvx
warn if the command is present in the project environment? #6377uv run
as a task runner #5903 (comment)The text was updated successfully, but these errors were encountered: