{"id":1618,"library":"pdm","title":"PDM - Python Development Master","description":"PDM is a modern Python package and dependency manager that supports the latest PEP standards, including PEP 582 for local package directories. It offers robust dependency resolution, a unified `pyproject.toml` interface, and flexible virtual environment management. Currently at version 2.26.7, PDM maintains an active release cadence with frequent minor updates and bug fixes.","status":"active","version":"2.26.7","language":"en","source_language":"en","source_url":"https://github.com/pdm-project/pdm","tags":["package manager","dependency management","virtual environment","pyproject.toml","PEP standards"],"install":[{"cmd":"pipx install pdm","lang":"bash","label":"Recommended (global tool)"},{"cmd":"curl -sSL https://pdm.fming.dev/install.py | python3 -","lang":"bash","label":"Alternative Installer Script"}],"dependencies":[],"imports":[{"note":"PDM is primarily a CLI tool. Programmatic imports like this are typically used for building tools on top of PDM, not for general application development.","symbol":"Core","correct":"from pdm.core import Core"}],"quickstart":{"code":"# 1. Initialize a new PDM project\npdm init\n\n# 2. Add a dependency\npdm add requests\n\n# 3. Run a command within the project's environment\npdm run python -c \"import requests; print('Requests is installed!')\"\n\n# 4. (Optional) Install development dependencies\npdm add pytest --dev\n\n# 5. (Optional) Activate the virtual environment directly\npdm venv activate\n# Then run: python -c \"import requests; print('Requests is installed!')\"\n# deactivate # To exit the virtual environment","lang":"bash","description":"This quickstart demonstrates initializing a PDM project, adding a dependency, and running a command within the isolated project environment. PDM automatically creates and manages virtual environments."},"warnings":[{"fix":"Refer to the official PDM migration guide for detailed steps when upgrading from PDM 1.x. It typically involves recreating the project with `pdm init` and re-adding dependencies.","message":"PDM v2 introduced significant breaking changes from v1, including a new lock file format (`pdm.lock` instead of `Pipfile.lock`) and updates to CLI commands and configuration. Projects upgrading from PDM 1.x require migration.","severity":"breaking","affected_versions":"<2.0.0"},{"fix":"Ensure `pyproject.toml` is the single source of truth for your PDM project. Migrate existing dependency declarations into the `[project]` and `[tool.pdm]` sections of `pyproject.toml`.","message":"PDM primarily uses `pyproject.toml` for all project metadata and dependency management. Mixing PDM with legacy `requirements.txt`, `setup.py`, or `Pipfile` within the same project can lead to conflicts and unexpected behavior.","severity":"gotcha","affected_versions":"All versions"},{"fix":"To create a virtual environment inside the project directory (similar to `venv` or `Poetry`), set `python.use_venv = true` in `.pdm.toml` (project-local config) or globally via `pdm config python.use_venv true`.","message":"PDM's default virtual environment location is typically global (`~/.local/share/pdm/venvs`). Users accustomed to `venv` or `Poetry` creating a `.venv` folder in the project root might be surprised. Project-local venvs can be enabled but require configuration.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Use `pdm add <package>` or `pdm install` when modifying dependencies to ensure the `pdm.lock` file is updated. Use `pdm sync` when deploying or setting up a project to ensure reproducible installations based on the existing lock file.","message":"The commands `pdm install` and `pdm sync` have distinct behaviors. `pdm install` adds new packages and updates the `pdm.lock` file, while `pdm sync` only installs/updates dependencies specified in the existing `pdm.lock` file without modifying it. Misunderstanding this can lead to outdated lock files or unexpected dependency installations.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-04-09T00:00:00.000Z","next_check":"2026-07-08T00:00:00.000Z"}