the further adventures of

Mike Pirnat

a leaf on the wind

« Previous Page Next Page »


On Friday I ran across this modest proposal to make the output of Python's unittest2 more closely resemble the emotional state of the tester when there are a lot of failing unit tests. Once my coworkers were done asking if I was all right, or if they should be worried about the cackling and giggles coming from my cube, I resolved to make this dream a reality.

My workplace has settled on the nose testing framework. Like other frameworks, nose offers a plugin architecture to allow all kinds of additional customization and tweaks, and since I had never written one before, it seemed like this might be a good opportunity to give it a try. I found the plugin development docs to be a little too terse and not terribly n00b-friendly, but over the course of a couple of hours I was able to cobble something together. (I mostly ended up cheating off of Kumar McMillan's nose-nicedots, which got me over the hurdle of realizing I needed my own flavor of TestResult to make sure I got the usual stack trace output while still emitting the F's and U's correctly.)

It basically goes like this:

$ nosetests --with-f7u12

FAIL: test_f7u12.TestGeneratesLotsOfFailures.test_generates_failures(7,)
Traceback (most recent call last):
line 197, in runTest
line 15, in _make_a_test
    assert False

< lots more test failure output; use your imagination... >

Ran 50 tests in 0.021s

FAILED (errors=30)

After some wrangling with PyPI (which could also be a lot friendlier to a packaging n00b--big thanks to Michael Foord for helping set me straight), it should be easy_install-able, or you can grab the source from Github (patches welcome!). And if you prefer pytest over nose, it looks like they've got a plugin too.

It's a tremendously silly thing, but it brought me some joy; I hope it can brighten your day too, or at least bring some comfort and commiseration to your test failure rage.

Read and Post Comments

Thanks for Everything, Steve

Thanks, Steve
by Jonathan Mak Long

I had meant to write this when Steve Jobs announced his departure from day-to-day operations at Apple, but life, as it tends to, intervened, and I never quite found the time. Now that he's gone, I'm compelled to get this out while it's still fresh in my mind.

I learned about Steve's passing on my iPhone.

Music is an integral part of my life, for years before and after my time as a radio DJ, and it's a large part of how I process the emotional ebb and flow of my life. After I put my phone down, I picked up my iPad, fired up the Remote app, and in seconds I had Lisa Gerrard and Patrick Cassidy's Immortal Memory going on the AppleTV, while a smart album of my favorite photos--of my wife, of my daughter, of vacations and adventures--scrolled by.

I felt the urgent need to type, reached into my backpack, and drew forth my trusty unibody MacBook, felt the familiar keys under my fingertips, activated the Python virtualenv that houses my writing, fired up vim.

It's worth a moment of pause to realize that in a matter of minutes, I've had a personal interaction with four devices that wouldn't have been without Steve's vision of personal computing. Reflecting on these magical, science-fictional devices--I still maintain that the iPhone plus Wikipedia is the Hitchhiker's Guide to the Galaxy made real--I am dumbstruck with the realization that I don't just owe Steve my thanks for my favorite shiny toys.

I literally owe him everything.

Once upon a time, my parents bought an Apple II+. Must have been about 1981. That wonderful machine, connected first to a fairly awful '70s TV, was my introduction to computing. We played games on it at first; my parents and I took turns reading aloud from the text output of Zork and all the other great Infocom games, to which I credit my precociously early literacy, my goofy vocabulary, and my love of puns and puzzles. Then I discovered BASIC, and the die was cast. I loved typing in programs from magazine code listings, seeing what they did and how they worked, and even more fell in love with writing my own programs. From that moment, the die was cast--while I excelled in many subjects in school, I was always happiest when tinkering with computers.

Over the years, the Apple II+ gave way to the IIe, and eventually to a long series of Macintoshes. I got into BBSes, and that eventually got me into a (ahem) borrowed VAX account at the local college, where the natural outlet for my text adventuring was playing MUDs, which I turned into class credit by landing an independent study project on writing code for MUDs. When it was time to pick a college, I knew that I was looking for a computer science program. A long-distance friend that I kept in touch with via VargonMUD got me introduced to Case Western.

Case got me to leave southwest Colorado, arguably the most beautiful place on earth, for Cleveland, Ohio. Not only did I survive the grueling computer engineering curriculum, but I came out on the other side with a job at IBM and a fiancée.

The IBM travel schedule and its impact on my personal life drove me into the arms of American Greetings and its spunky internet startup,, just as the first bubble was beginning to burst. We had some rough years on the road to profitability, but I hunkered down, got stuff done, and thankfully held onto my job, where I became increasingly enamored with our primary language, Python. Python's "it fits your brain" feels a lot to me like Apple's "it Just Works", and I see easy parallels between Apple's design aesthetics and Python's Zen. Is it any wonder that the number of Macs at PyCon has exploded over the past five or six years? Working with Python led me to helping David Stanek start up a local user group, and then to attending PyCon, which in turn brought me to speaking and volunteering at PyCon, which have been some of the most satisfying experiences of my life thus far. Moreover, PyCon is responsible for getting me serious about quality and craftsmanship, and has rewarded my risk-taking with friendships, self-confidence, and composure under pressure.

Thanks in part to this earnest desire to grow in my craft, the growth from my speaking experiences, and that Infocom-kindled love for tinkering with a puzzle until solved, I've come to a pretty awesome place in my career--basically I go where I'm needed most, to get hard things done, to shake things up, to band people together, to transform, to raise the bar. On good days, it feels like being Doctor Who in a Kurosawa movie, all flashing swords and sonic screwdrivers and the triumph of intellect and romance over brute force and cynicism. It definitely never gets boring--I'm coming up on twelve years at AG, and in some ways I feel like I'm just getting started.

And on the home front? Things have been good; house, cars, cats, good food, great travel adventures, some of the best friends I could ever ask for. Liz and I have been married for almost eleven years.

Our daughter is four and already enchanted by computers and iPads. Her entire concept of what a telephone is will be rooted not in rotary dials and POTS but in a kind of mobile computing that was science fiction when I was a kid. She may not remember it, but I used to read Learning Python to her as a baby, and I've got the photos on my AppleTV to prove it to her. But that's not what's really amazing about her--it's that she's been so instrumental in overcoming the depression that plagued my 20s; she blew into my life like a fresh breeze and swept away so much garbage. Sure, parenting hasn't been easy, but when I stop to take a breath, I'm struck by how much better I've become for the experience.

Education, career, friends, family, community--literally my entire world--all because of that Apple II and Steve's vision. Surely in some alternate, Steveless universe, similar patterns might have emerged, but this one, these friends, this path, this wife, this child, I can trace very clearly to his influence.

Words seem useless to express my gratitude for the profound effect Steve has had on my life. My sadness that this titan is gone. My regret that we'll never know what other transformations he would have brought to the world.

So, how then to cope with this sudden absence, the sinking of the rock that has so rippled the waters of my life? My inner child will hold to the illusion that Steve's gone to the same tropical island paradise as Jim Henson, Isaac Asimov, Richard Feynman, and Carl Sagan. My outer adult will try, even if it's only in small ways, to make the world a better place, to touch the lives of those around me, to encourage them to grow, to become, and to help them in turn shape the lives of others. And hopefully that will be all right.

Thank you, Steve.

For everything.

Read and Post Comments

Memories of PyCon

Originally uploaded by mikepirnat

About two weeks ago, Jesse Noller was soliciting favorite PyCon memories. I started jotting down a few, then suddenly realized I had written quite a bit more than I'd expected, so I'm turning it into that rarest of creatures in my online life, a full-blown blog post! In more or less chronological order (I make no guarantees about wibbley-wobbly, timey-wimeyness that may occur), here are just a sampling of my favorite memories of PyCon.

PyCon 2005 was the first time in my career that I'd been able to attend a developer conference, and it was on the flight back that I realized that Python might in fact be my programming language soul mate. I'm pretty sure Alex Martelli's epic two-part talk grew my brain by a size or two.

A convention of vacuum salesmen loudly occupied the main convention space while I sprinted with the TurboGears folks in 2006. I still kind of wish we'd crashed the "Vacuum Assassination" breakout session to see what it was.

I had a fun evening of dinner and drinks that year with a gaggle of Python folks: Mark Ramm, Kevin Dangoor, Dave Stanek, Bill Zingler, Ian Bicking, Jacob Kaplan-Moss... We all got a good laugh at the guy who parked his BMW underneath a veritable rainstorm of incontinent birds. Alas, we never did carry out our plans to streak at a Ruby conference.

I had breakfast with Ned Batchelder outside the main hall the morning of my Dateutil talk(2007?). He was so very gracious and welcoming that I was able to put aside my anxiety about my upcoming talk; the experience has really inspired me to be more social at PyCon and to make a point of meeting the people that I regularly read and admire on the Planet Python feed.

I brought my DSLR to PyCon 2008 and shot a lot of photos, a number of which ended up being incorporated into the banner montage on the PyCon website. I think about six or seven of the images on the PyCon blog banner (before the recent redesign) were mine, and it made me smile every time I saw them there. (I was actually in the banner for a couple of years, which felt kind of awesome.) It's nice to know that even if you aren't hacking on the standard library, or working on other well-known Python packages, you can still make meaningful contributions to the Python community in a host of other ways.

Tarek Ziade gave me a one-on-one tour of his Atomisator over lunch at PyCon in 2009, and then we talked about life and family and French wine... I felt very fortunate to have been given an hour of his time. His generosity and openness were truly inspiring.

Speaking at the TiP BoF in 2010... I didn't have my laptop with, so I didn't have any slides to add Testing Goat pictures to (long story). I invited Gary Bernhardt to portray a goat, and to my amazement, and to the significant amusement of all present, he did. I love the good-natured sense of humor that pervades the community.

At the 2011 TiP BoF, I showed off an extremely evil use of Mock to work around horrible legacy code, and it earned me a personal reprimand from Titus Brown (another of my Python heroes). I'm not sure if the ire was sincere or just extremely droll, but either way--achievement unlocked: scolded by someone whose work I admire!

Formally launching my hobby site How Old Is My Kid at the 2011 lightning talks--in front of an appreciative crowd of over a thousand Pythonistas--was definitely one of the top thrills of my life.

I've given three formal talks at PyCon (2006, 2007, 2011), and each of them has been an increasingly wonderful experience, but the stand-out has to be my 2011 talk. I'd been stressing about it for months, and, more worried than I'd ever been about any of my previous talks, tinkered on the presentation right down to the last minutes before I went on stage. Everything clicked, the audience got it--laughing and wincing at all the right places!--and the only thing more amazing than the love and appreciation from the crowd was the bizarre sensation of my phone, set on vibrate so that it wouldn't accidentally make any noises to distract me, and placed in my pants pocket, going crazy with Twitter notifications while I spoke, and for hours thereafter. Keeping my composure while my pocket was vibrating uncontrollably was harder than giving my talk!

Taping down power strips before the 2011 tutorials led to meeting new friends, catching up with others, a delightful dinner and conversation with Guido and the inner cadre of PyCon organizers... but most importantly to a feeling of pride throughout the conference--PyCon was part mine in a real and tangible way.

The best thing about PyCon is the feeling, upon arrival, of being home, of being with one's own kind. Forgotten memories come flooding back, friendships are instantly renewed, new ones are quickly forged, and the whole thing just feels right. At PyCon, we are all the "cool kids". And if we put our minds to it, we can do anything.

Read and Post Comments

When GPX Files Lie

After our May photowalk, I found that my GPS tagger had missed a bunch of data points (probably due to all the buildings and trees), so I got a copy of Dave Snyder's GPX track to use as an additional reference. At first I was excited to see a really solid track, rich with data, but was disappointed to see that it still wasn't helping--none of my photos were lining up with where I knew they should be.

Then I looked at the times on the GPX track. That started four hours before we'd started the walk.

It turns out that RunKeeper on Dave's Android phone emits timestamps that claim to be UTC, but populates them with unconverted local times. In other words--it lies.

I wrote a very quick and very, very dirty Python script to fix up all the timestamps, and that did all right for the immediate job, but it seemed like it might be useful for someone else out there, so I took some time this morning to tidy it up and make it usable as a general utility.

Using it is pretty simple; this will adjust a GPX file by +4 hours and dump it to stdout: 4 bad_timestamps.gpx

Or perhaps we need to fix a bunch of files and want to overwrite them instead of doing the stdout donce: -o 4 bad_timestamps.gpx really_bad.gpx super_bad.gpx

It can do negative offsets as well (in case our data points are east of UTC): -o -- -1 east_but_still_bad.gpx

The code is up on github and I welcome pull requests for improvements or things that I'm lazy about (I am profoundly bored by packaging, so it's not PyPI-able yet).

