uv Cheatsheet

uv Cheatsheet

August 26, 2025

Rodrigo’s cheatsheet is a good guide. For my purposes, I put a copy of his cheatsheet below though I don’t plan on updating it while it appears that Rodrigo will.

This cheatsheet lists the most commonly used commands and should be more than enough for you to get started using uv. For more advanced use cases, check the uv docs and its guides.

Written for uv version 0.8.15.

Creating projects 🧱

commanddescription
uv initInitialise a project in the current directory
uv init myprojInitialise a project myproj in the directory myproj
uv init --app --package ...Initialise a packageable app (e.g., CLI, web app, …)
uv init --lib --package ...Initialise a packageable library (code you import)
uv init --python 3.X ...1Use Python 3.X for your project

Managing project dependencies 🧩

commanddescription
uv add requestsAdd requests as a dependency
uv add A B CAdd AB, and C as dependencies
uv add -r requirements.txtAdd dependencies from the file requirements.txt
uv add --dev pytestAdd pytest as a development dependency
uv run pytestRun the pytest executable that is installed in your project
uv remove requestsRemove requests as a dependency
uv remove A B CRemove ABC, and their transitive dependencies
uv treeSee the project dependencies tree
uv lock --upgradeUpgrade the dependencies’ versions

Project lifecycle management 🔄

commanddescription
uv buildBuild your packageable project
uv publishPublish your packageable project to PyPI
uv versionCheck your project version
uv version --bump majorBump project major version (e.g., 0.3.2 -> 1.0.0)
uv version --bump minor --bump betaBump minor version into a beta (e.g., 1.0.0 -> 1.1.0b1 or 1.1.0b1 -> 1.1.0b2)
uv version --bump rcBump version into release candidate (e.g., 1.1.0b1 -> 1.1.0rc1 or 1.1.0rc1 -> 1.1.0rc2)
uv version --bump stableTurn into a stable version (e.g., 1.1.0rc1 -> 1.1.0)

Managing tools ⚒️

commanddescription
uv tool run pytestRun pytest in an isolated environment
uv tool run textual-demo --from textualRun the command textual-demo from the package textual
uvx ...Alias for uv tool run ...
uv tool install ruffInstall ruff in an isolated environment but make it globally available
uv tool install --with dep ...Install the given tool with extra dependencies (e.g., install a tool with its plugins)
uv tool listList all tools installed
uv tool upgrade ruffUpgrade the ruff tool
uv tool upgrade --allUpgrade all tools
uv tool uninstall ruffUninstall ruff
uv tool install -e .2Install the current packageable project in editable mode

Working with scripts 📜

commanddescription
uv init --script myscript.pyInitialise the script myscript.py
uv init --script myscript.py --python 3.XInitialise the script myscript.py and pin it to version 3.X
uv add click --script myscript.pyAdd the dependency click to the script
uv remove click --script myscript.pyRemove the dependency click from the script
uv run myscript.pyRun the script myscript.py
uv run --python 3.X myscript.pyRun the script with the given Python version
uv run --with click myscript.pyRun the script along with the click dependency

Manage Python versions 🐍

commanddescription
uv python listList Python versions you have installed and versions you can install
uv python install 3.XInstall Python 3.X
uv python uninstall 3.XUninstall Python 3.X
uv run pythonRun your default Python
uv run --python 3.X pythonRun Python 3.X
uv python upgradeUpgrade your Python versions
uv python pin 3.XPin to a specific Python version
uv python pin 3.X --globalPin globally

For old timers who don’t learn new tricks 👴👵

commanddescription
uv venv path/to/.venvCreate a virtual environment at path/to/.venv
uv pippip’s interface with uv’s speed ⚡️

Miscellaneous commands ✨

commanddescription
uv formatFormat your code with Ruff

Meta commands 🪞

commanddescription
uv help cmdSee the help for the command cmd
uv self updateUpdate uv version
uv self versionCheck uv version

  1. The --python 3.X option is transversal to almost everything in uv. 

  2. If your project provides a CLI, for example, this makes the CLI globally available on your computer. Making it editable with -e means that if you update your code, you don’t have to reinstall explicitly.