I am having trouble getting sphinx to create a summary table for modules. I have added sphinx.ext.autosummary
to my conf.py
file and I am using numpydoc
. Sphinx seems to create the summary table for attributes and methods on a class, but it does not create a summary table for the module that contains the class.
I created a minimal working example (MWE) to test this out. The MWE project just has an __init__.py
and which imports generic_module
. The contents of generic_module
are:
def foo(a, b):
"""
Adds a + b
"""
return(a+b)
def bar(a, b):
"""
Subtracts a + b
"""
return(a-b)
class onetwo(object):
"""
Adds 1 or 2
"""
def __init__(self):
self.whatever = 1
def one(self, a):
"""
Adds one to a
"""
return(a + 1)
def two(self,a):
"""
Adds two o a
"""
return(a + 2)
Sphinx auto documents foo
, bar
, and onetwo
. It also creates a nice summary of the methods on onetwo
. However, it does not create a summary table at the top of the page for generic_module
.
I know that I can add .. autosummary::
to my generic_module.rst
file, as documented here. However, I have to list each and every function on my module to get that to work. I would think the autosummary
extension could do this for me.