Convert Figma logo to code with AI

pdm-project logopdm

A modern Python package and dependency manager supporting the latest PEP standards

7,771
383
7,771
41

Top Related Projects

24,813

Python Development Workflow for Humans.

A set of tools to keep your pinned Python dependencies fresh.

13,409

a Hassle-Free Python Experience

39,014

Simple Python version management

6,398

A system-level, binary package and environment manager running on all major operating systems and platforms.

Quick Overview

PDM (Python Development Master) is a modern Python package and dependency manager. It aims to provide a comprehensive solution for Python project management, including dependency resolution, package installation, and virtual environment handling. PDM is designed to be fast, reliable, and compatible with PEP 582 standards.

Pros

  • Supports PEP 582 for simpler dependency management without virtual environments
  • Fast and efficient dependency resolver
  • Compatible with pyproject.toml for modern Python packaging
  • Supports multiple Python versions and implementations

Cons

  • Relatively new compared to established tools like pip and poetry
  • May have a learning curve for users accustomed to traditional Python packaging tools
  • Limited ecosystem of plugins compared to more mature tools
  • Some advanced features may not be as well-documented as basic functionality

Code Examples

  1. Installing dependencies:
import pdm

pdm.install()
  1. Adding a new dependency:
import pdm

pdm.add("requests")
  1. Running a script defined in pyproject.toml:
import pdm

pdm.run("test")

Getting Started

To get started with PDM, follow these steps:

  1. Install PDM:
pip install pdm
  1. Initialize a new project:
pdm init
  1. Add dependencies:
pdm add requests
  1. Install dependencies:
pdm install
  1. Run your Python script:
pdm run python your_script.py

Competitor Comparisons

24,813

Python Development Workflow for Humans.

Pros of Pipenv

  • More established and widely adopted in the Python community
  • Integrates dependency management with virtual environment creation
  • Supports both pip and virtualenv in a single tool

Cons of Pipenv

  • Slower performance, especially for large projects
  • Less flexible dependency resolution compared to newer tools
  • Limited support for PEP 582 (local packages directory)

Code Comparison

Pipenv:

pipenv install requests
pipenv run python main.py

PDM:

pdm add requests
pdm run python main.py

Key Differences

  • PDM uses PEP 582 by default, while Pipenv uses virtual environments
  • PDM has faster dependency resolution and installation
  • Pipenv has a larger user base and more extensive documentation
  • PDM supports more modern Python packaging standards (e.g., PEP 621)

Both tools aim to simplify Python project management, but PDM focuses on newer standards and improved performance, while Pipenv offers a more traditional approach with widespread adoption. The choice between them depends on project requirements and personal preferences.

A set of tools to keep your pinned Python dependencies fresh.

Pros of pip-tools

  • Lightweight and focused solely on dependency management
  • Integrates seamlessly with existing pip-based workflows
  • Generates readable and editable requirements files

Cons of pip-tools

  • Lacks built-in virtual environment management
  • Doesn't provide a complete project management solution
  • Requires additional tools for more advanced package management features

Code Comparison

pip-tools:

pip-compile requirements.in
pip-sync requirements.txt

PDM:

pdm add requests
pdm lock
pdm install

Summary

pip-tools is a specialized tool for managing Python dependencies, focusing on generating and synchronizing requirements files. It's lightweight and integrates well with existing pip workflows. However, it lacks some advanced features and doesn't provide a complete project management solution.

PDM, on the other hand, offers a more comprehensive approach to Python project management. It includes built-in virtual environment handling, PEP 582 support, and a wider range of package management features. While it may have a steeper learning curve, PDM provides a more all-in-one solution for Python project management.

The choice between the two depends on project needs and personal preferences. pip-tools is ideal for those who want a simple, focused tool for dependency management, while PDM is better suited for those seeking a more comprehensive project management solution.

13,409

a Hassle-Free Python Experience

Pros of Rye

  • Simplified workflow with automatic virtual environment creation and management
  • Built-in support for creating and publishing packages
  • Integrated tooling for common tasks like linting and formatting

Cons of Rye

  • Less mature and potentially less stable than PDM
  • Smaller ecosystem and community support
  • Limited compatibility with existing project structures

Code Comparison

PDM:

[project]
name = "my-project"
version = "0.1.0"
dependencies = [
    "requests>=2.25.0",
]

Rye:

[project]
name = "my-project"
version = "0.1.0"

[dependencies]
requests = ">=2.25.0"

Both tools use TOML for configuration, but Rye's syntax is slightly more concise. PDM offers more granular control over dependencies, while Rye aims for simplicity.

Rye is a newer project focusing on streamlining Python development workflows, whereas PDM is a more established tool with a broader feature set. Rye's automatic virtual environment management and integrated tooling may appeal to developers seeking a more opinionated approach, while PDM's flexibility and extensive plugin system cater to those who prefer more control over their development environment.

39,014

Simple Python version management

Pros of pyenv

  • Allows managing multiple Python versions on a single system
  • Provides a simple way to switch between Python versions globally or per-project
  • Integrates well with other tools and can be used alongside package managers

Cons of pyenv

  • Focused solely on Python version management, not package management
  • Requires manual installation of Python versions
  • May have compatibility issues with some operating systems or environments

Code Comparison

pyenv:

