Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Automatically build Sphinx documentation when a source file changes

Tags:

I'm using Sphinx to document one of my projects, and I like to preview my changes in my browser. I want to be able to save some changes to an .rst file, and be able to immediately refresh my browser and see the changes.

Essentially I want to automatically execute a make html whenever one of the .rst files is changed.

like image 211
bradley.ayers Avatar asked Apr 02 '11 09:04

bradley.ayers


People also ask

What does Sphinx Autodoc do?

autodoc imports the modules to be documented. If any modules have side effects on import, these will be executed by autodoc when sphinx-build is run. If you document scripts (as opposed to library modules), make sure their main routine is protected by a if __name__ == '__main__' condition.


1 Answers

You can use sphinx-autobuild.

It is easy to use, for example:

sphinx-autobuild docs docs/_build/html

or, if you have a separate build dir,

sphinx-autobuild source build/html

It will also automatically initiate a page refresh in the browser.

like image 71
Andy Lee Avatar answered Sep 30 '22 09:09

Andy Lee