PlayerPiano: Amaze Your Friends!

PlayerPiano amazes your friends by running Python doctests in a fake interactive shell.

This is one of my favorite pieces of code - an app for developers, by a developer. I think it really shows off the potential of computers as a tool for human communication (mostly unfulfilled, IMO). The basic idea belongs to Ian Bicking (if you haven’t seen his “Topics of Interest” talk, go watch it. Now). I realized I could use doctest to extract the code samples, making for a much more usable tool.


Being a tool for demonstration, the best explanation is a demo. Here’s my 2009 Pycon lightning talk on the subject. And yes, my hands were shaking quite a lot (two cups of coffee immediately before presenting to 1000+ people was probably not the best idea).

Ironically, our talks about code often feature remarkably little actual code. Live typing is slow, difficult and boring for an audience. PlayerPiano makes demoing code easier, by scaling Python’s shell culture up to the ballroom. With PlayerPiano, your presentations can be interactive demos with vocal explanations, leaving your slides to summarize for an audience that’s already on the web. I hope it’s helpful to speakers at next year’s Pycon or at your local user group.

Future Directions

As speakers, we have a terrific resource we’ve been neglecting - namely, a local network and our audience’s laptops. Rather than being a distraction from the presentation (via email & Facebook checks), perhaps we could use the sea of laptops to engage with it. At the 2009 sprint, I worked on adding AJAX support (my first serious JavaScript foray). The idea was to have the code being demoed gradually revealed on a web page in sync with what was on the projector, adding additional context (the speaker’s notes, or other explanatory text). I got a decent prototype working using STOMP, but never really got the UX to where I wanted (it’s been ripped out in the current release - find it in the old_orbited branch). Perhaps someone out there with more JavaScript-fu than I would like to implement this with websockets? Lemme know.