Skip to content

Commit

Permalink
Change docs config to accomodate uniquified classes
Browse files Browse the repository at this point in the history
When generating documentation for class with decorators that override
new, documentation for the class is missing and sphinx warns that
maximum recursion depth was exceeded in default conf configuration
settings. This is because `__init__` and `__new__` are kind of
special methods and have special handling by the ModuleAnalyzer. So,
the sphinx codebase does not accomodate these by default.

To work around these, changes are needed to how autodoc is processed:

 - Exclude `__init__` and `__new__`
 - Seperate class signature from `__init__`

Reference: sphinx-doc/sphinx#12276
  • Loading branch information
girishmm committed Apr 22, 2024
1 parent b550503 commit 2d66718
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions docs/source/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,19 +24,25 @@

# -- Default options for autodoc ---------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#confval-autodoc_default_options

add_module_names = False
autodoc_class_signature = "separated"
autodoc_default_options = {
"members": True,
"member-order": "bysource",
"member-order": "groupwise",
"undoc-members": True,
"exclude-members": "__init__, __new__, metadata",
"show-inheritance": True,
"inherited-members": True,
}

# -- Places to look for intersphinx ------------------------------------------
# https://www.sphinx-doc.org/en/master/usage/extensions/intersphinx.html

intersphinx_disabled_reftypes = ["*"]
intersphinx_mapping = {
"python": ("https://docs.python.org/3", None),
"pandas": ("https://pandas.pydata.org/docs", None),
"sqlalchemy": ("https://docs.sqlalchemy.org/en/20", None),
}

# -- Options for HTML output -------------------------------------------------
Expand Down

0 comments on commit 2d66718

Please sign in to comment.