Skip to main content

Using uv tool to Install and Run Python-Based Commands

Python · uv · Developer tools

A production-ready explanation of uv tool begins by separating three problems that weaker tutorials collapse together: project-pinned tools, user-wide tools, and one-off tools.

UV Series

Main distinction

uv tool is for user-level executable management, not for every case in which a project uses a Python-based command.

Production correction

Shared repositories often do better by pinning tools like ruff and ty in dev dependencies and running them with uv run.

Reader outcome

You should leave able to decide among uv add --dev, uv tool install, and uvx without guessing.

The real question

Do You Want a Shared Project Tool, a User-Wide Tool, or a One-Off Tool?

Many articles flatten these into one idea. That is a mistake. A production workflow should separate them because the tradeoffs are different.

  • Project-pinned tool: the tool is versioned with the repository so every contributor runs the same thing.
  • User-wide tool: the tool is installed for your shell and reused across projects.
  • One-off ephemeral tool: the tool is fetched and run for a single task without becoming part of your normal setup.
The production-ready distinction The question is not “can uv tool install this?” The question is “what level of stability and sharing does this tool need?”
What uv tool does

User-Wide Tool Installation Is About Executables, Not Project Imports

uv tool install installs a tool package in an isolated tool environment and puts its executables on your PATH. That is why the command is useful for things you want to run from the terminal across projects.

uv tool install ruff@latest
ruff --version
uv tool upgrade ruff
uv tool uninstall ruff

There is one critical caveat: unlike uv pip install, installing a tool does not make its modules importable inside your current project environment. That isolation is part of the design.

One-off use

Sometimes uvx or uv tool run Is Better Than Installing Anything

If you only need a tool for a single command or a quick inspection, the ephemeral route is often cleaner.

uvx ruff check .
uv tool run --from ruff ruff check .

This is especially attractive when you want to avoid littering your machine or your project with tools that are not part of your long-term workflow.

What the repository teaches

Why the python-uv Repository Does Not Treat Global Tool Installs as the Default

Here is the production correction that weaker tutorials omit: the repository pins ruff and ty as development dependencies and runs them through uv run or nox. That is the stronger choice for shared repositories because it makes version expectations part of the project rather than part of every developer's memory.

uv add --dev ruff ty
uv sync
uv run ruff check .
uv run ty check
uv run nox -s lint -- --ruff --ty

This is also consistent with the tools' own documentation. Ruff can be installed globally or added to a project, while ty explicitly recommends adding itself as a development dependency when version consistency matters.

Do not teach the weaker default as the main default A shared repository should not center a “just install the newest global tool” habit when the project itself is meant to carry the tool versions.
When uv tool is exactly right

Use It for User-Level Utilities and Cross-Project Commands

None of this makes uv tool unimportant. It remains a very good fit for utilities you want available outside any single repository, especially when you do not need the tool version pinned to a shared project.

uv tool install ruff@latest
uv tool update-shell
uv tool list

The key is conceptual honesty. User-wide tool management and project-pinned development tooling are different problems. Treating them as the same problem produces sloppy advice.

Decision table

Which Shelf Should You Reach For?

Need Better command family Why
Everyone on the project must use the same version uv add --dev + uv run The tool becomes part of the repository's declared state.
You want the command available across projects uv tool install The executable is installed user-wide and isolated from project environments.
You only need the command once uvx / uv tool run You avoid a permanent installation.
FAQ

Frequently Asked Questions

These are the practical questions that a careful reader should be able to answer before treating the workflow as production-ready.

What does uv tool install actually give me?

It gives you executable commands installed in isolated tool environments and linked into your shell's executable path.

Does uv tool install ruff make import ruff work inside my project?

No. Tool installation is about executables, not importing the package inside your current project environment.

When is uvx better than uv tool install?

When you want to run a tool once or briefly without making it part of your regular machine setup.

Why does the repository pin ruff and ty as dev dependencies?

Because a shared repository benefits from project-level version consistency more than from every contributor maintaining their own global tool state.

Is uv tool still useful in a production workflow?

Absolutely. It is useful for user-level utilities and cross-project commands. It is simply not the right default for every shared project tool.

References

References

uv tools guide

uv tools concept

Ruff installation

ty installation

python-uv README

python-uv pyproject.toml

python-uv noxfile.py

Conclusion

The decisive lesson is this: choose the installation surface that matches the social reality of the tool. Project-pinned tools belong to the project; user-wide tools belong to the machine; one-off tools belong to the moment.

Comments