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
Type: bool
Required: False
Default: False

Determines whether the fully qualified name should be shown for bases.

If False (the default):

class Foo

Bases: List[str]

If True:

class Foo

Bases: typing.List[str]

Corresponds to the fully_qualified argument to sphinx_toolbox.more_autodoc.typehints.format_annotation().

New in version 2.13.0.

Example

class Example(iterable=())[source]

Bases: List[Tuple[str, float, List[str]]]

An example of sphinx_toolbox.more_autodoc.generic_bases.

API Reference

class GenericBasesClassDocumenter(*args)[source]

Bases: PatchedAutoSummClassDocumenter

Class documenter that adds inheritance info, with support for generics.

add_directive_header(sig)[source]

Add the directive header.

Parameters

sig (str)

setup(app)[source]

Setup sphinx_toolbox.more_autodoc.generic_bases.

New in version 1.5.0.

Parameters

app (Sphinx) – The Sphinx application.

Return type

SphinxExtMetadata