Chuyển đến nội dung
Skillpedia
Triển khai và đám mây (DevOps)41k · #6770

uv-package-manager

Skill này làm gì

uv là công cụ siêu nhanh để quản lý package và môi trường ảo trong dự án Python. Nó giúp bạn cài đặt thư viện, tổ chức phụ thuộc và đảm bảo dự án chạy nhất quán.

Khi nào nên dùng

  • ✓Khi bạn bắt đầu một dự án Python mới.
  • ✓Khi bạn cần cài đặt hoặc cập nhật thư viện Python.
  • ✓Khi bạn muốn tạo và quản lý các môi trường biệt lập cho dự án.

Liên kết skill

https://github.com/wshobson/agents/blob/main/plugins/python-development/skills/uv-package-manager/SKILL.md

Sao chép rồi dán vào AI của bạn (Claude, ChatGPT hoặc Cursor) và nhờ nó làm theo hướng dẫn.

Cách dùng

Cách dễ nhất: sao chép tin nhắn và dán vào AI của bạn. AI sẽ đọc skill và làm theo hướng dẫn.

Tin nhắn có sẵn để dán

Hãy dùng skill này để giúp tôi: https://github.com/wshobson/agents/blob/main/plugins/python-development/skills/uv-package-manager/SKILL.md Đọc tệp SKILL.md tại liên kết đó và làm theo hướng dẫn cho việc của tôi.
Bạn muốn AI tự tìm những skill như thế này?Cài MCP Skillpedia miễn phí: chỉ một dòng, và AI sẽ tìm trong 15.000+ skill trước mỗi việc.Cài đặt trong 1 phút →

Ví dụ cách nhờ AI

“Làm sao để cài đặt các thư viện 'requests' và 'pandas' cho dự án Python của tôi?”

5 skill mới mỗi tuần. Đọc chỉ 1 phút.

Cách hoạt động

uv hoạt động bằng cách thay thế các công cụ cũ hơn như pip. Nó được viết bằng ngôn ngữ nhanh hơn (Rust) và được tối ưu để cài đặt và giải quyết xung đột giữa các thư viện nhanh hơn nhiều.

Nội dung kỹ thuật (SKILL.md gốc)

Lấy nguyên văn từ GitHub, do tác giả viết bằng tiếng Anh.

UV Package Manager

Comprehensive guide to using uv, an extremely fast Python package installer and resolver written in Rust, for modern Python project management and dependency workflows.

When to Use This Skill

  • Setting up new Python projects quickly
  • Managing Python dependencies faster than pip
  • Creating and managing virtual environments
  • Installing Python interpreters
  • Resolving dependency conflicts efficiently
  • Migrating from pip/pip-tools/poetry
  • Speeding up CI/CD pipelines
  • Managing monorepo Python projects
  • Working with lockfiles for reproducible builds
  • Optimizing Docker builds with Python dependencies

Core Concepts

1. What is uv?

  • Ultra-fast package installer: 10-100x faster than pip
  • Written in Rust: Leverages Rust's performance
  • Drop-in pip replacement: Compatible with pip workflows
  • Virtual environment manager: Create and manage venvs
  • Python installer: Download and manage Python versions
  • Resolver: Advanced dependency resolution
  • Lockfile support: Reproducible installations

2. Key Features

  • Blazing fast installation speeds
  • Disk space efficient with global cache
  • Compatible with pip, pip-tools, poetry
  • Comprehensive dependency resolution
  • Cross-platform support (Linux, macOS, Windows)
  • No Python required for installation
  • Built-in virtual environment support

3. UV vs Traditional Tools

  • vs pip: 10-100x faster, better resolver
  • vs pip-tools: Faster, simpler, better UX
  • vs poetry: Faster, less opinionated, lighter
  • vs conda: Faster, Python-focused

Installation

Quick Install

# Using Homebrew (macOS or Linux)
brew install uv

