Since it looks as if Twitter's days are numbered, I've been looking at what it would take to move most of my on-line presence into my personal blog space and off of the various sites where I make various comments and such. One thing I haven't been doing well is backing up this site right here; my last backup was over two years ago.

Bad sysadmin! Naughty sysadmin!

I have a backup script written in Fabric, that takes an old-school "pets-not-cattle" approach to backing up the various services on my Linode host. When I tried to run it, however, it threw exceptions about libraries either missing or being incompatible.

I decided to modernize, starting with PDM.

Having forgotten completely how to start a new Python project, I looked through various options before I settled on PDM, the Python Dependency Manager. It fit my brain, as the Pythonistas like to say, mostly because it resembles other modern tools like Rust's Cargo or Javascript's NPM. Working with it turned out to be easy enough. Installing it uses that dubious "just download a script and run it" blindness, but we do like to live dangerously these days:

$ curl -sSL https://raw.githubusercontent.com/pdm-project/pdm/main/install-pdm.py | python3 -

I created a new project, cd into it, and started up the process:

$ pdm init

It walks you through a few questions about who you are and what the project should be. One of the question is about setting up a .venv virtual environment for the project as part of the project, and I agreed that would be a good idea. Activating it is a little more wordy, but it gets all of the environment variables set up correctly in your current shell session. I use screen and McFly, so terminal shells for me are psychologically cheap to start and discard:

$ eval $(pdm venv activate)

Examining my old Fabric backup script, I saw that aside from Fabric I needed PyYaml and Invoke. So I added those:

$ pdm add fabric invoke pyyaml

There was one library discrepancy (pyyaml no longer has a default Loader, you must provide one with the constructor), and after that everything worked just fine.

This is just the start of my using PDM, but these are all the commands I've needed so far to get a project off the ground, up, running, and doing what I needed it to do. I like it a lot more than the older tools like pyenv and so forth, and I'll probably be sticking with it.