less than 1 minute read

uv is a fast package and program manager for Python. It’s a drop-in replacement for pip and virtualenv, written in Rust.

Installation

Using Homebrew (on mac):

brew install uv

Basic Commands

Create a virtual environment

uv venv

Activate the virtual environment

source .venv/bin/activate

To install the latest Python version

uv python install

Install a specific version of Python

uv python install 3.8

Reinstall uv-managed Python versions

uv python install --reinstall

List all installed Python versions

uv python list 

Uninstallation

Cleanup stored data

uv cache clean
rm -r "$(uv python dir)"
rm -r "$(uv tool dir)"

Remove the uv and uvx binaries

rm ~/.local/bin/uv ~/.local/bin/uvx

Scripts

Run a script

uv run

Add a dependency to a script

uv add --script

Remove a dependency from a script

uv remove --script

Projects

Add a dependency to a project

uv add

Remove a dependency from a project

uv remove

Sync the project’s dependencies

uv sync

Create a lockfile for the project’s dependencies

uv lock

Run a command in the project’s environment

uv run

View the dependency tree for the project

uv tree

Build the project into distribution archives.

uv build

Publish the project to a package index

uv publish