
A path paved by serendipity
The kindness of another Ansible engineer made it possible for me to attend PyCon2016. He couldn’t make it, and graciously he offered me his ticket. I wasn’t sure if I’d be allowed to go until mere days before the conference began. I received clearance, booked my flight, and packed a bag in a span so short that I thought it must be a dream sequence. The randomness of life usually doesn’t muster so neatly, right?
First, I need to say that PyCon2016 is the best conference I’ve ever attended.
PyCon was unlike any conference I worked while in the video games industry (PAX, ECGC, GDC). In the past, I’ve been one small person in a throng of 70,000+. At ~3,200 attendees, PyCon felt warm and familial. I asked everyone I met “how do you know each other?” and received responses that mapped across many years and shared projects.
At booths in the games industry, I hustled: try the demo, register for an account, tell a friend! At Ansible’s PyCon booth, I listened. In three days, users described to me elaborate menageries of systems managed by Ansible automation. I was floored by the enthusiasm of most engineers I talked to. The fresh adopters were most ecstatic: so many were pleasantly surprised that their problem took hours, not days, to solve to their satisfaction.
Talks
I attended about half a dozen talks in three days, and queued up more for the plane ride home. I spent a lot of time furiously Googling. Stream of consciousness reactions and tangential research below.
Machete-mode debugging - Ned Batchelder
- Embrace ephemeral code. Don’t be afraid to write jank to isolate a problem and extract information about it.
- You probably don’t need to append to sys.path.
- importing a Python module will also execute it
-
inspect
is a nifty module in the Python standard lib that I hadn’t used before. The talk cited an example whereinspect.stack
was used to a inspect a call stack find the source of a double-imported module.inspect.stack
wrapsinspect.getouterframes(sys._getframe(depth))
wheredepth
is the contextual level passed toinspect.stack
. - Monkey patch via
site-packages/*.pth
to ensure patch is applied before the function is called pdb.set_trace()
can be used inside of a trace function. Ned’s example and one of my experiments below:
def trace(frame, event, arg):
# break if the 0th element of sys.path endswith '/lib'
if sys.path[0].endswith("/lib"):
pdb.set_trace()
# return a reference to iself in scope, or another function to further trace this scope
return trace
sys.settrace(trace)
# That's neat, but what can we do with the frame and event arguments?
# This inspects the name of the code object executed in each frame
def traceMyFuncNames(frame, event, arg):
if event == "call":
print "calling function: {0}".format(frame.f_code.co_name)
elif event == "return":
print "returning function: {0}".format(frame.f_code.co_name)
return traceMyFuncNames
sys.settrace(traceMyFuncNames)
- Followup talk: How C trace functions really work
Networking without an OS - Josh Triplett
video slides BIOS Implementation Test Suite (BITS)
I attended this one because I have a pet interest in projects that run Python on bare metal. I started building small programs to run on a WiPy, which is a microcontroller running a port of MicroPython. Although I can write code and execute it on a WiPy, I don’t have a strong fundamental understanding of how MicroPython works, especially because each port seems specific to the given board’s architecture.
About 95% of this talk went way over my head. But here are my entry-level info bullets:
- BITS runs on 32-bit BIOS or 64-bit EFI
- Underpinning tech: possible to run Python 2.7 in GRUB 2 by adding Python’s source files into GRUB’s build system.
- Custom
pyconfig.h
to declare which features are available (exclude all requiring an OS) - Parsing overhead reduced by using Python bytecode
- Interface to EFI provided via libffi. The “extensible” in “EFI” means you can create protocols using native C.
libffi
is packaged withctypes
Small Batch Artisanal Bots: Let’s Make Friends - Elizabeth Uselton
Using microprojects to stitch together fundamental concepts, with a quick/fun outcome. These Twitter bots are freakin’ adorable.
- @stealthmountain - alerts tweeters when they’ve typed “sneak peak” instead of “sneak peek”
- @viralhulk - retweets BuzzFeed articles in HULK SMASH speak
- @FBIbot - tweets random pages from Freedom of Information Act releases
A Beginner’s Guide to Deep Learning - Irene Chen

I’ve been working through the problem sets in Machine Learning in Action for about six weeks, but that’s the extent of my exposure to machine learning (let alone deep learning networks).
This was the most accessible talk on deep learning that I’ve ever heard. Irene started very high-level (on the subject of avocados), and within five minutes transitioned her audience into examples of forward and backward propagation.
New libraries and toolkits to check out:
Move Things From One Computer to Another, Safely - Brian Warner
My favorite talk! I wrote a long-form response to this one on the plane home, where I write about using Magic Wormhole to fasicilate multisignature Bitcoin trasactions. Read more: PyCon2016 - Down the Magic Wormhole
Revitalizing Python Game Development: Packaging, Performance, and Platforms - Jacob Kovac
Kivy is a library close to my heart.
I don’t have any formal education or background in computer science. I slung lattes and perspired through the first pilot of edx.org’s MITx 6.00 series. While working through that MOOC, I gravitated towards was Kivy - this library made me realize I possessed the knowledge and tools to begin building my own games. In a month, I coded a helper app for my favorite party game, Mafia.
Kivy provides cross-platform interfaces to common mobile features, like multi-touch, gestures, cameras, accelerometers. When I was a new programmer, Kivy obscured just enough complexity to allow me to cobble together high-level logic to drive a Mafia game.
I squee’d aloud when I heard Kivy now supports Python 3 (if you don’t package for iOS). Expect my next blog post to be a writeup describing a 2D game engine, like a Die2Nite clone or an online implementation of card-based game like Arboretum or Mottainai.
I strongly believe that game development space in Python is perfect for engaging with new programmers. Kivy’s toolchain and API are a triumph in simple usage, which is an area larger engines like Unity/Unreal/Crytek/Gamemaker etc struggle with. Having spent time in the games industry, I know that onboarding a gameplay designer to one of these engines takes months and months. I transitioned to brewing double espressos to brewing my own game in under thirty days, which is remarkable, and made entirely possible by Kivy.
So, I closed my PyCon experience with a nod back to the library that originally inspired me to create cool things and pursue work as engineer. The feedback loop goes ever on and on~