Perspective Unspoken

My perspective on Git, Docker, Python, Django, PHP and other stuff

Building Sphinx docs with watchdog under Docker or Vagrant

The watchdog  library is a cool library that allows you to watch for changes then execute some command. This doesn’t work at all out of the box when you try running the command on a Docker or Vagrant box, because by default the observer that watchdog uses doesn’t look for changes that are made outside the filesystem.

Here’s a small script that will listen for changes to all your *.rst files and rebuild the docs appropriately. Assuming your docs directory exists at /code/docs .

The code is based on the example shown on PyPi, however, the main bit is to change the observer  to a PollingObserver .



jaywhy13 • April 26, 2016

Previous Post

Next Post