LinuxCommandLibrary
GitHubF-DroidGoogle Play Store

pdm

python package manager following PEP standards

TLDR

Initialize a new project
$ pdm init
copy
Add a dependency
$ pdm add [requests]
copy
Add a development dependency
$ pdm add -d [pytest]
copy
Install all dependencies
$ pdm install
copy
Update dependencies
$ pdm update
copy
Run a command in environment
$ pdm run [python] [script.py]
copy
List installed packages
$ pdm list
copy
Build package
$ pdm build
copy

SYNOPSIS

pdm command [options] [args...]

DESCRIPTION

pdm is a Python package manager following PEP standards. It manages dependencies, virtual environments, and builds using pyproject.toml.pdm init creates a new project with pyproject.toml. It detects or creates a Python interpreter and optionally initializes a virtual environment.Dependencies are declared in pyproject.toml and locked in pdm.lock. add modifies both; install reads the lock file. Dependency groups separate dev, test, and optional dependencies.PDM historically supported PEP 582 (_pypackages) as an alternative to virtual environments, but PEP 582 was rejected in 2023; modern PDM defaults to virtualenvs. Local-package mode can still be enabled with **pdm config python.usevenv false** for users who prefer it.pdm run executes commands with the project environment active. Scripts defined in pyproject.toml under [tool.pdm.scripts] provide shortcuts.Build and publish follow PEP 517/518. pdm build creates wheels and sdists; pdm publish uploads to PyPI.

PARAMETERS

-d, --dev

Development dependency.
-G, --group name
Dependency group.
-L, --lockfile file
Custom lock file path.
--no-sync
Don't sync after adding.
--no-lock
Skip lock file update.
--prod, --production
Exclude dev dependencies.
-p, --project path
Project directory.
-v, --verbose
Increase verbosity.
-q, --quiet
Suppress output.

COMMANDS

init

Create new project with pyproject.toml.
add packages
Add dependencies.
remove packages
Remove dependencies.
install
Install dependencies from lock file.
update [packages]
Update dependencies.
lock
Generate or update lock file.
sync
Sync packages with lock file.
run command
Run command in project environment.
list
List installed packages.
build
Build distribution packages.
publish
Publish to PyPI.
use python
Switch the project's Python interpreter.
venv create|list|remove|activate
Manage virtual environments for the project.
info
Show project, environment, and Python interpreter information.
cache clear|list|info
Inspect or clear the package cache.
config key [value]
Get or set a PDM configuration option.

CAVEATS

PEP 582 support varies by Python version and tools. Some older packages may not work with new standards. Lock file format is PDM-specific. Requires Python 3.8+.

HISTORY

PDM was created by Frost Ming and first released in 2019. It pioneered PEP 582 support and modern Python packaging standards. The project emphasizes standards compliance (PEP 517, 518, 621) over custom formats. PDM gained popularity as an alternative to pip, Poetry, and pipenv with its focus on PEP standards and performance.

SEE ALSO

pip(1), poetry(1), pipenv(1), uv(1)

Copied to clipboard
Kai