Uv
lastmod 2026-01-19created 2016-06-3017 edits
(For the asynchronous library written in C, see libuv)
An extremely fast Python packaging tool written in Rust
Features
- The uv package manager and PEP 723 make it possible to run Python scripts without dependency problems
- The uvx feature automatically creates disposable virtual environments, removing the hassle of environment setup
- Including PEP 723 metadata in a Python file makes automatic script execution and package management convenient
- As an example script, a YouTube subtitle extraction program can be quickly built and distributed
- This means Python can now also be written as concise single executable files, greatly improving the usefulness of scripts
Install
Usage
# 프로젝트 초기화 / Project initialization
uv init my-project
uv init # 현재 디렉토리에서 초기화
# 가상 환경 생성 / Create virtual environment
uv venv
uv venv --python 3.12
# 패키지 추가/제거 / Add/remove packages
uv add requests
uv add flask django
uv remove requests
# 의존성 동기화 / Sync dependencies
uv sync
uv sync --frozen # lockfile 기준으로만 설치
# 프로젝트 실행 / Run project
uv run python script.py
uv run pytest
uv run --with additional-package python main.py
# 도구 실행 / Run tools
uvx ruff check .
uvx black .
uv tool run cowsay "Hello"
uv tool install ruff
# 잠금 파일 업데이트 / Update lockfile
uv lock
uv lock --upgrade
# Python 버전 관리 / Python version management
uv python install 3.12
uv python list
Uv's killer feature is making ad-hoc environments easy
Performance and compatibility with Python are not what set uv apart. uv complies with the PEPs and is worth recommending as a Python package manager. But its most surprising feature is something else.
- When doing ad-hoc scripting in Python 3.12, you often need to add a dependency like Pandas. The usual ways are:
- Run
pip install pandasand modify the global environment, or - Create a virtual environment, run
pip install pandas, activate the virtual environment, and then run Python.
- Run
-
pyenv install 3.12 -
pyenv local 3.12 -
python -m venv .venv -
source .venv/bin/activate -
pip install pandas -
python
-
uv run --python 3.12 --with pandas python - Easy to remember and leaves no trace. Happy scripting!
Hacker News comments
- Uv's killer feature is making ad-hoc environments easy | Hacker News
- Some really like the uv package manager and hope it becomes the community standard. It's an especially good tool to recommend to new users
- uv supports inline script dependencies from PEP 723, allowing even cleaner usage
- As a NodeJS developer, it's surprising that Python's environment setup problems still haven't been solved. Node isn't perfect either, but there's no worry about modifying the global environment
- No need to activate virtualenv, and you can create virtual environments directly without setting up a pyenv interpreter
- Some find it inconvenient that several features are bundled into uv's single-tool execution. Being able to activate a venv and run programs multiple times is convenient
- uv includes the uvx command, which can run Python scripts without manual installation
- e.g.
uvx --from 'huggingface_hub[cli]' huggingface-cli
- e.g.
See also
- Rust
- ruff - A fast Python linter written in Rust
- Uv - An extremely fast Python packaging tool written in Rust
- PubGrub
Favorite site
- uv: Python packaging in Rust
- Uv - An extremely fast Python packaging tool written in Rust | GeekNews
- 04.00. uv - The only tool you need to manage Python - Modern Python Programming
- Python: EP122 - Let's learn about the insanely fast uv - YouTube
- Guide to using UV as a replacement for PIP
Articles
- [Original] Switching pip to uv in a Dockerized Flask / Django App — Nick Janetakis
- Switching to uv makes Python dependency installation about 10x faster than pip, and it can run as a non-root user without a separate venv
- With pyproject.toml, you only declare top-level dependencies and uv manages the lock file automatically; its dependency tree and exact version management are better than pip freeze
- The Dockerfile needs step-by-step changes, such as copying the uv and uvx binaries, using pyproject.toml/uv.lock files, and setting environment variables
- Commands like uv sync/add/remove and uv:outdated make it easy to add, remove, and update dependencies, check for the latest package versions, and more
- Regular lock file management and dependency updates help ensure consistency in collaboration and deployment environments
- [Original] uv: Making Python Local Workflows FAST and BORING in 2025 - YouTube
- Using the core uv commands
-
uv run: Runs commands like pytest or fastapi inside the virtual environment, using the dependencies defined in pyproject.toml and pinned in the uv.lock file. -
uv add: Adds a new dependency to pyproject.toml and automatically updates the uv.lock file. -
uv run --with: Temporarily injects development helper modules like pdbpp without adding them to the project's core dependencies. -
uv lock --upgrade: Updates the dependency lock file very quickly. uv run automatically detects a changed lock file at run time and syncs the environment.
-
- Standardizing repetitive tasks as recipes with a justfile
- Integrating just with uv
- Managing virtual environments directly (optional workflow)
- Using the core uv commands
- [Original] Running scripts | uv
- uv automates dependency management when running Python scripts
- An environment is automatically created and maintained per script, without separate virtual environment management
- Required packages can be declared in various ways, such as inline metadata or command-line options
- The Python version and package management can also be declared and automatically adjusted per script
- Lock files and dependency version constraint options improve reproducibility and maintainability
- [Original] How uv got so fast | Andrew Nesbitt
- The Python package manager uv installs more than 10x faster than pip, and this comes from design choices rather than simply from being written in Rust
- The key to the speed is the static metadata standards (PEP 518, 517, 621, 658), which make it possible to determine dependencies without running code
- uv boldly drops legacy features that pip maintains (.egg, pip.conf, system Python installs, etc.), eliminating unnecessary code paths
- Rust's contributions, such as zero-copy deserialization, lock-free concurrency, and the single-binary structure, account for only part of the overall speedup
- Overall, the uv case shows that standardized metadata and dropping unnecessary compatibility are the key to performance breakthroughs
Pages that link here