more_autodoc.generic_bases¶
Modifies sphinx.ext.autodoc.ClassDocumenter's :show-inheritence: option
to show generic base classes.
This requires a relatively new version of the typing module that implements __orig_bases__.
New in version 1.5.0.
Enable sphinx_toolbox.more_autodoc.generic_bases by adding the following
to the extensions variable in your conf.py:
extensions = [
...
'sphinx_toolbox.more_autodoc.generic_bases',
]
For more information see https://www.sphinx-doc.org/en/master/usage/extensions#third-party-extensions .
Configuration¶
- generic_bases_fully_qualified¶
-
Determines whether the fully qualified name should be shown for bases.
If
False(the default):If
True:- class Foo
Bases:
typing.List[str]
Corresponds to the
fully_qualifiedargument tosphinx_toolbox.more_autodoc.typehints.format_annotation().New in version 2.13.0.
Example¶
API Reference¶
- class GenericBasesClassDocumenter(*args)[source]¶
Bases:
PatchedAutoSummClassDocumenterClass documenter that adds inheritance info, with support for generics.
- setup(app)[source]¶
Setup
sphinx_toolbox.more_autodoc.generic_bases.New in version 1.5.0.
- Parameters
app (
Sphinx) – The Sphinx application.- Return type