pyenv install 3.9.5
pyenv global 3.9.5
python --version

PDM:

pdm use python
pdm add requests
pdm run python main.py

PDM is a more comprehensive project management tool that handles both dependencies and virtual environments, while pyenv focuses specifically on Python version management. PDM offers a modern approach to Python project management with features like PEP 582 support and lockfile generation, whereas pyenv excels at managing multiple Python installations on a single system.

While both tools serve different primary purposes, they can be used together in a workflow where pyenv manages Python versions and PDM handles project dependencies and virtual environments.

6,398

A system-level, binary package and environment manager running on all major operating systems and platforms.

Pros of conda

  • Cross-platform package management for multiple programming languages
  • Robust environment management with isolated environments
  • Large ecosystem of pre-built packages, especially for scientific computing

Cons of conda

  • Slower package installation and environment creation
  • Larger disk space usage due to bundled dependencies
  • More complex configuration and usage compared to simpler tools

Code comparison

conda:

name: myenv
channels:
  - conda-forge
dependencies:
  - python=3.9
  - numpy
  - pandas

PDM:

[project]
name = "myproject"
python_requires = ">=3.9"
dependencies = [
    "numpy",
    "pandas"
]

Summary

conda is a powerful cross-platform package manager with robust environment management, ideal for scientific computing. It offers a large ecosystem of pre-built packages but can be slower and more resource-intensive than simpler tools.

PDM is a modern Python package manager focused on simplicity and PEP 582 compliance. It provides faster installations and a more straightforward configuration but may have a smaller package ecosystem compared to conda.

Choose conda for complex, cross-language projects or scientific computing needs. Opt for PDM if you prefer a lightweight, Python-specific solution with simpler configuration and faster performance.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

PDM

A modern Python package and dependency manager supporting the latest PEP standards. 中文版本说明

PDM logo

Docs Twitter Follow Discord

Github Actions PyPI codecov Packaging status Downloads pdm-managed trackgit-views

asciicast

What is PDM?

PDM is meant to be a next generation Python package management tool. It was originally built for personal use. If you feel you are going well with Pipenv or Poetry and don't want to introduce another package manager, just stick to it. But if you are missing something that is not present in those tools, you can probably find some goodness in pdm.

Highlights of features

  • 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.

Comparisons to other alternatives

Pipenv

Pipenv is a dependency manager that combines pip and venv, as the name implies. It can install packages from a non-standard Pipfile.lock or Pipfile. However, Pipenv does not handle any packages related to packaging your code, so it’s useful only for developing non-installable applications (Django sites, for example). If you’re a library developer, you need setuptools anyway.

Poetry

Poetry manages environments and dependencies in a similar way to Pipenv, but it can also build .whl files with your code, and it can upload wheels and source distributions to PyPI. It has a pretty user interface and users can customize it via a plugin. Poetry uses the pyproject.toml standard, but it does not follow the standard specifying how metadata should be represented in a pyproject.toml file (PEP 621), instead using a custom [tool.poetry] table. This is partly because Poetry came out before PEP 621.

Hatch

Hatch can also manage environments, allowing multiple environments per project. By default it has a central location for all environments but it can be configured to put a project's environment(s) in the project root directory. It can manage packages but without lockfile support. It can also be used to package a project (with PEP 621 compliant pyproject.toml files) and upload it to PyPI.

This project

PDM can manage virtual environments (venvs) in both project and centralized locations, similar to Pipenv. It reads project metadata from a standardized pyproject.toml file and supports lockfiles. Users can add additional functionality through plugins, which can be shared by uploading them as distributions.

Unlike Poetry and Hatch, PDM is not limited to a specific build backend; users have the freedom to choose any build backend they prefer.

Installation

PDM requires python version 3.8 or higher.

Via Install Script

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

For Linux/Mac

curl -sSL https://pdm-project.org/install-pdm.py | python3 -

For Windows

(Invoke-WebRequest -Uri https://pdm-project.org/install-pdm.py -UseBasicParsing).Content | py -

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

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

  • $HOME/.local/bin for Linux
  • $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:

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.

Alternative Installation Methods

If you are on macOS and using homebrew, install it by:

brew install pdm

If you are on Windows and using Scoop, install it by:

scoop bucket add frostming https://github.com/frostming/scoop-frostming.git
scoop install pdm

Otherwise, it is recommended to install pdm in an isolated environment with pipx:

pipx install pdm

Or you can install it under a user site:

pip install --user pdm

With asdf-vm

asdf plugin add pdm
asdf install pdm latest

Quickstart

Initialize a new PDM project

pdm init

Answer the questions following the guide, and a PDM project with a pyproject.toml file will be ready to use.

Install dependencies

pdm add requests flask

You can add multiple dependencies in the same command. After a while, check the pdm.lock file to see what is locked for each package.

Badges

Tell people you are using PDM in your project by including the markdown code in README.md:

[![pdm-managed](https://img.shields.io/endpoint?url=https%3A%2F%2Fcdn.jsdelivr.net%2Fgh%2Fpdm-project%2F.github%2Fbadge.json)](https://pdm-project.org)

pdm-managed

Packaging Status

Packaging status

PDM Eco-system

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

Sponsors

Credits

This project is strongly inspired by pyflow and poetry.

License

This project is open sourced under MIT license, see the LICENSE file for more details.