Share and enjoy.

Read and Post Comments

Why Convore?

Earlier today, David Stanek was grousing about Convore and wondering why he needed "another place to look for communications". I promised him an answer that couldn't fit into 140 characters, and this is it.

I was initially a skeptic as well and had more or less the same reaction. I've got IRC and Jabber for chat rooms; I've got email lists and message boards for slower-speed, more permanent discussions; and I've got Twitter for a real-time firehose. Why do I need one more thing?

The answer, at least to me, is that Convore is a little bit of all of these things, and it ends up being greater than the sum of its parts. After giving Convore an open-minded try at PyCon, I found that it was a really comfortable and natural fit as a back-channel for the event.

It's topical: Twitter is great at being a firehose of information, but it's lousy for being able to subdivide that firehose into easily sippable streams. At PyCon, Convore users created a topic for every talk within moments of it starting, allowing commentary and discussion to stay relevant and focused.

It's persistent: Unlike IRC (which only persists in logs) and Twitter (which only persists in the Library of Congress), the Convore discussions will stick around and are easily discoverable (though admittedly some better search would help here). A couple of the benefits--and I'm sure there are others--come readily to mind:

  1. As a conference speaker, I could go into the Convore discussion after my talk and not only see what the back-channel had to say about it, I could answer questions and interact with people who were interested in what I had to say.

  2. I can come back to it much, much later. We're starting to show PyCon videos at work during lunch, and we can use the Convore data to help decide which talks were the most interesting or that are worth prioritizing.

  3. People who weren't able to attend can review the discussion and participate after the fact. Maybe it means finding an interesting new project, or maybe it means networking with other developers--it's there and it's available.

