Skip to content

Repository files navigation

⚡ Learn UV Fast

Install, set up a project, manage environments, and ship — all with UV.
Built with ❤️ using Astral’s ultra-fast Python project manager.

Built with UV

🧠 What is UV?

UV is a blazing-fast Python package and project manager by Astral.
It unifies Python installation, virtual environments, dependency management, and task running — all in one sleek CLI tool.

✨ Features

  • Ultra-fast installs and dependency resolution
  • 🧩 Manages Python versions and environments together
  • 🔧 Drop-in commands for everyday workflows
  • 🧰 Cross-platform (macOS, Linux, Windows)

🚀 Installation

🐧 macOS & Linux

curl -LsSf https://astral.sh/uv/install.sh | sh

🪟 Windows (PowerShell)

iwr https://astral.sh/uv/install.ps1 -UseBasicParsing | iex

✅ Verify Installation

uv --version

💡 If uv isn’t found, open a new terminal or add UV’s bin path to your PATH.

🐍 Manage Python Versions

uv python list               
uv python install 3.12      
uv python run -p 3.12 

UV manages Python itself, so no need for pyenv or conda!

🏗️ Start a New Project

mkdir hello-uv && cd hello-uv
uv init

This creates a pyproject.toml and initializes your workspace.

uv venv          # create .venv
uv sync          # lock and install dependencies

📦 Add Dependencies

uv add requests
uv add fastapi uvicorn

View dependency tree:

uv tree

▶️ Run Code & Tools

UV runs commands in the correct virtual environment automatically.

uv run python main.py

Define Scripts in pyproject.toml

[project.scripts] start = "main:main"

uv pip install -e .

Then run:

uv run start

🔒 Locking & Reproducibility

uv lock
uv sync

Export requirements for non-UV tools:

uv export -o requirements.txt

🌱 Virtual Environments

uv venv
uv venv --python 3.11

🧭 Cheat Sheet

🧩 Category 🔧 Command 📝 Description
Project uv init Initialize project
uv add <pkg> Add dependency
uv sync [--frozen] Sync dependencies
Python uv python list List interpreters
uv python install <ver> Install Python
Env uv venv Create virtualenv
uv run <cmd> Run command in env
Inspect uv tree Show dependency tree
uv cache clean Clear cache
Export uv export -o requirements.txt Export requirements

🩺 Troubleshooting

⚠️ Issue 💡 Solution
uv: command not found Open new shell or add to PATH
SSL / network errors Retry with stable connection or proxy config
Build failures Install compiler tools and Python headers

About

uv-package-manager

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages