uv is a fast Python package and project manager written in Rust. Developed by Astral, it combines dependency management, virtual environments, Python version management, and command-line tool installation in one utility. It provides a unified workflow that can replace or complement tools such as pip, pipx, virtualenv, and pyenv.
Designed for both small scripts and larger applications, uv helps developers install packages, manage project dependencies, and create reproducible environments with fewer separate tools. Its optimized dependency resolver and caching system can make many operations significantly faster than traditional Python package management workflows, although actual performance depends on the project and environment.
uv uses an efficient implementation and global cache to reduce repeated downloads and package installation time. It supports dependency resolution and installation from Python package indexes, making it useful for local development and automated build pipelines.
Developers can initialize projects, add dependencies, generate lockfiles, and synchronize environments with a consistent set of commands. Lockfiles help preserve resolved dependency versions across development machines and CI/CD systems.
uv can download and manage Python installations, allowing projects to use specific interpreter versions. This is helpful when maintaining applications that depend on different Python releases.
uv can execute Python scripts with declared dependencies and run command-line tools without requiring a permanent global installation. It also offers a pip-compatible interface for common package installation workflows.
Choose an installation method that matches your operating system. The official documentation provides additional options and platform-specific instructions.
macOS and Linux:
curl -LsSf https://astral.sh/uv/install.sh | sh
Windows PowerShell:
powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex"
Install using pip:
python -m pip install uv
After installation, check the installed version:
uv --version
For security, review installer instructions and use trusted distribution channels, particularly on managed or production systems.
Start a project, add a dependency, and synchronize its environment with the following commands:
uv init my_project cd my_project uv add requests uv lock uv sync
The uv init command creates a project structure, while uv add records a dependency in the project configuration. The lock and sync commands resolve dependency versions and align the environment with the project configuration.
To run a project command inside the managed environment, use:
uv run python main.py
uv supports inline dependency metadata for standalone Python scripts. This approach is useful for automation tasks that need packages without a complete project setup.
uv add --script script.py requests uv run script.py
uv resolves the script’s declared dependencies and runs it in an appropriate environment. Review scripts and their dependencies before execution, especially when they come from an untrusted source.
Install a Python version and pin the version required by a project:
uv python install 3.11 uv python pin 3.11
You can also install a command-line tool such as Ruff using uv:
uv tool install ruff ruff --version
For temporary or on-demand tool execution, uvx provides a convenient alternative to installing a tool permanently:
uvx ruff --version
For installations managed by uv’s standalone installer, update the utility with:
uv self update
This command may not apply to installations managed through every package manager. Follow the update procedure for your original installation method when necessary.
Visit the official uv GitHub repository for source code, release notes, and installation details. Developers working with Python dependencies can also explore our guide to Gitleaks for detecting exposed secrets, which can help identify accidentally committed credentials in project repositories.
By bringing package installation, project management, Python version control, and tool execution into one interface, uv simplifies common development tasks. Its lockfile support and environment management make it a practical option for developers who want faster, more consistent Python workflows.
A data protection platform is a unified system that helps organizations discover, classify, monitor, and…
AI companies operating in or around Switzerland face a compliance challenge that most legal teams…
Two major data privacy laws now govern how organizations handle personal data across Europe; the…
This cheat sheet covers the essential Kali Linux commands every pentester and ethical hacker uses…
When I first started learning malware analysis and reverse engineering, I thought the hardest part…
Both git fetch and git pull talk to a remote repository, but they do very different things to your…