I'm trying to extract from my module the docstrings and build a nice documentation. So here I am with Sphinx, and I can't figure out what's wrong.
My class docstring, inside the _meta file:
class MasterBlock(object):
"""
Main class for block architecture. All blocks should inherit this class.
Methods
-------
main()
Override it to define the main function of this block.
add_input(Link object)
Add a Link object as input.
add_output(Link object)
Add a Link as output.
start()
Start the main() method as a Process.
stop()
Stops the process.
"""
my .rst :
Meta
==========================
.. automodule:: crappy.blocks._meta
:members:
:undoc-members:
:show-inheritance:
My configuration file for Sphinx (the part I changed):
autoclass_content = 'both'
extensions = ['sphinx.ext.autodoc','sphinx.ext.napoleon']
napoleon_numpy_docstring = True
When I try make html, it works (no error on this module), but it doesn't display the "Methods" section. If I remove it in the docstring, the only difference it makes with the html is that listed method below are no longer links.
What am I missing?
You should try using the numpydoc Sphinx extension. Once you've installed it then you simply include it in your list of Sphinx extensions:
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.napoleon', 'numpydoc']
In conf.py you then have access to the following options:
numpydoc_show_class_members: boolWhether to show all members of a class in the Methods and Attributes sections automatically.
Trueby default.
numpydoc_show_inherited_class_members: boolWhether to show all inherited members of a class in the Methods and Attributes sections automatically. If it's false, inherited members won't shown.
Trueby default.
numpydoc_class_members_toctree: boolWhether to create a Sphinx table of contents for the lists of class methods and attributes. If a table of contents is made, Sphinx expects each entry to have a separate page.
Trueby default.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With