Python
Base52 moment stamps
3 min Nine ASCII-ordered characters of microseconds that byte-sort by time and omit A, E, I, O, and U, reducing accidental matches when keys live inside model prose.
Where CONTRIBUTORS.txt Ends Up
3 min Tracing an old memory about Android phones and Cisco equipment to the files that carried my name.
EOF after the parent disappears
2 min A small guardian process ties a command group to its Python parent’s lifetime through a pipe, even when Python cannot run its own cleanup.
The sqlite3 close trap
2 min Python’s sqlite3 context manager ends a transaction but leaves the connection open. A finally block owns the close.
Millimeters and arcminutes
2 min layoutc keeps meter and degree scales plus its full-turn constant in one IntEnum, using arcminutes to keep both angular constants integral.
One bunker per pixel
4 min layoutc stores a paintball field layout as a PNG—sub-pixel position in R/G, rotation in B, identity in A, and transparency as literal emptiness.
One bit in the rounding gap
2 min layoutc stores a quadrant in the sign of a micron-scale nudge that the codec’s 1.5 mm grid snap folds back to exactly zero.
The deferred namespace
3 min A custom Python namespace records imports, then resolves deferred names on first lookup.
Source ready to distribute
2 min A source release can include generated C, headers, and version data without requiring those artifacts to live in the original checkout.
Why not ZIP?
1 min In the packaging discussion I favored ZIP’s mechanics and Python’s existing use of it; the source-distribution contract chose tar.gz.
D is for dog
1 min A little Python program I wrote with my first-grade son: type a letter, hear an animal.
Materializing a default
1 min settingsd copied a mutable fallback correctly, then lost edits because the copy had never become namespace state.
Static Python
7 min zippy: a PGO-built CPython with every C extension statically folded in, the application zipped onto the tail of the binary, and the interpreter treated as just another dependency.
Logging after the fact
3 min retrospect instrumented already-compiled Python functions by swapping in rewritten code objects at runtime—and restored the exact original on request.
Validation before initialization
1 min Python-SAML checked for embedded certificates through state its constructor had not assigned yet.
settingsd
3 min conf.d for Python settings, with ordered executable fragments and a record of where assignments came from.
The polyglot activate script
2 min zippy’s bin/activate was six lines valid in both bash and Python, and sourcing it executed itself to print its own exports.
NUL-joined argv
2 min Write a readable Python argv literal with NUL separators, provided every formatted value is NUL-free.
The settrace ambush
3 min CPython 2 had no general hook after PySys_SetArgv finalized startup state but before user code, so zippy’s site.py armed a one-shot trace function.
Couch Multiseat
4 min Five weeks to build a from-scratch X11 window manager that gave each gamepad an independent pointer so several Minecraft clients could share one TV.
Xacto
4 min Deriving a command tree from Python modules and signatures, then making tool discovery work across deferred imports and ZIP files.
Callable modules
2 min A CPython experiment put a module body inside a function, made attributes share its globals, and used a call to execute it again.
Returning the fault
1 min Suds could return different fault types through different paths; I proposed returning the same WebFault object callers could otherwise catch.
The other serializer
1 min A Celery event setting failed despite an explicit accept list, and embedding the worker in uWSGI amplified the retry loop.
Quotes for the next parser
2 min A Distil build exposed two separate needs: keep the compiler argument together, and preserve the quotes inside its C macro value.
The mapping constructor
1 min A one-line Spyne change let the configured mapping type receive the member pairs the serializer already produced.
Building against the metadata
5 min Distlib and Distil exposed the practical edges of a static Python build: incompatible local candidates, ZIP resources, changing schemas, and executable build steps.
python32.3
1 min A bulk shebang rewrite left gprof2html.py asking for an interpreter that never existed. Arch was patching it with sed, so I sent the report upstream.
GridFUSE
4 min A filesystem experiment over MongoDB GridFS: directories as queries, new versions on overwrite, and deletion through a visibility flag.
Threesixty
4 min Xbox 360 through a compressed VPN to DigitalOcean, with a live player map, traffic-based host estimates, and replayable captures.
The VPython Years
2 min I learned Python for a 3D library, then kept following its imports and build machinery into the language itself.
uWSGI
5 min Learning through a server I wanted to use for almost everything: embedded files, Python entry points, packet boundaries, and the order things came alive.
Before partialmethod
2 min The Python 2 recipe for binding a functools.partial as a method—three-argument MethodType plus update_wrapper—and the stdlib name that replaced it.
A paste from the terminal
2 min Adding multipart uploads to pastie-sane meant accepting files, recognizing compressed text, and returning a link a shell user could use.
Nested AMQP tables through librabbitmq
2 min An unmerged librabbitmq patch taught a Python/C boundary to carry nested AMQP tables and arrays instead of flattening their structure.
Relocatable Python with $ORIGIN
3 min A runtime library path relative to the executable lets a built interpreter move as a tree—verified in the ELF policy and the loader’s result.
Before the handler
1 min Missing AMQP properties could trap Kombu in a delivery-time KeyError before user code received the message.
The type of infinity
1 min Spyne’s unbounded defaults used float infinity, which made Decimal validation depend on the Python version.
Comments at the parser boundary
1 min XML comments were becoming empty RPC models; configuring the parser removed them before either decoder saw them.
Optional and nil
2 min Two Spyne fixes separated whether an XML element must appear from whether its value may be nil.
What Happened With pyjs
7 min Working on a Python-to-JavaScript toolkit, the 2012 split, and what I would do differently.
Callback identity for WebKit DOM events
2 min Making WebKit’s DOM events usable from Python required callback types, lifetime information, and an identity the remove operation could recognize.
The missing python2 shebang
1 min Pygments recognized python and python2.7 but missed python2, just as Arch made the major-version name useful.
pacproxy
4 min A caching proxy for Arch packages that streamed and cached in one pass, kept HTTP validators as sidecar state, and published its own caveat list.
Two Import Interfaces
2 min A teaching library’s wildcard namespace and an integrator’s explicit namespace are different interfaces, and a module can carry both on purpose.
Pinning a HUD to a Moving Camera
2 min A label pinned to the viewport exposes the difference between world, camera, and screen coordinates.
Learning Python by Debugging Boost.Python
2 min A VPython crash took me through Python versions, word sizes, and Boost builds to find a working combination.
Teaching Aliasing with Streams
1 min Open streams and database connections gave me a useful way to explain Python assignment: another name refers to the same live resource.
A Dependency Edit Does Not Change an ABI
1 min Changing package metadata changes what the package manager accepts; it does not establish that a compiled artifact can run against a new interpreter.