uv - Python Package Manager
Sources:
title: Contents
style: nestedList # TOC style (nestedList|inlineFirstLevel)
minLevel: 1 # Include headings from the specified level
maxLevel: 4 # Include headings up to the specified level
includeLinks: true # Make headings clickable
debugInConsole: false # Print debug info in Obsidian console
Overview
NOTE
uv is an extremely fast Python package installer and resolver, written in Rust, and designed as a drop-in replacement forÂ
pip
 andÂpip-tools
 workflows.
uv represents a milestone in our pursuit of a âCargo for Pythonâ: a comprehensive Python project and package manager thatâs fast, reliable, and easy to use.
NOTE
Highlights
- âď¸ Drop-in replacement for commonÂ
pip
,Âpip-tools
, andÂvirtualenv
 commands. - âĄď¸Â 10-100x faster thanÂ
pip
 andÂpip-tools
 (pip-compile
 andÂpip-sync
). - đž Disk-space efficient, with a global cache for dependency deduplication.
- đ Installable viaÂ
curl
,Âpip
,Âpipx
, etc. uv is a static binary that can be installed without Rust or Python. - 𧪠Tested at-scale against the top 10,000 PyPI packages.
- đĽď¸ Support for macOS, Linux, and Windows.
- 𧰠Advanced features such as dependency version overrides and alternative resolution strategies.
- âď¸Â Best-in-class error messages with a conflict-tracking resolver.
- đ¤ Support for a wide range of advancedÂ
pip
 features, including editable installs, Git dependencies, direct URL dependencies, local dependencies, constraints, source distributions, HTML and JSON indexes, and more.
Getting Started
Install:
# On macOS and Linux.
curl -LsSf https://astral.sh/uv/install.sh | sh
# On Windows.
powershell -c "irm https://astral.sh/uv/install.ps1 | iex"
# With pip.
pip install uv
# With pipx.
pipx install uv
# With Homebrew.
brew install uv
# With Pacman.
pacman -S uv
Usage
uv pip install flask # Install Flask.
uv pip install -r requirements.txt # Install from a requirements.txt file.
uv pip install -e . # Install the current project in editable mode.
uv pip install "package @ ." # Install the current project from disk.
uv pip install "flask[dotenv]" # Install Flask with "dotenv" extra.
To generate a set of locked dependencies:
uv pip compile requirements.in -o requirements.txt # Read a requirements.in file.
uv pip compile pyproject.toml -o requirements.txt # Read a pyproject.toml file.
uv pip compile setup.py -o requirements.txt # Read a setup.py file.
echo flask | uv pip compile - -o requirements.txt # Read from stdin.
uv pip freeze | uv pip compile - -o requirements.txt # Lock the current environment.
To sync a set of locked dependencies with the virtual environment:
uv pip sync requirements.txt # Install from a requirements.txt file.
uvâs pip-install
 and pip-compile
 commands support many of the same command-line arguments as existing tools, including -r requirements.txt
, -c constraints.txt
, -e .
 (for editable installs), --index-url
, and more.
See Also
Appendix
Note created on 2024-04-10 and last modified on 2024-04-10.
Backlinks
LIST FROM [[Tool - Python uv]] AND -"CHANGELOG" AND -"04-RESOURCES/Tools/Tool - Python uv"
(c) No Clocks, LLC | 2024