The Third Python

It’s been a harrowing couple of weeks as a bunch of work-related stuff unraveled and needed to be put back in its appointed place, but I managed to find some time to tinker around this weekend and get some personal stuff done, including upgrading this website from the ground up (beginning with the usual seamless upgrade to 18.04, which I’ve been testing for a couple of months1).

Runtime Changes (Not Hy Anymore)

Most notably, this site is now running on “pure” 3 instead of Hy.

I still like Hy () and am keeping track of it, but I’ve been wanting to move away from 2 and take full advantage of asyncio for , and there was no way to do that easily in Hy–but it served me extremely well, and the current codebase owes a lot to it.

Even though the bulk of the code was re-written months ago, I had to wait until a bunch of other stuff fell into place:

  • I wanted to make sure the new codebase could: a) be used to (eventually) move to a and b) last me at least as long as the old one (Hy served me well for , but the previous codebase lasted )
  • I needed to tweak piku () to use 3 by default and fix a few things (and have been working on improving its runtime support)
  • I wanted to wait until 3.6 became the norm (hence my waiting until 18.04 rolled out)

This also meant upgrading all the dependencies and doing a considerable amount of testing, which wasn’t easy given the amount of free time I have these days.

Minor Detours

Along the way, I also tried:

  • Moving some of my stuff to Cython for slight speedups (I’m keeping those on a separate branch for now)
  • Tinkering with Python on Azure App Service, which is still a sub-optimal development and deployment experience and which I would very much like to make a one-click operation.
  • Tinkering with Kubernetes (which also worked fine, but is overkill for a plain blog)
  • Implementing a few of the core bits in , largely because I needed a few test API endpoints for Azure Functions2 and it was actually saner to switch languages altogether than trying to get 3.6 to run in Functions at the time3.

All of those little detours inlfuenced the final code in some ways (with a few nice speedups, too), and I will be updating the GitHub repo as soon as I am positive most of the bugs are ironed out (I’ve instrumented the production environment with Application Insights, and will be collecting data over the next week or so).

For now, I’m just doing , especially where it concerns content indexing and rendering:

a profiling diagram with dozens of boxes connected by arrows
I really need to find a better Textile markup renderer... Fortunately regex speeds it up a tad.

Next Steps

There are a couple of bugs with indexing and search that only showed up in production (likely due to differences in sqlite full-text indexing in packages), but I expect those to be sorted out by next week.

With luck, I’ll get started on adding a (long overdue) photo gallery and a decent blog archive section as well.


  1. Although it’s common practice to wait until the first point release to upgrade between LTS versions, everything I’ve been using is rock solid, so this was a no-brainer. ↩︎

  2. As it turns out, Visual Studio (the whole enchiladaTM edition) for Mac works well enough for that (even though the publishing options are still in beta). ↩︎

  3. It also afforded me a way out of dealing with callback hell for those tests… ↩︎

This page is referenced in: