๐Ÿงฉ What is UV? Link to heading

uv is a modern tool created by Astral (the creators of ruff ๐Ÿฆ€) designed to be the only manager you need in the Python ecosystem. Written in Rust, it is 10x to 100x faster than traditional tools.

โšก Why is it so fast? Link to heading

  • Global Cache: It doesn’t redownload what you already have.
  • Hardlinks: It uses physical links to avoid duplicating files on your disk.
  • Parallel Resolution: Resolves dependencies massively and efficiently.

โš™๏ธ Installation Link to heading

# macOS & Linux
curl -LsSf https://astral.sh/uv/install.sh | sh

# Windows
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"

๐Ÿ 1. Python Version Management Link to heading

Forget about pyenv or fighting with your system’s Python versions. uv downloads and manages Python versions for you.

# Install a specific version
uv python install 3.12

# List installed and available versions
uv python list

# Use a specific version for a project
uv venv --python 3.11

๐Ÿ“ฆ 2. Modern Project Workflow Link to heading

The recommended mode is to use uv as a project manager (similar to cargo or npm).

# Initialize a project
uv init my-project
cd my-project

# Add dependencies (updates pyproject.toml and uv.lock)
uv add fastapi uvicorn

# Sync the environment (installs everything missing)
uv sync

# View the dependency tree
uv tree

๐Ÿ› ๏ธ 3. Tool Management (Pipx killer) Link to heading

You can install and run CLI tools in isolation without cluttering your global environment.

# Run a tool without installing it (on-the-fly)
uvx ruff check .

# Install a tool globally
uv tool install yt-dlp
uv tool install black

# List installed tools
uv tool list

๐Ÿงช 4. Migration and Compatibility Link to heading

If you are coming from a requirements.txt based workflow:

# Install from an existing file
uv pip install -r requirements.txt

# Export your project to requirements.txt (with hashes)
uv export --format requirements-txt > requirements.txt

๐Ÿงน 5. Useful Maintenance Commands Link to heading

ActionCommand
Update UVuv self update
Clean Cacheuv cache clean
Generate Lockfileuv lock
Run Scriptuv run myscript.py
List packagesuv pip list

๐Ÿ”š Conclusion Link to heading

uv is not just an incremental improvement; it’s a paradigm shift. It centralizes the management of versions, environments, and tools into a single fast and modern interface. If you’re not using it yet, today is the best day to migrate.