uv run, and tracked in a lock file that makes the whole setup reproducible from a single command. This page walks you through everything you need to know to manage environments and packages the uv way.
Creating a new project
Start every new project withuv init. This creates a ready-to-use project structure in seconds:
The
.venv folder and uv.lock file do not exist yet — they are created automatically the first time you run uv add to install a package.Understanding pyproject.toml
pyproject.toml is the modern standard for Python project configuration. It replaces requirements.txt, setup.py, setup.cfg, and other legacy files with a single, well-structured file:
dependencies list updates automatically. You commit this file to version control so your team always knows what the project needs.
Adding packages
Install packages withuv add:
uv add requests pandas numpy, your pyproject.toml updates automatically:
.venv/— the virtual environment with all packages installeduv.lock— the lock file with exact versions of every package and dependency
The lock file
uv.lock is one of uv’s most valuable features. It records the precise version of every package in your project — including the dependencies of your dependencies — so that uv sync always produces an identical environment:
uv.lock to version control. Anyone who clones your repository can run uv sync and get an environment that matches yours exactly.
Running your code
With uv, you have three ways to execute Python:Removing and updating packages
Reproducing an environment
When you clone a project that uses uv, get it running with a single command:uv.lock, creates .venv, and installs every package at the exact pinned version. No need to manually create a virtual environment or figure out which packages to install.
Working with existing pip projects
If you are migrating a project that usesrequirements.txt:
Common uv commands reference
Complete project setup
Walk through a complete end-to-end project setup with uv, Git, and GitHub.