It's low-friction: I can log in via Twitter (so I don't have to create yet another identity). I don't need a client to make it tolerable (even "New Twitter" hasn't figured this out yet). It works great on my laptop, as well as on the iPad (and presumably other tablets as well).

It's civil: If I were to star in a Ballmeresque dance video about Convore, the riff would be "civility, civility, civility, civility." At least in what I saw at PyCon, the Convore discussions never got nasty or crossed too far over any lines; even when the speaker from DropBox went way, way over time on his keynote address, the back-channel didn't get nasty--and in fact it eventually turned sympathetic (after all, how many times have you delivered a keynote speech in front of 1400 people?). This was a very stark contrast to the year that Ian Bicking put the #pycon IRC channel up on the big screen and things got somewhat ugly.

I don't think that Convore replaces email lists. Those seem well-suited to lengthy, back-and-forth discussion among the communities they represent. I don't use it for trying to organize our podcast (although there's an argument to be made that it's an impossible task no matter what medium we use), and I wouldn't use it for organizing a user group or conference.

I don't think that Convore replaces IRC or Jabber; sometimes I just want to shoot the breeze or have a more ephemeral conversation.

I don't think that Convore replaces Twitter; Twitter's great at being a big, asychronous party with all my favorite people in it. Sometimes I want to be distracted by all the shiny toys that people find.