# Using Cargo (if you have Rust)
cargo install --locked uv

On Windows, use WinGet:

winget install --id=astral-sh.uv -e

Use the official installation guide for other supported installation methods.

Verify Installation

uv --version
# uv 0.x.x

Quick Start

Create a New Project

# Create new project with virtual environment
uv init my-project
cd my-project

# Or create in current directory
uv init .

# Initialize creates:
# - .python-version (Python version)
# - pyproject.toml (project config)
# - README.md
# - .gitignore

Install Dependencies

# Install packages (creates venv if needed)
uv add requests pandas

# Install dev dependencies
uv add --dev pytest black ruff

# Install from requirements.txt
uv pip install -r requirements.txt

# Install from pyproject.toml
uv sync

Virtual Environment Management

Pattern 1: Creating Virtual Environments

# Create virtual environment with uv
uv venv

# Create with specific Python version
uv venv --python 3.12

# Create with custom name
uv venv my-env

# Create with system site packages
uv venv --system-site-packages

# Specify location
uv venv /path/to/venv

Pattern 2: Activating Virtual Environments

# Linux/macOS
source .venv/bin/activate

# Windows (Command Prompt)
.venv\Scripts\activate.bat

# Windows (PowerShell)
.venv\Scripts\Activate.ps1

# Or use uv run (no activation needed)
uv run python script.py
uv run pytest

Pattern 3: Using uv run

# Run Python script (auto-activates venv)
uv run python app.py

# Run installed CLI tool
uv run black .
uv run pytest

# Run with specific Python version
uv run --python 3.11 python script.py

# Pass arguments
uv run python script.py --arg value

Package Management

Pattern 4: Adding Dependencies

# Add package (adds to pyproject.toml)
uv add requests

# Add with version constraint
uv add "django>=4.0,<5.0"

# Add multiple packages
uv add numpy pandas matplotlib

# Add dev dependency
uv add --dev pytest pytest-cov

# Add optional dependency group
uv add --optional docs sphinx

# Add from git
uv add git+https://github.com/user/repo.git

# Add from git with specific ref
uv add git+https://github.com/user/repo.git@v1.0.0

# Add from local path
uv add ./local-package

# Add editable local package
uv add -e ./local-package

Pattern 5: Removing Dependencies

# Remove package
uv remove requests

# Remove dev dependency
uv remove --dev pytest

# Remove multiple packages
uv remove numpy pandas matplotlib

Pattern 6: Upgrading Dependencies

# Upgrade specific package
uv add --upgrade requests

# Upgrade all packages
uv sync --upgrade

# Upgrade package to latest

…
Câu hỏi thường gặp

Môi trường ảo là gì?

Đó giống như một hộp biệt lập cho dự án của bạn. Mọi thứ bạn cài trong đó không ảnh hưởng đến các dự án khác hay cài đặt Python chính trên máy tính, tránh xung đột.

Tại sao uv nhanh hơn pip?

uv được xây dựng từ đầu với trọng tâm là tốc độ, dùng ngôn ngữ Rust và các kỹ thuật tiên tiến để tải và sắp xếp package nhanh hơn nhiều.

Tôi có cần gỡ pip để dùng uv không?

Không, uv được thiết kế để thay thế trực tiếp. Bạn có thể dùng thay cho pip trong các tác vụ cài đặt và quản lý package.

Chi tiết

Mô tả gốc của tác giả

Master the uv package manager for fast Python dependency management, virtual environments, and modern Python project workflows. Use when setting up Python projects, managing dependencies, or optimizing Python development workflows with uv.

repo: wshobson/agents

Độ phổ biến

Sao GitHub
41k
Vị trí xếp hạng
#6770
Giấy phép
MIT
Cập nhật
15/10/2026

Skill này có hữu ích không?

0

Đăng nhập để bình chọn.

Bình luận

  • …

Thêm skill từ kho mã này

Skill tương tự