I would like to automatically generate pages with the summary of the submodules, and the details.
I have
|-foo
| |- __init__.py
| |- bar.py
|-docs
| |- conf.py
| |- Makefile
| |- make.bat
| |- index.rst
foo/bar.py:
def myfunc():
"""
This is a function.
:return: A number.
"""
return 1
def myotherfunc():
"""
This is another function
:return: A number.
"""
return 2
docs/conf.py
import os
import sys
sys.path.insert(0, os.path.abspath(".."))
project = "foo"
copyright = "2024"
author = "Tom de Geus"
exclude_patterns = ["_build"]
extensions = [
"sphinx.ext.autodoc",
"sphinx.ext.autosummary",
]
docs/index.rst
.. currentmodule:: foo
.. autosummary::
:toctree: generated
bar
This is what I get (and want in red):

In particular, I would like to add
.. automodule:: foo.bar
:members:
to docs/generated/foo.bar.rst, that is currently:
foo.bar
=======
.. automodule:: foo.bar
.. rubric:: Functions
.. autosummary::
myfunc
myotherfunc