Misc Python stuff

Tools

Python versions

Try to support Python versions in popular LTS distros such as RHEL and its clones, and Debian and its derivates (like Ubuntu).

Writing command line tools

Nice Python libraries

Writing dependencyless Python

If you can write your program without using dependencies, then it automatically becomes much easier to distribute and run. This is quite possible for many tools! And helps you replace problematic shell scripts.

The standard library still includes a lot of batteries:

For very simple stuff, tkinter can implement simple graphical tools and wsgiref can implement simple web apps (that you can even deploy with CGI).

Subprocess

The main problem of using Python for scripting is that the subprocess functions do not default to check=True and shell=False.

Likely many of your scripts will start with a subprocess wrapper suited to your script.

You can use shlex.join to print commands you execute in a copy-pastable way.

Writing scrapers

Use Playwright

Further reading:

Web automation: don't use Selenium, use Playwright