Comparing Python package managers
Comparison Link to heading
Tool | Lock file | Manage Python versions | Global cache | PEP compliant | Packaging/PyPI distribution |
---|---|---|---|---|---|
Hatch | ❌ | ✅ | ✅ | ✔️ only using Hatch build backend | |
pip | ❌ | ❌ | ✅ | ||
Pipenv | ✅ | ❌ | ❌ | ||
PDM | ✅ | ✅ | ✅ | ✅ | ✅ |
Poetry | ✅ | ❌ | ❌ | ✔️ only using Poetry build backend | |
uv | ✅ | ✅ | ✅ | ✅ | ✅ |
uv Link to heading
Pros Link to heading
- uv can install and manage Python version (like pyenv); Poetry can’t
- uv manages dependencies and environments for single-file scripts
uv add --script <my-script> <package> && uv run <my-script>
- That’s cool, I never seen that in other Python tools
- Disk-space efficient; global cache for dependency deduplication
- I don’t know how other tools manage that. It would be interesting to compare with Poetry
- Drop-in replacement for
pip
alias pip='uv pip'
How to use Link to heading
Installing Link to heading
pipx install uv
to install uv
Managing Python versions Link to heading
uv python install <version>
to install a Python versionuv run --python <version> -- <command>
to run a command with a specific Python version
Tools Link to heading
uvx
(alias foruv tool run
) same aspipx
Runnig scripts Link to heading
uv add --script <my-script> <package>
to install a package to one script.
PDM Link to heading
Poetry Link to heading
Pros Link to heading
- lock file
Cons Link to heading
- “does not follow the standard specifying how metadata should be represented
in a pyproject.toml file (PEP 621), instead using a custom
[tool.poetry]
table. This is partly because Poetry came out before PEP 621.”
References Link to heading
- Codebeez | uv as a poetry/pyenv/pipx replacement
- Hatch | docs
- Loopwerk: Poetry versus uv
- Loopwerk: Revisiting uv
- PEP 517 – A build-system independent format for source trees
- PEP 518 – Specifying Minimum Build System Requirements for Python Projects
- PEP 621 – Storing project metadata in pyproject.toml
- PDM | README - Comparisons to other alternatives
- pyproject.toml specification
- uv | docs
- uv | Publishing packages
- uv | Unified Python packaging