How to Install Sphinx

This post summarizes how to install sphinx on Windows to contribute to PyQGIS Cookbook. I’m writing this as I go, so this most likely won’t be perfect.

I used my Python 2.6 stand-alone installation (not the one in OSGeo4W).

  1. Get the Sphinx egg from http://pypi.python.org/pypi/Sphinx
  2. If you don’t have it, install setuptools to get the easy_install script http://pypi.python.org/pypi/setuptools
  3. In C:\Python26\Scripts run easy_install -U sphinx
  4. Get the PyQGIS source from https://github.com/qgis/QGIS-Developer-Cookbook
  5. Create a build folder inside the QGIS-Developer-Cookbook
  6. Now you can build the Cookbook: sphinx-build "C:\Users\Anita\QGIS\QGIS-Developer-Cookbook\source" "C:\Users\Anita\QGIS\QGIS-Developer-Cookbook\build"

The build folder should now contain the Cookbook .html files.

Advertisement
4 comments
    • underdark said:

      Hi Yves,
      I’m sorry, could you explain how bootstrap.py makes working with Sphinx easier? Right now, I just have to execute one function from command line. Seems simple to me. Thank you!

      • Hi,
        I think this is mainly a best practice rather making things easier. Here some though about why use a bootstrap.py script with buildout config:
        * if you are working on several documentation with different configuration, different sphinx version, you have one virtual env for each documentation and you don’t “pollute” your system.
        * if several contributors are working together, you are sure that all contributor will have the same version of sphinx and other dependancies.

        Finally I always used the MakeFile created: on Windows this is something like “make.bat html”

        Y.

  1. alexbruy said:

    There is a make.bat file in PyQGIS directory, which can be used to create cookbook in HTML, PDF or any other Sphinx supported format. So there is no need to run sphinx-build manually. Just cd to cookbook folder and run “make.bat” to get help or “make.bat html” to get cookbook in HTML format.

%d bloggers like this: