Skip to content
Snippets Groups Projects
Commit 2ceaacf9 authored by Rob Moss's avatar Rob Moss
Browse files

Simplify the sphinx autodoc configuration

We can exclude specific members (e.g., __weakref__) from the docs
using the 'exclude-members' option rather than using a custom function.
parent 11388a4f
Branches
Tags
No related merge requests found
Pipeline #68466 passed
......@@ -37,30 +37,13 @@ autodoc_mock_imports = ['h5py', 'lhs', 'numpy', 'scipy', 'tomli', 'tomli_w']
# Include class constructors (__init__) in the generated documentation.
# autoclass_content = 'both'
# Automatically document module/class members (including __init__).
# Automatically document module/class members (including __init__), while also
# ignoring certain special members (e.g., __weakref__).
autodoc_default_options = {
'members': True,
'exclude-members': '__weakref__, __doc__, __module__, __dict__',
}
# While we want documentation of special members such as __init__,
# we also want to ignore some special members (e.g., __weakref__).
# The following is taken from http://stackoverflow.com/a/21449475
def autodoc_skip_member(app, what, name, obj, skip, options):
exclusions = (
'__weakref__', # special-members
'__doc__',
'__module__',
'__dict__', # undoc-members
)
exclude = name in exclusions
return True if exclude else None
def setup(app):
app.connect('autodoc-skip-member', autodoc_skip_member)
# Make member documentation reflect the order of definition in the source.
autodoc_member_order = 'bysource'
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment