Real Ultimate Programming

The Home for People Who Like to Flip Out and Write Code

Notes From PyATL 2012-02-09

Python, Chef, and MongoDB (Rick Copeland)

  • chef-client is what is actually managing your machine
  • This talk focuses on replacing the Chef server
  • TIL: Chef server is currently based on CouchDB (really?), but they’re probably migrating to Postgres (already done for the hosted service?)
  • Way more guts of Chef that I’ve looked at before
  • I wonder how that fat model thing affects testability in Python. He conceded that maybe you don’t have to put stuff in the model, as long as you don’t put it in the view.
  • Interesting approach for testing: a little urllib hackery, some WebOb-derived machinery, etc.

WMI-API (Justin Simms)

  • Windows Management Instrumentation (WMI)
  • Got started down this path due to i18n (that’s possibly the most interesting thing I’ve ever heard tied to i18n).
  • It’s like DevOps city up in here

Better Documentation Through Automation: Creating docutils & Sphinx Extensions (Doug Hellmann)

The basics

  • reStructuredText (RST) is commonly described as a Markup Language for Documents; the docutils module provides parsing, etc. for RST.
  • Not so fast, says Doug. He says it’s a programming language for building documents (makes me think of TeX), because you can extend it without changing the syntax.
  • Just like with a programming language, you should strive for DRY.
  • Demoing a Role for linking to issues on BitBucket: it’s just a single Role-processor function, which returns a 2-tuple (I missed the details of exactly what is in this tuple, but part of it is a collection of nodes from a parse tree).
  • Parse trees? He wasn’t kidding with the compiler comparisons.
  • You have to explicitly register config values in to get Sphinx to remember stuff.
  • Directives are a bit more complicated than Roles, but that makes sense given how much more powerful they are.
  • Directive processors are implemented as classes instead of functions, but most of the work is handled by the run method.
  • I should dig into Sphinx; I’d write better docs and I’d freshen up my theoretical CS skills.
  • The Table Node Hierarchy is very similar to the HTML <table> stuff.
  • You can also write your own Document Builder (this is Sphinx-specific, whereas the earlier stuff we covered was generic docutils stuff), which is yet another level higher in the hierarchy.


  • This is a project that Doug wrote when he was writing his book, and most of the magic is in the custom Document Builder.
  • There’s an init method; don’t confuse it with __init__.
  • Document Builders basically works by walking the parse tree and doing whatever they want to, then spit out some results.

Back to flipping out…