uv-tool-management
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseUV Tool Management
UV 工具管理
Quick reference for installing and managing global Python tools with UV (pipx alternative).
使用 UV(pipx 的替代方案)安装和管理全局 Python 工具的快速参考。
When to Use This Skill
何时使用此 Skill
| Use this skill when... | Use a focused sibling instead when... |
|---|---|
Installing a global CLI tool (ruff, black, ipython) with | Running a project script inside its venv — use uv-run |
Running a one-off CLI invocation via | Adding the tool as a project dev dependency — use uv-project-management |
| Listing, upgrading, or uninstalling globally installed tools | Pinning the Python version a tool runs on — use uv-python-versions |
| 使用此 Skill 的场景 | 应改用专门的同级 Skill 的场景 |
|---|---|
使用 | 在项目的 venv 中运行脚本——使用 uv-run |
通过 | 将工具添加为项目开发依赖——使用 uv-project-management |
| 列出、升级或卸载全局安装的工具 | 固定工具运行所用的 Python 版本——使用 uv-python-versions |
When This Skill Applies
此 Skill 的适用场景
- Installing command-line tools globally (like pipx)
- Managing tool installations and updates
- Running tools ephemerally without installation
- Listing and removing installed tools
- Tool version management
- 全局安装命令行工具(如 pipx)
- 管理工具安装和更新
- 临时运行工具,无需安装
- 列出和移除已安装的工具
- 管理工具版本
Quick Reference
快速参考
Installing Tools
安装工具
bash
undefinedbash
undefinedInstall tool globally
Install tool globally
uv tool install ruff
uv tool install black
uv tool install pytest
uv tool install ruff
uv tool install black
uv tool install pytest
Install specific version
Install specific version
uv tool install ruff@0.1.0
uv tool install 'pytest>=7.0'
uv tool install ruff@0.1.0
uv tool install 'pytest>=7.0'
Install from Git
Install from Git
uv tool install git+https://github.com/astral-sh/ruff
uv tool install git+https://github.com/astral-sh/ruff
Install with extras
Install with extras
uv tool install 'mkdocs[i18n]'
uv tool install 'fastapi[all]'
undefineduv tool install 'mkdocs[i18n]'
uv tool install 'fastapi[all]'
undefinedRunning Tools
运行工具
bash
undefinedbash
undefinedRun without installing (ephemeral)
Run without installing (ephemeral)
uvx pycowsay "hello world"
uvx ruff check .
uvx black --check .
uvx pycowsay "hello world"
uvx ruff check .
uvx black --check .
uvx is alias for:
uvx is alias for:
uv tool run pycowsay "hello world"
uv tool run pycowsay "hello world"
Run with specific version
Run with specific version
uvx ruff@0.1.0 check .
uvx ruff@0.1.0 check .
Run from Git
Run from Git
uvx git+https://github.com/user/tool script.py
undefineduvx git+https://github.com/user/tool script.py
undefinedManaging Tools
管理工具
bash
undefinedbash
undefinedList installed tools
List installed tools
uv tool list
uv tool list
Update tool
Update tool
uv tool install ruff --reinstall
uv tool upgrade ruff
uv tool install ruff --reinstall
uv tool upgrade ruff
Remove tool
Remove tool
uv tool uninstall ruff
uv tool uninstall ruff
Remove all tools
Remove all tools
uv tool uninstall --all
undefineduv tool uninstall --all
undefinedTool Information
工具信息
bash
undefinedbash
undefinedCheck tool version
Check tool version
ruff --version
ruff --version
List tool binaries
List tool binaries
uv tool list --verbose
uv tool list --verbose
Show tool location
Show tool location
which ruff
which ruff
~/.local/bin/ruff (Linux)
~/.local/bin/ruff (Linux)
~/Library/Application Support/uv/bin/ruff (macOS)
~/Library/Application Support/uv/bin/ruff (macOS)
undefinedundefineduvx vs uv tool run
uvx 与 uv tool run 对比
These commands are equivalent:
bash
uvx ruff check .
uv tool run ruff check .uvx以下命令等价:
bash
uvx ruff check .
uv tool run ruff check .uvxInstallation Locations
安装位置
Tools Directory
工具目录
bash
undefinedbash
undefinedLinux
Linux
~/.local/share/uv/tools/
~/.local/share/uv/tools/
macOS
macOS
~/Library/Application Support/uv/tools/
~/Library/Application Support/uv/tools/
Windows
Windows
%LOCALAPPDATA%\uv\tools\
undefined%LOCALAPPDATA%\uv\tools\
undefinedBinaries (Executables)
二进制文件(可执行文件)
bash
undefinedbash
undefinedLinux
Linux
~/.local/bin/
~/.local/bin/
macOS
macOS
~/Library/Application Support/uv/bin/
~/Library/Application Support/uv/bin/
Windows
Windows
%LOCALAPPDATA%\uv\bin\
**Add to PATH:**
```bash%LOCALAPPDATA%\uv\bin\
**添加到 PATH:**
```bashAdd to ~/.bashrc or ~/.zshrc
Add to ~/.bashrc or ~/.zshrc
export PATH="$HOME/.local/bin:$PATH"
undefinedexport PATH="$HOME/.local/bin:$PATH"
undefinedCommon Tools
常用工具
bash
undefinedbash
undefinedCode quality
Code quality
uv tool install ruff
uv tool install black
uv tool install ty
uv tool install ruff
uv tool install black
uv tool install ty
Documentation
Documentation
uv tool install mkdocs
uv tool install sphinx
uv tool install mkdocs
uv tool install sphinx
Testing
Testing
uv tool install pytest
uv tool install tox
uv tool install pytest
uv tool install tox
Build tools
Build tools
uv tool install build
uv tool install twine
uv tool install build
uv tool install twine
Utilities
Utilities
uv tool install httpie
uv tool install pipx
uv tool install cookiecutter
undefineduv tool install httpie
uv tool install pipx
uv tool install cookiecutter
undefinedUV Tool vs Project Dependencies
UV Tool 与项目依赖
Use for:
uv tool- Command-line applications
- Global development tools
- Utilities used across projects
Use for:
uv add- Project-specific dependencies
- Libraries imported in code
- Development dependencies in specific projects
bash
undefined使用 :
uv tool- 命令行应用程序
- 全局开发工具
- 跨项目使用的实用工具
使用 :
uv add- 项目专用依赖
- 在代码中导入的库
- 特定项目中的开发依赖
bash
undefinedGlobal tool (any project)
Global tool (any project)
uv tool install ruff
uv tool install ruff
Project dependency (one project)
Project dependency (one project)
uv add --dev ruff
undefineduv add --dev ruff
undefinedTool Isolation
工具隔离
Each tool gets its own virtual environment:
bash
undefined每个工具都会获得独立的虚拟环境:
bash
undefinedEach tool is isolated
Each tool is isolated
~/.local/share/uv/tools/
├── ruff/ # Isolated environment for ruff
├── black/ # Isolated environment for black
└── pytest/ # Isolated environment for pytest
~/.local/share/uv/tools/
├── ruff/ # Isolated environment for ruff
├── black/ # Isolated environment for black
└── pytest/ # Isolated environment for pytest
No dependency conflicts between tools
No dependency conflicts between tools
undefinedundefinedCommon Workflows
常见工作流
Setup Development Tools
设置开发工具
bash
undefinedbash
undefinedInstall common development tools globally
Install common development tools globally
uv tool install ruff
uv tool install ty
uv tool install pytest
uv tool install ipython
uv tool install ruff
uv tool install ty
uv tool install pytest
uv tool install ipython
Now available in any project
Now available in any project
ruff check .
ty check src/
pytest
ipython
undefinedruff check .
ty check src/
pytest
ipython
undefinedOne-Off Tool Usage
一次性工具使用
bash
undefinedbash
undefinedRun without installing
Run without installing
uvx pycowsay "Temporary tool!"
uvx httpie https://api.github.com
uvx pycowsay "Temporary tool!"
uvx httpie https://api.github.com
No cleanup needed
No cleanup needed
undefinedundefinedReplace pipx
替换 pipx
bash
undefinedbash
undefinedOld (pipx)
Old (pipx)
pipx install black
pipx run pycowsay "hello"
pipx install black
pipx run pycowsay "hello"
New (uv)
New (uv)
uv tool install black
uvx pycowsay "hello"
undefineduv tool install black
uvx pycowsay "hello"
undefinedKey Features
主要功能
- Fast: 10-100x faster than pipx
- Isolated: Each tool in separate environment
- Ephemeral: Run tools without installation
- Version control: Pin tool versions
- Git support: Install from repositories
- 快速:比 pipx 快 10-100 倍
- 隔离:每个工具使用独立环境
- 临时运行:无需安装即可运行工具
- 版本管理:固定工具版本
- Git 支持:从仓库安装
See Also
相关 Skill
- - Project-specific dependencies
uv-project-management - - Python versions for tools
uv-python-versions - - Using ruff, ty, black
python-code-quality
- - 项目专用依赖
uv-project-management - - 工具所用的 Python 版本
uv-python-versions - - 使用 ruff、ty、black
python-code-quality
References
参考资料
- Official docs: https://docs.astral.sh/uv/guides/tools/
- Tool directory: Use to find cache location
uv cache dir - Detailed guide: See REFERENCE.md in this skill directory
- 官方文档:https://docs.astral.sh/uv/guides/tools/
- 工具目录:使用 查找缓存位置
uv cache dir - 详细指南:参阅此 Skill 目录中的 REFERENCE.md