4

I am having issues with generating documentation using Sphinx for a python package which contains an external c++ module which uses pybind11 to generate the Python bindings.

The problem I have is that the compiled module contains several submodules, yet autosummary with the :recursive: option only appears to find the functions and classes of the highest level module. My impression is that the issue resides in that there is no explicit __init__.py file for each submodule since the bindings are all packed into one .so binary. Is there any way around this?

I am using Python 3.8 and Sphinx 3.2.1. And this is my index.rst:

.. toctree::
   :hidden:

   Home page <self>
   Examples <examples>
   API reference <_autosummary/mypackage>

And this is the api.rst:

API Reference
=============

.. autosummary::
   :toctree: _autosummary
   :template: custom-module-template.rst
   :recursive:

   mypackage
Tom de Geus
  • 5,625
  • 2
  • 33
  • 77
esocrats
  • 178
  • 5
  • Does [`--implicit-namespaces`](https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html#cmdoption-sphinx-apidoc-implicit-namespaces) do what you want? C++ also supports namespaces https://www.sphinx-doc.org/en/master/usage/restructuredtext/domains.html#id6 – Steve Piercy May 17 '21 at 04:53
  • Is it possible to set this option in the `conf.py` file? – esocrats May 18 '21 at 09:56
  • `implicit_namespaces` is an option to **sphinx-apidoc**. It is not something that can be set in conf.py and it has nothing to do with `autosummary`. – mzjn May 18 '21 at 10:42

0 Answers0