File: directives.rst

package info (click to toggle)
sphinx-autoapi 3.6.1-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 884 kB
  • sloc: python: 5,260; makefile: 7
file content (66 lines) | stat: -rw-r--r-- 2,023 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
Directives
==========

.. _autodoc-directives:

Autodoc-Style Directives
------------------------

You can opt to write API documentation yourself using autodoc style directives.
These directives work similarly to autodoc,
but docstrings are retrieved through static analysis instead of through imports.

.. seealso::

    When transitioning to autodoc-style documentation,
    you may want to turn the :confval:`autoapi_generate_api_docs`
    option off so that automatic API documentation is no longer generated.

To use these directives you will need to enable the autodoc extension
in your Sphinx project's ``conf.py``:

.. code:: python

    extensions = ['sphinx.ext.autodoc', 'autoapi.extension']


For Python, all directives have an autodoc equivalent
and accept the same options.
The following directives are available:

.. rst:directive:: autoapimodule
                   autoapiclass
                   autoapiexception

    Equivalent to :rst:dir:`automodule`, :rst:dir:`autoclass`,
    and :rst:dir:`autoexception` respectively.
    :confval:`autodoc_inherit_docstrings` does not currently work.

.. rst:directive:: autoapifunction
                   autoapidata
                   autoapimethod
                   autoapiattribute

    Equivalent to :rst:dir:`autofunction`, :rst:dir:`autodata`,
    :rst:dir:`automethod`, and :rst:dir:`autoattribute` respectively.


Inheritance Diagrams
--------------------

.. rst:directive:: autoapi-inheritance-diagram

    This directive uses the :mod:`sphinx.ext.inheritance_diagram` extension
    to create inheritance diagrams for classes.

    For example:

    .. autoapi-inheritance-diagram:: autoapi._objects.PythonModule autoapi._objects.PythonPackage
        :parts: 1

    :mod:`sphinx.ext.inheritance_diagram` makes use of the
    :mod:`sphinx.ext.graphviz` extension,
    and therefore it requires `Graphviz <https://graphviz.org/>`_ to be installed.

    The directive can be configured using the same options as
    :mod:`sphinx.ext.inheritance_diagram`.