pdm
pdm is a modern package and project manager for Python. It uses pyproject.toml for project metadata and dependency specification. It resolves and pins versions in a lock file for reproducible installs, and can manage per-project environments.
Installation and Setup
Install it from PyPI:
Initialize a project and create pyproject.toml:
$ pdm init
Key Features
- Centralizes project metadata and dependency declarations in
pyproject.toml. - Locks resolved versions in
pdm.lockto support reproducible installs across machines and CI systems, and can opt in to the standardizedpylock.tomlformat from PEP 751. - Manages isolated project environments and retains opt-in support for PEP 582 (
__pypackages__), although PEP 582 was rejected and PDM now recommends using virtual environments. - Downloads and installs Python interpreters through the
pdm pythoncommand group, so you can set up a version that isn’t already on the machine. - Organizes dependencies into groups like
devand exports pinned requirements when you need arequirements.txtfile. - Runs tools inside the project environment via
pdm runand supports declarative scripts in[tool.pdm.scripts]. - Builds wheels and source distributions through a PEP 517–based build workflow with
pdm build.
Usage
Install a Python interpreter that isn’t on your system yet:
$ pdm python install 3.14
Create an environment and select a Python interpreter for the project:
$ pdm venv create --name py314 3.14
Add and remove dependencies:
$ pdm add "httpx>=0.25"
$ pdm remove httpx
Work with groups:
$ pdm add -G dev pytest
Lock the project:
$ pdm lock
$ pdm install # Sync env to the lockfile
$ pdm update # Refresh locked versions
Define a script inside the environment:
pyproject.toml
[tool.pdm.scripts]
tests = "pytest -q"
Run the script:
$ pdm run tests
Export pinned requirements:
$ pdm export -o requirements.txt
Or export the standardized PEP 751 lock format:
$ pdm export -f pylock -o pylock.toml
Build distributable artifacts:
$ pdm build
Related Resources
Tutorial
Tool-Agnostic Python Lock Files With PEP 751 and pylock.toml
Learn how PEP 751 standardizes Python lock files with pylock.toml: generate one with pip or uv, install it with uv or pdm, and retire requirements.txt.
For additional information on related topics, take a look at the following resources:
- How to Manage Python Projects With pyproject.toml (Tutorial)
- Everyday Project Packaging With pyproject.toml (Course)
- Dependency Management With Python Poetry (Tutorial)
- uv vs pip: Managing Python Packages and Dependencies (Tutorial)
- Using Python's pip to Manage Your Projects' Dependencies (Tutorial)
- uv vs pip: Python Packaging and Dependency Management (Course)
- Tool-Agnostic Python Lock Files With PEP 751 and pylock.toml (Quiz)
- How to Manage Python Projects With pyproject.toml (Quiz)
- Managing Dependencies With Python Poetry (Course)
- Dependency Management With Python Poetry (Quiz)
- uv vs pip: Managing Python Packages and Dependencies (Quiz)
- A Beginner's Guide to pip (Course)
- Using Python's pip to Manage Your Projects' Dependencies (Quiz)
Have a question about this? Mentor AI can show you examples, compare related terms, and point you to tutorials.
By Leodanis Pozo Ramos • Updated Oct. 31, 2026