a blog by Marius Gedminas

Posts tagged Python

Switching to GitHub Actions

I am grateful to Travis CI for providing many years of free CI service to all of my FOSS projects. However the free lunch is over and I don’t want to constantly ask for free build credits by email (the first 10,000 ran out in 10 days). I’ve chosen to migrate to GitHub Actions. There are already helpful resources about this: Python in GitHub Actions by Hynek Schlawack The GitHub workflow template used by Zope Foundation projects The official documentation In fact part of the difficulty with the migration is that there’s too much documentation available!

Rackspace OSS

I've a Jenkins server running tests for most of my open-source projects now: https://jenkins.gedmin.as/. It was not too difficult to set up: Send an email to Jesse Noller about that free Rackspace Cloud hosting for OSS projects, expecting to be rebuffed because all my projects are small and insignificant. Receive a positive response with the instructions. Yay! Sign up for an account, type in all my credit card details and personal phone numbers, get it verified by a phone call (I hate phone calls, but apparently it prevents fraud or something).

Adding "Edit on GitHub" links to Sphinx pages

Documentation pages on ReadTheDocs have a nice sidebar with extra "Show on GitHub" and "Edit on GitHub" links. Here's how you can have those for your own Sphinx documentation: Create _ext and _templates subdirectories. Create a file _ext/edit_on_github.py that hooks into html-page-context to add a couple of template variables. Create a file _templates/sourcelink.html that uses those two variables to insert "Show on GitHub" and "Edit on GitHub" links in the sidebar.

Logging levels and hierarchies

I remember when the logging package seemed big and complicated and forbidding. And then I remember when I finally "got" it, started using it, even liked it. And then I've discovered that I didn't really understand the model after all. Consider this: we have two loggers root \ -- mylogger configured as follows: import logging root = logging.getLogger() root.setLevel(logging.INFO) root.addHandler(logging.FileHandler("info.log")) mylogger = logging.getLogger('mylogger') mylogger.