Skip to content

Picking a Python project manager: Poetry, PDM, or uv

Compare Poetry, PDM, and uv for production Python projects — lockfile shape, resolver speed, PEP 621 adherence, and the CI footprint of each tool.

The four-way choice for a new Python project — pip-tools, Poetry, PDM, or uv — looks like religion from the outside and like resolver speed plus lockfile shape from the inside. This article compares Poetry, PDM, and uv on the axes that matter when an MSP operates the resulting build pipeline: cold-cache install time, lockfile format stability, PEP 621 ([project]) adherence, and how each tool behaves inside a CI runner that rebuilds the venv on every job.

How to verify

Get versions and a sense of what’s installed on the host:

poetry --version 2>/dev/null || echo "poetry: not installed"
pdm --version   2>/dev/null || echo "pdm: not installed"
uv --version    2>/dev/null || echo "uv: not installed"
python3 -c "import sys; print(sys.version_info)"
ls pyproject.toml poetry.lock pdm.lock uv.lock 2>/dev/null

If you see two lockfiles in one repo (poetry.lock and uv.lock), one of them is stale — pick a tool and delete the other.

What’s happening

All three tools solve the same problem: turn a declarative dependency list into a reproducible set of wheels installed in a venv. They differ in three places. First, the resolver: Poetry’s pure-Python mixology-derived resolver, PDM’s similar approach, and uv’s Rust resolver built on the PubGrub algorithm. uv is between 10x and 100x faster than the other two on cold cache, and the gap widens with large dependency trees. Second, the lockfile: Poetry uses a custom TOML shape, PDM also TOML but PEP 621-aligned, and uv a TOML shape with explicit [[package]] entries that diffs cleanly in PR review. Third, the build backend: Poetry ships its own (poetry-core), PDM defaults to its own (pdm-backend) but can use any PEP 517 backend, and uv does not include a backend — it expects you to pick hatchling, setuptools, or pdm-backend in pyproject.toml.

The PEP 621 question matters because [project] is the standard metadata table that tooling outside your chosen manager (Dependabot, pip install ., IDEs) reads. Poetry stores metadata under [tool.poetry] by default and only learned [project] in 2.0; PDM and uv use [project] natively. If you need your project to be installable by a plain pip install . without the manager present, [project] is non-negotiable.

Decision

  1. Pick uv if speed is the dominant constraint. A CI job that rebuilds the venv on every push goes from 40 seconds to 2 seconds with uv on a typical Django dep tree. uv pip compile and uv pip sync are drop-in replacements for pip-tools and behave the same in scripts. uv venv && uv pip install -r requirements.txt is the minimum viable workflow:

    uv venv /opt/venvs/app --python 3.12
    uv pip install --python /opt/venvs/app/bin/python -r requirements.lock
    uv pip compile pyproject.toml -o requirements.lock --upgrade-package httpx

    Pair uv with hatchling as the build backend if you need to publish a wheel:

    [build-system]
    requires = ["hatchling"]
    build-backend = "hatchling.build"
  2. Pick Poetry if your team already runs it and the lockfile churn isn’t biting. Poetry’s UX for adding/removing deps, publishing to a private index, and managing extras is the most mature of the three. The trade-off is install speed and a lockfile format that historically changed shape between minor versions — pin Poetry itself in CI:

    pipx install poetry==2.0.1
    poetry install --sync --no-root --without dev
    poetry lock --no-update      # regenerates without bumping versions
  3. Pick PDM if you want a PEP 621-native manager with a stable lockfile and you don’t need uv-class speed. PDM is the quiet middle option: clean separation of [project] from [tool.pdm], support for PEP 582 __pypackages__ if you want to skip venvs, and a resolver that matches Poetry’s behaviour without the format churn:

    pdm install --prod --no-self
    pdm lock --update-reuse
    pdm export -o requirements.txt --without-hashes
  4. Pin the manager itself in CI. Whichever tool you choose, install it at a pinned version inside the job — never rely on the runner image’s bundled copy. For uv:

    curl -LsSf https://astral.sh/uv/0.5.0/install.sh | sh
    uv --version
  5. Commit the lockfile. All three tools generate one; all three reproduce the venv only if you check it in. Ignoring poetry.lock / pdm.lock / uv.lock is the single most common cause of “works on my machine.”

  6. Export a requirements.txt for Docker if your base image is python:3.12-slim and you don’t want to install the manager inside the image. This keeps the runtime image small:

    uv pip compile pyproject.toml -o requirements.txt
    # In Dockerfile: pip install --no-cache-dir -r requirements.txt

Common pitfalls

  • Letting Poetry resolve against PyPI in CI without --no-update — a transitive dep publishes a new release and your build differs from yesterday’s. Use poetry install --sync against the lockfile only.
  • Mixing pip install and poetry add in the same venv — pip doesn’t update the lockfile, so the next poetry install removes whatever you added.
  • Running pdm install with no --prod in production images — dev dependencies (pytest, black, mypy) ship to production by default.
  • Using uv with a system Python it didn’t install — uv python install 3.12 gives you a sandboxed interpreter under ~/.local/share/uv/python/ that’s safe to delete; mixing with apt-installed Python causes path confusion.
  • Forgetting that uv’s lockfile is markers-aware — a dep that’s sys_platform == 'linux' only locks for Linux. Run uv pip compile on the same OS your production runs.

For pinning the resolved set with pip-tools-style hashes when you stay on pip, see pip-tools and hash-pinned requirements. Stack Harbor’s managed operations practice standardises on uv for new client projects and keeps existing Poetry projects on Poetry — the migration cost rarely pays back unless CI duration is the bottleneck.