George V. Reilly

Running

I shared a house with my friend Muhsin in the mid-90s. Muhsin is a runner so I started running too, but I lost the habit not long after I moved in with Emma in ‘98.

A little over a year ago, I went down to the Bay Area for work. I spent the weekend staying with old friends from Ireland, Paul and Maggie. Paul had been run down by a car while cycling at twilight at Christmas 2013. As part of his recovery, he had taken up running, and a few weeks before my trip, he challenged me to join him in a 5K run for charity.

And so I continue.

Checking minimum version numbers in Bash

I worked on a Bash script today that sets up various pre­req­ui­sites for our build. We need a recent version of Docker but our Bamboo build agents are running on Ubuntu 14.04, which has a very old version of Docker. The script upgrades Docker when it’s first run. The script may be run more than once during the lifetime of the agent, so the second and subsequent calls should not upgrade Docker.

Basically, I wanted

if $DOCKER_VERSION < 1.9; then upgrade_docker; fi

Un­for­tu­nate­ly, it’s not that easy in Bash. Here’s what I came up with.

install_latest_docker() {
    if docker --version | python -c "min=[1, 9]; import sys; ↩
v=[int(x) for x in 
continue.

Christmas Cake

Last week I made my Christmas Cake, a week after I made my Christmas Puddings. Tonight I decorated it with marzipan and royal icing.

Including Data Files in Python Packages

[Pre­vi­ous­ly published at the now defunct MetaBrite Dev Blog.]

I spent some time today struggling with setuptools, trying to make a Python source package not only include a data file, but also install that file.

Building the installer

Consider the following source tree layout:

├── MANIFEST.in
├── README.md
├── my_stuff/
│   ├── bar.py
│   ├── foo.py
│   ├── __init__.py
│   └── quux.py
├── models/
│   └── long_ugly_name_20151221.json
└── setup.py*

I wanted to create a Python source dis­tri­b­u­tion, some_­pack­age-N.N.N.tar.gz, which contains the code in the my_stuff directory, as well as models/long_ug­ly_­name_20151221.json, using python setup.py sdist.

It’s not that hard to get models/long_ug­ly_­name_20151221.json included in the tarball. Add an entry in MANIFEST.in:

include models/*.json

Then be sure to set in­clude_­pack­age_­da­ta=True in the call to setup():

from setuptools import setup, find_packages

setup(
 
continue.

Review: Destination: Morgue!

Title: Des­ti­na­tion: Morgue!
Author: James Ellroy
Rating: ★ ★ ½
Publisher: Vintage
Copyright: 2004
Pages: 400
Keywords: true crime, au­to­bi­og­ra­phy
Reading period: November 28–De­cem­ber 20, 2015

A collection of James Ellroy’s articles on crime and his own past.

I’ve enjoyed Ellroy in the past but I found this unreadable. I tried it twice but abandoned it halfway through. Ellroy’s writing is self-indulgent, irritating, grandiose, and full of tiresome stylistic tics.

Restoring the Bar Room

Aside from a few hours spent at two parties, we’ve worked from when we got up until midnight getting the bar room back in shape. I spent a couple of hours just washing all the greasy crystal glasses this morning (not to be confused with last night’s cleaning the booze bottles). We sorted through all the cookbooks and set aside about a third of them. The room is now ready to use again. Alas, we’ve moved a pile of stuff tem­porar­i­ly into the spare room, which will have to be dealt with soon.

Bar Room Booze

As I mentioned last week, we started painting our "bar room" blue. The picture above shows the new color—and why we call this room the bar room.

The kitchen stove is just on the other side of the doorway, but the extractor fan is about six feet left of the stove, over the sink. The kitchen was remodeled and expanded in the 1960s; I believe the original stove was under the extractor fan. One con­se­quence of this is that, over time, bottles and glassware in the bar room become greasy.

I cleaned all the bottles tonight. Some of them needed it quite badly.

We have a sizeable collection of liquor and liqueurs, but we drink very continue.

No Spoilers for Star Wars

I can’t decide whether I should be amused or ex­as­per­at­ed by all the cries of NO SPOILERS! NO SPOILERS! for Star Wars: The Force Turns Over in Bed and Goes Back To Sleep.

Review: The Saxon Tales by Bernard Cornwell

Title: The Last Kingdom
Book: 1
Author: Bernard Cornwell
Rating: ★ ★ ★ ★
Publisher: Harper
Copyright: 2004
Pages: 368
Keywords: historical fiction
Reading period: 9–17 November, 2015
Title: The Pale Horseman
Book: 2
Author: Bernard Cornwell
Rating: ★ ★ ★ ★
Publisher: Harper
Copyright: 2005
Pages: 384
Keywords: historical fiction
Reading period: 18–20 November, 2015
Title: The Lords of the North
Book: 3
Author: Bernard Cornwell
Rating: ★ ★ ★ ★
Publisher: Harper
Copyright: 2006
Pages: 332
Keywords: historical fiction
Reading period: 21–23 November, 2015
Title: Sword Song: The Battle for London
Book: 4
Author: Bernard Cornwell
Rating: ★ ★ ★ ★
Publisher: Harper
Copyright: 2007
Pages: 368
Keywords: historical fiction
Reading period: 24–26 November, 2015
Title: The Burning Land
Book: 5
Author: Bernard Cornwell
Rating: ★ ★ ★ ★
Publisher: Harper
Copyright: 2009
Pages: 345
Keywords: continue.

Python f-strings

At this month’s PuPPy (Puget Sound Pro­gram­ming Python) Meetup, I heard a brief mention of Python f-strings as a new feature coming in Python 3.6.

In essence, they offer a simpler, more versatile method of string formatting and in­ter­po­la­tion over existing methods. F-strings can include not only symbol names but Python ex­pres­sions within strings. With str.format, you can write 'Hello, {name}'.format(name=some_name). You can control various aspects of how name is formatted, such as being centered within a field—see PyFormat and Python String Format Cookbook for ex­am­ples—but no more complex expression is allowed between the braces.

Herewith some examples of f-string ex­pres­sions drawn from PEP 0498:

>>> date = datetime.date(1991, 10, 12)
>>> f'{date} was on a {date:%A}'
'1991-10-12 was 
continue.
Previous » « Next