ScriptsApr 19, 2026·3 min read

PDM — Modern Python Package and Dependency Manager

PDM is a Python package and dependency manager that supports PEP 582 and PEP 621 standards, offering fast resolution, lockfiles, and build backends without requiring virtualenvs.

Introduction

PDM is a modern Python package manager created by Frost Ming. It follows PEP 621 for project metadata in pyproject.toml and optionally supports PEP 582 for local package installation without virtual environments. PDM provides fast dependency resolution, cross-platform lockfiles, and a flexible build backend system.

What PDM Does

  • Resolves and installs Python dependencies with a fast resolver
  • Generates reproducible cross-platform lockfiles (pdm.lock)
  • Manages virtual environments automatically or uses PEP 582 local packages
  • Supports multiple Python versions and allows switching between them
  • Builds and publishes packages to PyPI with pluggable build backends

Architecture Overview

PDM's resolver uses a backtracking algorithm that evaluates dependency constraints across all transitive packages. It writes a lockfile with pinned versions, hashes, and platform markers. At install time, it reads the lockfile, downloads wheels in parallel, and installs them into either a virtual environment or a __pypackages__ directory (PEP 582). The CLI is plugin-extensible, and the build system delegates to any PEP 517-compatible backend.

Self-Hosting & Configuration

  • Install via pip, pipx, Homebrew, or the official installer script
  • Project configuration uses standard pyproject.toml with [project] and [tool.pdm] sections
  • Python interpreter selection via pdm use or .python-version file
  • Lockfile strategy is configurable: cross-platform (default) or platform-specific
  • CI integration via pdm install --frozen-lockfile for deterministic builds

Key Features

  • PEP 621 compliance: standard [project] table for metadata instead of proprietary formats
  • Dependency groups for dev, test, and optional extras with fine-grained control
  • Script runner (pdm run) with custom script definitions in pyproject.toml
  • Plugin system for extending commands, resolvers, and installers
  • Centralized package cache to save disk space across projects

Comparison with Similar Tools

  • pip — basic installer without lockfiles or resolver guarantees; PDM adds resolution and lockfiles
  • Poetry — similar feature set but uses non-standard [tool.poetry] metadata; PDM follows PEP 621
  • uv — ultra-fast Rust-based installer; PDM is pure Python with a broader feature scope
  • Hatch — focuses on project lifecycle and environments; PDM emphasizes dependency resolution
  • Pipenv — Pipfile-based with slower resolution; PDM is faster and standards-compliant

FAQ

Q: Does PDM require virtual environments? A: No. PDM can use virtual environments (the default) or PEP 582's __pypackages__ directory for project-local installs without virtualenv activation.

Q: Can I migrate from Poetry to PDM? A: Yes. PDM can import pyproject.toml files from Poetry and convert the metadata to PEP 621 format with pdm import.

Q: Does PDM support monorepos? A: Yes. PDM supports workspace-style monorepos with shared lockfiles and cross-project dependencies.

Q: How does PDM handle Python version management? A: PDM detects available Python interpreters and lets you switch with pdm use. It does not install Python versions itself—pair it with pyenv or mise for that.

Sources

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.

Related Assets