Skip to content
PDM logo

Introduction#

PDM, as described, is a modern Python package and dependency manager supporting the latest PEP standards. But it is more than a package manager. It boosts your development workflow in various aspects.

Feature highlights#

  • Simple and fast dependency resolver, mainly for large binary distributions.
  • A PEP 517 build backend.
  • PEP 621 project metadata.
  • Flexible and powerful plug-in system.
  • Versatile user scripts.
  • Install Pythons using indygreg's python-build-standalone.
  • Opt-in centralized installation cache like pnpm.

Installation#

PDM requires Python 3.9+ to be installed. It works on multiple platforms including Windows, Linux and macOS.

Note

You can still have your project working on lower Python versions, read how to do it here.

Note

Alternatively, you can download the standalone binary file from the release assets.

Install the prebuilt binary directly with the installer scripts.

1
curl -sSL https://pdm-project.org/install.sh | bash 

To install a specific version:

1
curl -sSL https://pdm-project.org/install.sh | bash -s -- -v <version> 
1
powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install.ps1 | iex" 

To install a specific version:

1
powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install.ps1 | iex -Args '-v <version>'" 

Install via Python script#

PDM requires python version 3.9 or higher.

Like Pip, PDM provides an installation script that will install PDM into an isolated environment.

1
curl -sSL https://pdm-project.org/install-pdm.py | python3 - 
1
powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | py -" 

Note

On Windows, if you do not have the optional py launcher installed (including if you installed Python through the Microsoft store), replace py with python.

For security reasons, you should verify the checksum of install-pdm.py. It can be downloaded from install-pdm.py.sha256.

For example, on Linux/Mac:

1 2 3 4
curl -sSLO https://pdm-project.org/install-pdm.py curl -sSL https://pdm-project.org/install-pdm.py.sha256 | shasum -a 256 -c - # Run the installer python3 install-pdm.py [options] 

The installer will install PDM into the user site and the location depends on the system:

  • $HOME/.local/bin for Unix
  • $HOME/Library/Python/<version>/bin for MacOS
  • %APPDATA%\Python\Scripts on Windows

You can pass additional options to the script to control how PDM is installed:

 1  2  3  4  5  6  7  8  9 10
usage: install-pdm.py [-h] [-v VERSION] [--prerelease] [--remove] [-p PATH] [-d DEP] optional arguments:  -h, --help show this help message and exit  -v VERSION, --version VERSION | envvar: PDM_VERSION  Specify the version to be installed, or HEAD to install from the main branch  --prerelease | envvar: PDM_PRERELEASE Allow prereleases to be installed  --remove | envvar: PDM_REMOVE Remove the PDM installation  -p PATH, --path PATH | envvar: PDM_HOME Specify the location to install PDM  -d DEP, --dep DEP | envvar: PDM_DEPS Specify additional dependencies, can be given multiple times 

You can either pass the options after the script or set the env var value.

Other installation methods#

1
brew install pdm 
1 2
scoop bucket add frostming https://github.com/frostming/scoop-frostming.git scoop install pdm 
1
uv tool install pdm 
1
pipx install pdm 

Install the head version of GitHub repository. Make sure you have installed Git LFS on your system.

1
pipx install git+https://github.com/pdm-project/pdm.git@main#egg=pdm 

To install PDM with all features:

1
pipx install pdm[all] 

See also: https://pypa.github.io/pipx/

1
pip install --user pdm 

Assuming you have asdf installed.

1 2 3
asdf plugin add pdm asdf install pdm latest asdf local pdm latest 

By copying the Pyprojectx wrapper scripts to a project, you can install PDM as (npm-style) dev dependency inside that project. This allows different projects/branches to use different PDM versions.

To initialize a new or existing project, cd into the project folder and:

1 2
curl -LO https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip && unzip wrappers.zip && rm -f wrappers.zip ./pw --add pdm 
1 2
Invoke-WebRequest https://github.com/pyprojectx/pyprojectx/releases/latest/download/wrappers.zip -OutFile wrappers.zip; Expand-Archive -Path wrappers.zip -DestinationPath .; Remove-Item -Path wrappers.zip .\pw --add pdm 

When installing pdm with this method, you need to run all pdm commands through the pw wrapper:

1
./pw pdm install 

Update the PDM version#

1
pdm self update 

Uninstallation#

If you need to remove PDM from your system, you can use the following script:

1
curl -sSL https://pdm-project.org/install-pdm.py | python3 - --remove 
1
powershell -ExecutionPolicy ByPass -c "irm https://pdm-project.org/install-pdm.py | py - --remove" 

If you installed PDM using a third-party package management tool like Homebrew, you can also uninstall PDM using the tool's uninstall method, such as brew uninstall pdm.

Packaging Status#

Packaging status

Shell Completion#

PDM supports generating completion scripts for Bash, Zsh, Fish or Powershell. Here are some common locations for each shell:

1 2
pdm completion bash > /etc/bash_completion.d/pdm.bash-completion # Requires root (sudo). For an alternative, see next pdm completion bash > ~/.bash_completion # Does not require root (sudo). Installed only for your user account 
1 2
# Make sure ~/.zfunc is added to fpath, before compinit. pdm completion zsh > ~/.zfunc/_pdm 

Oh-My-Zsh:

1 2
mkdir $ZSH_CUSTOM/plugins/pdm pdm completion zsh > $ZSH_CUSTOM/plugins/pdm/_pdm 

Then make sure pdm plugin is enabled in ~/.zshrc

1
pdm completion fish > ~/.config/fish/completions/pdm.fish 
 1  2  3  4  5  6  7  8  9 10
# Create a directory to store completion scripts mkdir $PROFILE\..\Completions echo @' Get-ChildItem "$PROFILE\..\Completions\" | ForEach-Object {  . $_.FullName } '@ | Out-File -Append -Encoding utf8 $PROFILE # Generate script Set-ExecutionPolicy Unrestricted -Scope CurrentUser pdm completion powershell | Out-File -Encoding utf8 $PROFILE\..\Completions\pdm_completion.ps1 

Virtualenv and PEP 582#

PDM offers experimental support for PEP 582 as an opt-in feature, in addition to virtualenv management. Although the Python Steering Council has rejected PEP 582, you can still test it out using PDM.

To learn more about the two modes, refer to the relevant chapters on Working with virtualenv and Working with PEP 582.

PDM Eco-system#

Awesome PDM is a curated list of awesome PDM plugins and resources.

Sponsors#