ImageMagick packaging change on Alpine Linux
In Alpine Linux 3.18 and earlier, it was sufficient to install the imagemagick package by itself to operate on any image format, including modern ones such as HEIC and WebP. In later versions of Alpine Linux, that’s no longer the case. Starting in Alpine Linux 3.19, the support files for HEIC, WebP, and other image formats moved into sub-packages like imagemagick-heic and imagemagick-webp; see https://git.alpinelinux.org/aports/commit/?id=61dce5f6a84d9f96ab7aa6437f12d2845b572ed8. The problem After upgrading Alpine Linux, this packaging change could lead to errors due to missing image format support files. For example: ...
Create empty Git commits
Occasionally you see commit messages like: trigger build empty commit for CI Developers push these commits to re-run continuous integration (CI) after a failure due to a flaky test or an intermittent network error. The commits often contain an innocuous change such as adding a blank line in a README file or changing one character in a code comment. The problem The developer doesn’t actually want to change anything in the project—they want to trigger a new build. But, by default, the git commit command prevents creating empty commits: ...
Automating screenshots with Selenium
One of our web sites has a help section which includes screenshots of the web site itself. Needless to say, the screenshots quickly become out-of-date when we modify the site. After manually updating the screenshots a couple times, I decided to automate the process using Selenium and Python. This post describes: Setting up Selenium in a Python virtual environment Initializing the WebDriver Interacting with the web site Taking screenshots of specific elements Set up the virtual environment We’ll install Selenium in a new Python virtual environment. Selenium also requires a driver to interface with the browser which must be installed separately. ...
Cleaning up Django Migrations
In late 2019 I modernized a large Django 1.11/Python 2 application to use Django 2.2/Python 3. The application included hundreds of database migrations, many of which depended on legacy packages and deprecated functionality that blocked upgrading Django and Python. This post documents how I cleaned up the legacy migrations to unblock upgrading to modern versions of Django and Python. Attempt #1: Squash the migrations The standard way to reduce the number of migrations in Django is called squashing. Squashing generates new migrations that co-exist with the old migrations, which simplifies deploying the changes. ...
Downloading a snapshot of a git repository
Sometimes you’d like a copy of a git repository, but don’t need the entire git history. For large repositories, the history can be slow to download and may consume a lot of disk space. The history is unnecessary when: Exploring or building at a specific branch or tag Building a git repository in a Dockerfile Scaffolding a project from a template In this post I show how to use the GitHub API to download a snapshot of a repository and show how this might look in a Dockerfile. Additionally, I describe degit, a project scaffolding tool that copies repositories from GitHub and other providers. ...