技能 uv-package-manager
📦

uv-package-manager

安全

精通 uv 包管理器

也可从以下获取: wshobson,ActiveInferenceInstitute

uv 是一个用 Rust 编写的超高速 Python 包管理器。此技能可帮助您设置项目、管理依赖项,并借助 uv 的极速性能优化 Python 工作流程。

支持: Claude Codex Code(CC)
📊 71 充足
1

下载技能 ZIP

2

在 Claude 中上传

前往 设置 → 功能 → 技能 → 上传技能

3

开启并开始使用

测试它

正在使用“uv-package-manager”。 使用 uv 初始化新的 Python 项目

预期结果:

Run: uv init my-project
This creates: pyproject.toml, .python-version, README.md, .gitignore
Then: cd my-project
Then: uv add requests pandas

正在使用“uv-package-manager”。 使用 uv 设置快速 CI/CD

预期结果:

Use: uv sync --frozen for exact reproducible installs
Enable caching with: enable-cache: true in GitHub Actions
Install Python: uv python install 3.12

安全审计

安全
v1 • 2/25/2026

This skill is a documentation and guide for the legitimate uv Python package manager. The static analysis flagged 103 potential issues, but upon evaluation, all findings are false positives. The detected patterns (external commands, network URLs, filesystem access) are bash code examples within markdown documentation blocks, not executable code. The skill provides educational content about uv installation and usage - a trusted tool from Astral. No malicious intent detected.

2
已扫描文件
871
分析行数
4
发现项
1
审计总数

高风险问题 (1)

Pipe to Shell Pattern
Installation command uses pipe to shell pattern: `curl -LsSf https://astral.sh/uv/install.sh | sh`. This is the official, recommended installation method from Astral (the creators of uv). While this pattern is flagged by static analyzers, it is a known and accepted pattern for installing development tools from trusted sources.
中风险问题 (3)
Shell Command Examples in Documentation
Static scanner detected 77 instances of shell command patterns (backticks) in documentation. These are example commands in markdown code blocks for educational purposes, not executable code. Examples include `uv add`, `uv sync`, `uv venv` - all legitimate uv commands shown as documentation.
Hardcoded URLs in Documentation
URLs detected in documentation point to legitimate uv resources: astral.sh (official site), github.com/astral-sh/uv (official repo), docs.astral.sh (documentation). These are appropriate references for a documentation skill.
Filesystem References in Documentation
References to filesystem paths like .venv, .gitignore, .python-version, and cache directories (~/.cache/uv) are standard Python project files managed by uv. These are documented for educational purposes.
审计者: claude

质量评分

38
架构
100
可维护性
87
内容
50
社区
80
安全
100
规范符合性

你能构建什么

快速 Python 项目设置

在几秒而非几分钟内快速初始化新的 Python 项目(含虚拟环境)、安装依赖项并开始编码。

规模化依赖项管理

管理复杂的依赖关系树、解决冲突,并通过锁文件为生产项目维护可复现构建。

CI/CD 流水线优化

通过使用 uv 进行更快的依赖项安装和缓存构建来加速 CI/CD 流水线。

试试这些提示

安装 uv 并创建项目
Help me install uv package manager and create a new Python project with a virtual environment.
添加依赖项
Show me how to add dependencies to my Python project using uv. I want to add requests, pandas, and pytest.
设置锁文件
Explain how to use uv lockfiles for reproducible builds and how to integrate them in CI/CD.
Docker 集成
Show me how to optimize a Python Docker image using uv for faster builds and smaller images.

最佳实践

  • 在生产环境中始终使用锁文件 (uv.lock) 以实现可复现构建
  • 使用 .python-version 文件固定 Python 版本以保持一致性
  • 使用 'uv run' 而非手动激活虚拟环境

避免

  • 不要在生产环境中跳过锁文件——它们确保确定性构建
  • 避免在 Docker 构建中通过 pip 安装 uv——应使用官方安装程序
  • 不要忽略 Python 版本兼容性——显式固定版本

常见问题

什么是 uv?为什么它比 pip 更快?
uv 使用 Rust 编写,采用并行依赖解析。它在全局缓存包并并行安装,因此速度比 pip 快 10-100 倍。
使用 uv 需要先安装 Python 吗?
不需要,uv 可以自行安装并管理 Python 版本,无需预先安装 Python。这使其非常适合新项目设置。
如何从 pip 迁移到 uv?
运行 'uv add -r requirements.txt' 可转换现有依赖,或者如果您已有 pyproject.toml,直接使用 'uv sync'。uv 与 pip 工作流程兼容。
什么是锁文件?为什么要使用它们?
锁文件 (uv.lock) 记录已安装的确切依赖版本。这确保每个环境使用相同的包版本,防止「在我机器上能跑」的问题。
uv 可以与 Docker 配合使用吗?
可以,uv 非常适合 Docker。使用多阶段构建配合 'COPY --from=ghcr.io/astral-sh/uv:latest' 可实现快速、缓���的依赖安装。
uv 在生产环境中使用安全吗?
可以,uv 由 Astral(Ruff 的创建者)积极维护,并被许多项目用于生产环境。它支持签名包和哈希验证。