sphinx.ext.inheritance_diagram – Include inheritance diagrams¶
New in version 0.6.
This extension allows you to include inheritance diagrams, rendered via the
It adds this directive:
This directive has one or more arguments, each giving a module or class name. Class names can be unqualified; in that case they are taken to exist in the currently described module (see
For each given class, and each class in each given module, the base classes are determined. Then, from all classes and their base classes, a graph is generated which is then rendered via the graphviz extension to a directed graph.
This directive supports an option called
partsthat, if given, must be an integer, advising the directive to remove that many parts of module names from the displayed names. (For example, if all your class names start with
lib., you can give
:parts: 1to remove that prefix from the displayed node names.)
It also supports a
private-basesflag option; if given, private base classes (those whose name starts with
_) will be included.
You can use
captionoption to give a caption to the diagram.
Changed in version 1.1: Added
private-basesoption; previously, all bases were always included.
Changed in version 1.5: Added
New config values are:
A dictionary of graphviz graph attributes for inheritance diagrams.
inheritance_graph_attrs = dict(rankdir="LR", size='"6.0, 8.0"', fontsize=14, ratio='compress')
A dictionary of graphviz node attributes for inheritance diagrams.
inheritance_node_attrs = dict(shape='ellipse', fontsize=14, height=0.75, color='dodgerblue1', style='filled')
A dictionary of graphviz edge attributes for inheritance diagrams.