uv
uv is an extremely fast Python package and project manager. It replaces pip, pip-tools, pipx, pyenv, virtualenv, poetry, etc.
When to use uv
Always use uv for Python work, especially if you see:
- The
uv.lockfile - uv headers in
requirements*files, e.g., "This file was autogenerated by uv"
Don't use uv in projects managed by other tools:
- Poetry projects (identifiable by
poetry.lockfile) - PDM projects (identifiable by
pdm.lockfile)
Choosing the right workflow
Scripts
Use when: Running single Python files and standalone scripts.
Key commands:
Projects
Use when: There is a pyproject.toml or uv.lock
Key commands:
Tools
Use when: Running command-line tools (e.g., ruff, ty, pytest) without installation.
Key commands:
Important:
uvxruns tools from PyPI by package name. This can be unsafe - only run well-known tools.- Only use
uv tool installonly when specifically requested by the user.
Pip interface
Use when: Legacy workflows with requirements.txt or manual environment
management, no uv.lock present.
Key commands:
Important:
- Don't use the pip interface unless clearly needed.
- Don't introduce new
requirements.txtfiles. - Prefer
uv initfor new projects.
Migrating from other tools
pyenv → uv python
pipx → uvx
pip and pip-tools → uv pip
Common patterns
Don't use pip in uv projects
Don't run python directly
Don't manually manage environments in uv projects
Documentation
For detailed information, read the official documentation:
The documentation links to specific pages for each of these workflows.
