Skip to main content

Python Development Master

Project description

PDM - Python Development Master

A modern Python package manager with PEP 582 support. 中文版本说明

Github Actions PyPI Docker Cloud Build Status

asciicast

📖 Documentation

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.

PEP 582 proposes a project structure as below:

foo
    __pypackages__
        3.8
            lib
                bottle
    myscript.py

There is a __pypackages__ directory in the project root to hold all dependent libraries, just like what npm does. Read more about the specification here.

Highlights of features

  • PEP 582 local package installer and runner, no virtualenv involved at all.
  • Simple and relatively fast dependency resolver, mainly for large binary distributions.
  • A PEP 517 build backend.
  • A full-featured plug-in system.

Why not virtualenv?

The majority of Python packaging tools also act as virtualenv managers to gain the ability to isolate project environments. But things get tricky when it comes to nested venvs: One installs the virtualenv manager using a venv capsulated Python, and create more venvs using the tool which is based on a capsulated Python. One day a minor release of Python is released and one has to check all those venvs and upgrade them if required.

PEP 582, on the other hand, introduces a way to decouple the Python interpreter from project environments. It is a relative new proposal and there are not many tools supporting it (one that does is is pyflow), but it is written with Rust and thus can't get much help from the big Python community. For the same reason it can't act as a PEP 517 backend.

Installation:

PDM requires python version 3.7 or higher.

It is recommended to install pdm in an isolated enviroment, with pipx.

$ pipx install pdm

Or you can install it under a user site:

$ pip install --user pdm

Usage

python -m pdm --help provides helpful guidance.

Docker image

$ docker pull frostming/pdm

FAQ

1. What is put in __pypackages__?

PEP 582 is a draft proposal which still needs a lot of polishing. For instance, it doesn't mention how to manage CLI executables. PDM makes the decision to put bin and include together with lib under __pypackages__/X.Y.

2. How do I run CLI scripts in the local package directory?

The recommended way is to prefix your command with pdm run. It is also possible to run CLI scripts directly from the outside, the PDM's installer has already injected the package path to the sys.path in the entry script file.

3. What site-packages will be loaded when using PDM?

Only packages in the local __pypackages__ directory will be loaded. site-packages of Python interpreter isn't loaded. It is fully isolated.

4. Can I relocate or move the __pypackages__ folder for deployment?

You'd better not. The packages installed inside __pypackages__ are OS dependent. Instead, you should keep pdm.lock in VCS and do pdm sync on the target environment to deploy.

5. Can I use pdm to manage a Python 2.7 project?

Sure. The pdm itself can be installed under Python 3.7+ only, but it doesn't restrict the Python used by the project.

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.

Project details


Release history Release notifications | RSS feed

This version

0.8.7

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pdm-0.8.7.tar.gz (80.4 kB view details)

Uploaded Source

Built Distribution

pdm-0.8.7-py3-none-any.whl (102.5 kB view details)

Uploaded Python 3

File details

Details for the file pdm-0.8.7.tar.gz.

File metadata

  • Download URL: pdm-0.8.7.tar.gz
  • Upload date:
  • Size: 80.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for pdm-0.8.7.tar.gz
Algorithm Hash digest
SHA256 f2c83d03d5c36a4cca77ad5ce9bf65b50b6bad1137d5a4a4a7b7ae79d64c7cab
MD5 1e29b72577d821bb1b1d0ffed421d06b
BLAKE2b-256 798ebb1c0224f166704b1e5b5089688d19eb479d4fa58658ca1e73fa93f7b504

See more details on using hashes here.

Provenance

File details

Details for the file pdm-0.8.7-py3-none-any.whl.

File metadata

  • Download URL: pdm-0.8.7-py3-none-any.whl
  • Upload date:
  • Size: 102.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/47.1.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.7.9

File hashes

Hashes for pdm-0.8.7-py3-none-any.whl
Algorithm Hash digest
SHA256 c5c13ed36307ddadc049a8814c14a5eba9f6e6a1f703908a9f5574186bca4ff0
MD5 37fbcfe30f6d07bcfce27366e947e9c5
BLAKE2b-256 28de4dc43135beb1c4bc80c34854e868f09d1cafe5983dbd823db499a9a4c7bd

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page