Auto-building Sphinx docs

Jacob Kaplan-Moss

May 24, 2012

Here’s a quick way to automatically regenerate your Sphinx docs as you make changes to the source. There’s probably a million ways to do this; here’s mine:

$ pip install watchdog
$ watchmedo shell-command \
              --patterns="*.txt" \
              --ignore-pattern='_build/*' \
              --recursive \
              --command='make html'

Comments:

holiday packages:

What i don't realize is in fact how you're no longer really much more well-appreciated than you might be now. You're so intelligent. You recognize therefore considerably with regards to this topic, made me personally believe it from numerous numerous angles. Its like men and women don't seem to be fascinated unless it's one thing to do with Girl gaga! Your individual stuffs outstanding. Always take care of it up!

Peter Sagerson:

I've found this problematic when saving multiple files, as it will result in multiple simultaneous builds. Sphinx doesn't really like that. Even saving a single file with vim tends to generate multiple filesystem events. watchmedo would probably benefit from some kind of aggregation/serialization feature, but the following works well enough for me in the meantime:

watchmedo shell-command --command=echo ... | while read line; do make html; done

Ramiro Morales:

Thanks Jacob for the pointer to the watchmedo module and for a great tip.

On Linux, I've had more success with a slightly modified version that includes the --wait option to watchmedo.

Leave a comment:

Use your real name, or risk deletion.

Optional.

No markup allowed. Linebreaks will be converted; links will be linkified.

Be nice; don't be that guy.