Writing custom Sphinx themes

I’ve been struggling to write this next piece because I feel like I don’t actually know how to do this. But I’ll write what I do know, and I hope that it helps you! There are two kinds of themes I’ve written for Sphinx: themes for HTML output and themes for PDF output. I understand …

Building docs for different targets with Sphinx (with bonus Unicode support)

Let’s say you want to build your docs in different formats. I already alluded to html versus dirhtml, but the distinction between those is relatively small; it’s just a matter of directory structure. What if I want to build my docs as PDFs or ePubs or something else? Well, Sphinx can do it. By default, …

Fun times with unittest.mock

In foo.py: In test_foo.py (running under pytest, with pytest-mock): It took me a tick to realize that the function definition was being evaluated at import time, including the values for the kwargs. Even though the body, of course, wasn’t being evaluated. I solved it with this change to foo.py: This is related to the thing …

Getting your docs on Read the Docs

You’ve seen it before: software projects with lucid and lovely documentation, all available on subdomain.readthedocs.org. So, how do? Well, the good folks at Read the Docs have made your life very easy. Assuming your documentation’s reStructuredText source is kept in git, and you are OK with pushing it to GitHub, you can get Read the …

Let’s talk about Sphinx

I’ve fielded a few questions lately from folks about Sphinx, reStructuredText, and documentation in the Python world and more broadly. So I thought I’d write up a bit of an intro to how I use and understand these tools, and how better documentation makes me a better developer. Restructured understanding of reStructuredText There’s a lot …

Jabber Bot

So, I’ve written a python-based MUC-aware Jabber bot framework, using XMPPpy.  If anyone would be interested in using or improving this, please let me know.  I want it to be of use to people, like a Jabbery version of your IRC-bot framework of choice.  It is currently instantiated only as Tyche, my dicerolling bot for …