Skip to content

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:

Language: Windows PowerShell
(venv) PS> py -m pip install pdm
Language: Shell
(venv) $ python -m pip install pdm

Initialize a project and create pyproject.toml:

Language: Shell
$ pdm init

Key Features

  • Centralizes project metadata and dependency declarations in pyproject.toml.
  • Locks resolved versions in pdm.lock to support reproducible installs across machines and CI systems, and can opt in to the standardized pylock.toml format 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 python command group, so you can set up a version that isn’t already on the machine.
  • Organizes dependencies into groups like dev and exports pinned requirements when you need a requirements.txt file.
  • Runs tools inside the project environment via pdm run and supports declarative scripts in [tool.pdm.scripts].
  • Builds wheels and source distributions through a PEP 517–based build workflow with pdm build.

Usage

Create an environment and select a Python interpreter for the project:

Language: Shell
$ pdm venv create -n py314

Install a Python interpreter that isn’t on your system yet:

Language: Shell
$ pdm python install 3.14

Add and remove dependencies:

Language: Shell
$ pdm add "httpx>=0.25"
$ pdm remove httpx

Work with groups:

Language: Shell
$ pdm add -G dev pytest

Lock the project:

Language: Shell
$ pdm lock
$ pdm install # Sync env to the lockfile
$ pdm update  # Refresh locked versions

Define a script inside the environment:

Language: TOML Filename: pyproject.toml
[tool.pdm.scripts]
tests = "pytest -q"

Run the script:

Language: Shell
$ pdm run tests

Export pinned requirements:

Language: Shell
$ pdm export -o requirements.txt

Or export the standardized PEP 751 lock format:

Language: Shell
$ pdm export -f pylock -o pylock.toml

Build distributable artifacts:

Language: Shell
$ pdm build
How to Manage Python Projects With pyproject.toml

Tutorial

How to Manage Python Projects With pyproject.toml

Learn how to manage Python projects with the pyproject.toml configuration file. In this tutorial, you'll explore key use cases of the pyproject.toml file, including configuring your build, installing your package locally, managing dependencies, and publishing your package to PyPI.

intermediate tools

For additional information on related topics, take a look at the following resources:


By Leodanis Pozo Ramos • Updated Sept. 4, 2026