Autobuilding Sphinx Docs With inotify

So tonight I decided I’ve been putting it off far enough, and started my first Sphinx documentation project. Read The Docs’s Getting Started guide wasn’t bad, but it really bothered me that there wasn’t a good way to autobuild the docs.

I ended up just adding this to the makefile:

# If you don't have inotify-tools, install it first: `apt-get install inotify-tools`
watch:
    @while true; do \
    inotifywait --recursive -e modify -e move -e create -e delete \
    --exclude $(BUILDDIR) . && $(MAKE) --silent html; done

This blog post by JKM is often cited as a way to do it too, but the install_requires section of watchdog’s setup.py was longer than I felt like sitting through.

There’s a promising project, sphinx-autobuild, but the readme currently says “sphinx-autobuild relies on a not-yet-released version of python-livereload” and it also uses watchdog; so forget that. If I end up spending a lot of time writing docs, it’s worth getting this up and running though because it comes with LiveReload.

Leave a Reply

Your email address will not be published. Required fields are marked *