uvx --from PKG CMD: run a tool whose command name differs from the package
- tool
- uv
- command
- uvx (uv tool run)
- flag
- --from PKG[SPEC], --with PKG
- default
- the package with the same name as the command
uvx ruff check downloads the package ruff into a cached, isolated environment and runs its ruff command, because uvx assumes the command and the package have the same name. When they differ, or when you need a version, extras or a Git source, name the package with --from: uvx --from httpie http example.org, uvx --from 'mypy==1.13.0' dmypy. uvx is short for uv tool run, and nothing is installed into your project or global Python.
Same name, version pin and --from
echo "--- uvx ruff@0.8.0"
uvx -q ruff@0.8.0 --version
echo "--- uvx --from ruff==0.8.0 ruff"
uvx -q --from ruff==0.8.0 ruff --version
echo "--- a command from the mypy package"
uvx -q --from mypy==1.13.0 dmypy --versionOutput
--- uvx ruff@0.8.0 ruff 0.8.0 --- uvx --from ruff==0.8.0 ruff ruff 0.8.0 --- a command from the mypy package dmypy 1.13.0
dmypy, the mypy daemon client, is a command shipped inside the mypy package; --from mypy==... tells uvx which package provides it. All three runs use cached environments, so repeating them is fast and works offline once the packages are cached.
Forms of --from
| Command | Meaning |
|---|---|
| uvx ruff | Package ruff, command ruff, latest cached or newest version |
| uvx ruff@0.8.0 | Shorthand for an exact version when the names match |
| uvx ruff@latest | Always check for the newest release |
| uvx --from 'ruff>=0.8,<0.9' ruff | Any version specifier |
| uvx --from 'mypy[reports]' mypy | Package with extras |
| uvx --from git+https://github.com/org/tool tool | Directly from a Git repository |
| uvx --from ./path/to/tool tool | From a local project |
| uvx --with plugin tool | Add more packages to the tool environment |
uvx versus uv tool install versus uv run
uvx(uv tool run) runs once in a cached environment; nothing lands onPATH.uv tool install ruffinstalls the command permanently onPATH, like pipx.uv runruns inside the project environment. Use it for tools that need to import your code, such aspytestormypywith project dependencies; add one-off packages with uv run --with.
Pitfalls
- When the command is not provided by the package, uvx says so and lists the commands the package does provide; the fix is the right
--frompackage. - Options for uvx go before the command; options after it belong to the tool (
uvx ruff check --fix). - uvx environments do not see project dependencies. A type checker run with
uvx mypycannot resolve imports of packages that only your project installs; useuv run mypyfor that. - A bare
uvx toolreuses a cached version; add@latest(or--refresh) when you need the newest release.
FAQ
Is uvx the same as uv tool run?
Yes. uvx is an alias of uv tool run with identical options. Both run the tool in a cached, isolated environment that is separate from any project.
How do I run a specific version with uvx?
Use the @ shorthand when the command and package share a name (uvx ruff@0.8.0 check), or --from with any specifier (uvx --from 'ruff==0.8.0' ruff check). uvx ruff@latest forces a check for the newest release.
How do I add a plugin to a tool run with uvx?
Use --with: uvx --with mkdocs-material mkdocs build installs the plugin into the same temporary environment as the tool.