---
title: "I like PDM"
author: Bob Rubbens
publish_timestamp: 2026-09-22T08:31:00+02:00
state: published
template: template/post.mako
id: 9e753e76-78eb-42e7-ada2-f6b3c08d1d74
---

I like [PDM](https://pdm-project.org), the "modern Python package and dependency manager." It can do a whole bunch of things related to managing Python projects. In particular, there are two features I rely upon often and really appreciate.

# Standalone Python scripts with dependencies

PDM allows you to write, more or less, Python scripts with dependencies that do not require any setup steps beforehand. This is accomplished by including a description of the requirements (Python version, dependencies, and more), in a top-level comment, and then running the script with `pdm run $SCRIPTPATH`. PDM will then create a Python environment for you on the fly, set it up according to what you specified in the comment, and run your script within it.

Of course, to run such a script, you still need PDM, which itself is a reasonably heavyweight setup step. Since the interface is minimal (just one PDM command), stable (written in ~~stone~~ [PEP 723](https://peps.python.org/pep-0723/)), and interoperable (based on a PEP), I tolerate it.

The top-level comment and basic script machinery looks like this:

```python { .numberLines }
# /// script
# requires-python = ">=3.14"
# dependencies = [
#   "tqdm==4.70.1"
# ]
# ///

# Run with `pdm run $SCRIPT`

from pathlib import Path
import json


def main():
    pass


if __name__ == "__main__":
    main()
```

I have the above script saved in `~/Templates/script.py` such that my [file manager](https://apps.kde.org/dolphin/) allows me to create a new one from the right-click context menu. Any file manager worth it's salt will likely support this, as it's part of the [XDG user directory guidelines](https://www.freedesktop.org/wiki/Software/xdg-user-dirs/). Pretty nice if you ask me!

If you're curious to read more, have a look at the [documentation](https://pdm-project.org/en/latest/usage/scripts/). [PEP 723](https://peps.python.org/pep-0723/) specifies the metadata format used in the comments.

# Not owned by Big AI

Before, I used a different Python project manager. Sadly, it [got acquired by OpenAI](https://openai.com/index/openai-to-acquire-astral/). 

# That's it

I have yet to find a use case that's not covered by PDM, though I'm sure there are differences. If you like no-hassle Python tooling, give PDM a try!