Comparing Python package managers

Comparison Link to heading

ToolLock fileManage Python versionsGlobal cachePEP compliantPackaging/PyPI distribution
Hatch✔️ only using Hatch build backend
pip
Pipenv
PDM
Poetry✔️ only using Poetry build backend
uv

uv Link to heading

GitHub | Docs

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 version
  • uv run --python <version> -- <command> to run a command with a specific Python version
Tools Link to heading
  • uvx (alias for uv tool run) same as pipx
Runnig scripts Link to heading
  • uv add --script <my-script> <package> to install a package to one script.

PDM Link to heading

GitHub | Docs

Poetry Link to heading

GitHub | Docs

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