But as a conference back-channel, it was stellar, and I'm looking forward to using it more in that context. Your mileage, of course, may vary.

Read and Post Comments

The Tourniquet Pattern

I was delighted today when, on a walk down to Starbucks, Aaron Oliver coined "the Tourniquet Pattern" to explain something I'd done a while back. I would have thought that someone far more clever had come up with this ages ago, but Google seems to suggest otherwise.

Some may argue that it's basically just the Adapter or Facade with a more exciting name, but neither of these names conveys the same degree of distate and judgment that Tourniquet does. This is the battlefield medicine of Adapters--we're going to have to lose that leg eventually, but in the mean time let's accomplish the mission and live to tell the tale.

I fell instantly in love with this name (at least as much as I'm already in love with the Diaper Pattern) and I intend to share it far and wide. Enjoy.

Read and Post Comments

How Does Your Software Garden Grow?

Farewell to Daffodils
Farewell to Daffodils
Originally uploaded by mikepirnat

Every time I spend a few hours working in my garden, I find myself inescapably drawn to the parallels between gardening and software development. Whether you're digging in the dirt or head-down in code, there are many lessons from one that are equally valid and valuable in the other. Here are the ones that I keep coming back to:

  1. Vision: Whether you're planning a garden or starting a new program (or maybe just implementing a new feature), you need to have a vision for what the finished product looks like, and always keep it in mind as you build toward it. Without some discipline to guide you, your code garden will be a disharmonious mish-mash with no direction, and your efforts will be wasted.

  2. Vigilant Weeding: Your garden and your codebase are going to be under constant assault from weeds of all kinds. It might be thistles and dandelions, or it might be subtle bugs and poor designs, but only your continuing vigilance keeps them from getting out of control and spoiling what you're trying to achieve.

  3. No Mercy: Is something not working out the way it should? Has a bush grown into an oversized monster? A class gained so many features that it's unmaintainable? Something just not flourishing? Don't keep it just because it's already there--refactor. Rip it out. Replace it with a better alternative. You won't really miss it, and the eventual result will be better off without it.

  4. Openness to Change: The original vision might not be attainable; that's okay. Rethink the vision and you'll probably come up with something that will be even better than what you thought you wanted in the first place.

  5. Keep an Eye on Your Neighbors: Pests like grubs and dandelions don't respect property lines, and neither do bugs, bad designs, or performance problems in systems that your code may have to talk to. Be on your guard for nasty things that might leak across and foul your work. Wall them off and isolate them before they move in permanently.

  6. Use Good Tools: One day, I got fed up trying to dig a hole with the same old shovel that had been in the garage forever--an old hand-me-down even when it came to us. I broke down and bought a new shovel; the blade was sharp, the handle more comfortable. It felt good to use, it took a lot less effort to get the job done, and I didn't hurt after using it. So too in software, using modern tools like a DVCS can be a lot more effective than older, worn-out counterparts.

  7. Know How to Use Your Tools: Whether you're in the garden or hacking on code, you need practice and knowledge to use your tools effectively. You'll save time and be far less likely to injure yourself (or those around you).

  8. If It's Worth Doing, It's Worth Doing Right: You wouldn't drop a bunch of money on new plants only to have them die without fertilizer or water. So write tests. Practice good methodologies. Don't skimp on documentation or streamlining your deployment. Don't half-ass it, or you'll pay for it eventually--and probably a lot sooner than you expect.

  9. It's Alive: Your garden and your code are organic, living things. They need your love and devotion, your sweat and toil, if they are to grow successfully. Sometimes that love is tough, but it's necessary.

  10. Take Pride in What You Do: At the end of the day, it's nice to relax and enjoy the beauty and you've created, to appreciate the small oasis of order that you've carved out of the entropy and chaos of the world. You want to be able to enjoy the fruits of your labors. You don't want your yard or your code to be an eyesore that all the neighbors complain about.

  11. Enjoy What You're Doing: If you're not enjoying it, you're doing something wrong. Figure out what's keeping you from being happy about your work and do something to change it.

  12. Talk to People: Just as you wouldn't want to plant a sun-loving flower in the shade of your apple tree, you also wouldn't want to use a dictionary when you really need a set. Many problems have already been solved, and there's a tremendous wealth of knowledge and experience out there; whether it's the guy at your local garden shop or the folks in your local user group, you'll be amazed at what you can pick up from even a little bit of human interaction.

If you're writing code but not gardening, try it out and see if you don't have some similar revelations. If you are a coder who gardens, what parallels have you drawn? How has gardening influenced your programming work?

Read and Post Comments

Words of Wisdom

I like to post things above my screens at work, partly to decorate, but primarily to keep them near the surface of my thoughts as I work, to subtlely reinforce things that I'd like to keep in the periphery of my consciousness. Right now I've got two posters that I whipped up--one is a slightly abridged version of The Zen of Python and the other is a recent remark from one of my coworkers. I thought a few of you might appreciate them, so here are PDFs for your enjoyment:

Read and Post Comments

Video and Slides from my PyCon 2011 Talks

I've been hoping that the PyCon folks would have uploaded presentation slides by now, since they did such a good and thorough job of collecting them from all the speakers, but it's been a couple of weeks now with no sign of them, so I've given up and finally created an account on SlideShare. I'm really pleased, though, by the speed at which the A/V crew got all of the conference videos uploaded to

While I'd originally only planned a single talk for PyCon, I ended up giving three.

Exhibition of Atrocity

My main talk, a confessional of my sins against Python and suggestions for avoiding them. It seemed to be well-received; I'm glad that I put as much work into the final polishing as I did, working pretty much right up to the very last minutes before I had to go onstage.

I wasn't able to dig up the URL for the highly inspirational rage comic in time to get it into the video or slides, but I did manage to eventually find it--I first encountered it on imgur.



Win at Parenting with Python

I whipped this up on the plane trip from Cleveland on the off-chance I could get into a round of lightning talks. Basically I thought it would be fun to formally announce a personal project in front of 1400 people, an experience that I am only just beginning to comprehend.


My bit starts about 30 minutes in...


Mock in Production Code

Subtitled "It's Better Than Fixing Your Busted Old Shit", this talk for the Testing BoF came together at the last minute. Despite mortally offending Titus Brown with the awfulness of the code--it's like "the Aristocrats" but in Python--I had a lot of fun with this one. I'm choosing not to share the slides, though, for a variety of reasons--the language is fairly blue, the code samples really need more context than what's provided in the slides, and it's full of inappropriately appropriated pictures of goats. (It's a TiP BoF thing.) In short... You kind of had to be there.

Read and Post Comments

« Previous Page Next Page »