Let’s begin by addressing why I still use Python 2.

Why Python 2?

I’ve written multiple times about Python 2 and how I still use it for work and personal projects both locally and on my CI/CD pipelines on GitHub and Azure DevOps.

I am well aware Python 2 reached EOL, but I thought I had more time to stop using Python 2.7, and I based that on Ubuntu’s lifecycle. Ubuntu 20.04, as an LTS release, it will be supported by Canonical until 2025, and I was hoping GitHub would take Python 2.7 along for the ride until they deprecate the ubuntu-20.04 runner.

But specifically, I use Python 2 for testing installation using tox and building and publishing my packages to PyPI and Azure Artifacts. Granted, I could live without the former, but the latter is a luxury hard to drop; going back to publishing manually would be the boring solution, and who likes boring?

The bad news

Since the people behind GitHub’s runner-images switched ubuntu-latest from ubuntu-20.04 to ubuntu-22.04, I decided to “watch” their releases so I could be ahead of the game. And it was on April 10, 2023 when I got the news: python2.7 will be removed from the images on May 15, 2023.

While this was to be expected considering Python 2 saw its last release back in April 20, 2020, May 2023 was most definitely unexcepted. But instead of groveling, let’s find a solution.

The options

For my projects at work the obvious option is to switch from Microsoft-hosted agents to self-hosted agents which can be executed on one or more Servers, but for my public repos on GitHub things get a little bit trickier since it is recommended using self-hosted runners with private repositories.

Renting a VM

Here I have explored Linode’s Shared CPU options, Azure’s Bs-series, and Google’s E2 shared-core machine types, but I have found that Google Cloud offers a free tier for their Cloud Build service where, at the time of this writing, the first 120 build-minutes per day are free, and free is always good.

So I’ve already started learning about Cloud Build and creating build triggers to build repositories from GitHub and considering whether I should have the Cloud Build config file in my repos, inline on my trigger configuration or a Dockerfile.

Conclusion

Again, it was expected Python 2 would eventually be dropped, and as long as Ignition by Inductive Automation solely depends on Jython 2.7 all of us will be stuck with maintaining and supporting Python 2. But I’m glad we still have options and will report my experience in future posts.

In the meantime let’s keep coding.

Thanks for reading.