I have several projects with one repository per project. One of these repository manages a global documentation, all the others are python packages.
I would like to keep each package documentation independent (not only the module documentation but also installation instruction/examples/etc.). In other words, each package is responsible of its own documentation.
The main documentation repository should include all documentations (and add some structure over it together with some text to link all these packages together). I'm looking for a simpler/cleaner solution than what I have for now.
Current solution
Package documentation
Each package has a doc/
folder, which contains both a module_description.rst
(structured autodoc statements). For example, for package_name
that would look more or less like this:
Interface
----------
.. autoclass:: package_name.AbstractClass
:members:
:undoc-members:
:member-order: bysource
Basic implementations
---------------------
.. autoclass:: package_name.ImplementationOne
:members:
:undoc-members:
:member-order: bysource
.. autoclass:: package_name.ImplementationTwo
:members:
:undoc-members:
:member-order: bysource
The second file I have is a index.rst
which look like:
.. toctree::
:glob:
:hidden:
:maxdepth: 2
module_description
tutorials/*
examples/*
############
Package Name
############
Install instructions
====================
.. code-block:: bash
pip install package_name
Main doc
The main documentation includes a reference to a document that contains only one line:
.. include:: ../../submodules/package_name/doc/_sources/index.rst
To make this work, as you probably guessed, I used a git submodule that points to package_name
repository and allows me to get the file package_name/doc/_sources/index.rst
. Doing this alone wont work as the autodoc statements wouldn't find the module package_name
.
I therefore need to install the package in the main documentation. I have two options, either I install it from the submodule, or directly from the package registry (both are fine with me).
Question
Can I avoid adding a git submodule and only install package_name
? If so, how can I include its doc/index.rst
from the main sphinx documentation?
Maybe there is even a better approach, but I can't find any article on this. Any reference would be welcome as I struggle finding the right words to ask my search engine friend.
Note that I have a constraint, I want gitlab to generate pages from this main documentation build.