Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Combining Sphinx documentation from multiple subprojects: Handling indices, syncing configuration, etc

We have a multi-module project documented with the (excellent) Sphinx. Our setup is not unlike one described on the mailing list. Overall this works great! But we have a few questions about doing so:

  1. The submodule tables of contents will include index links. At best these will link to the wrong indices. (At worst this seems to trigger a bug in Sphinx, but I'm using the devel version so that's reasonable). Is there a way of generating the index links only for the topmost toctree?

  2. Are there best practices for keeping the Sphinx configuration in sync between multiple projects? I could imagine hacking something together around from common_config import *, but curious about other approaches.

  3. While we're at it, the question raised in the mailing list post (alternative to symlinking subproject docs?) was never answered. It's not important to me, but it may be important to other readers.

like image 861
Ken Arnold Avatar asked Jun 13 '11 18:06

Ken Arnold


1 Answers

  1. I'm not sure what you mean by this. Your project's index appears to be just fine. Could you clarify on this, please?
  2. As far as I've seen, from common_config import * is the best approach for keeping configuration in sync.
  3. I think the best way to do this is something like the following directory structure:

    main-project/
     conf.py
     documentation.rst
    
     sub-project-1/
        conf.py - imports from main-project/conf.py
        documentation.rst
    
     sub-project-2/
        conf.py - likewise, imports from main-project/conf.py
        documentation.rst
    

    Then, to just package sub-project-1 or sub-project-2, use this UNIX command:

    sphinx-build main-project/ <output directory> <paths to sub-project docs you want to add>
    

    That way, not only will the main project's documentation get built, the sub-project documentation you want to add will be added as well.

    To package main-project:

    sphinx-build main-project/ <output directory>
    

    I'm pretty sure this scheme will work, but I've yet to test it out myself.

Hope this helps!

like image 77
DangerOnTheRanger Avatar answered Nov 21 '22 21:11

DangerOnTheRanger