Skip to content

Navigation Menu

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 1c84927

Browse filesBrowse files
authored
Merge pull request #30085 from story645/api-guidance
2 parents 11665b8 + c3987ee commit 1c84927
Copy full SHA for 1c84927

File tree

1 file changed

+32
-31
lines changed
Filter options

1 file changed

+32
-31
lines changed

‎doc/devel/document.rst

Copy file name to clipboardExpand all lines: doc/devel/document.rst
+32-31Lines changed: 32 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -399,11 +399,14 @@ expression in the Matplotlib figure. In these cases, you can use the
399399

400400
.. _writing-docstrings:
401401

402-
Write docstrings
403-
================
402+
Write API documentation
403+
=======================
404404

405-
Most of the API documentation is written in docstrings. These are comment
406-
blocks in source code that explain how the code works.
405+
The API reference documentation describes the library interfaces, e.g. inputs, outputs,
406+
and expected behavior. Most of the API documentation is written in docstrings. These are
407+
comment blocks in source code that explain how the code works. All docstrings should
408+
conform to the `numpydoc docstring guide`_. Much of the ReST_ syntax discussed above
409+
(:ref:`writing-rest-pages`) can be used for links and references.
407410

408411
.. note::
409412

@@ -412,11 +415,11 @@ blocks in source code that explain how the code works.
412415
you may see in the source code. Pull requests updating docstrings to
413416
the current style are very welcome.
414417

415-
All new or edited docstrings should conform to the `numpydoc docstring guide`_.
416-
Much of the ReST_ syntax discussed above (:ref:`writing-rest-pages`) can be
417-
used for links and references. These docstrings eventually populate the
418-
:file:`doc/api` directory and form the reference documentation for the
419-
library.
418+
The pages in :file:`doc/api` are purely technical definitions of
419+
layout; therefore new API reference documentation should be added to the module
420+
docstrings. This placement keeps all API reference documentation about a module in the
421+
same file. These module docstrings eventually populate the :file:`doc/api` directory
422+
and form the reference documentation for the library.
420423

421424
Example docstring
422425
-----------------
@@ -866,6 +869,26 @@ Plots can also be directly placed inside docstrings. Details are in
866869
An advantage of this style over referencing an example script is that the
867870
code will also appear in interactive docstrings.
868871

872+
.. _inheritance-diagrams:
873+
874+
Generate inheritance diagrams
875+
-----------------------------
876+
877+
Class inheritance diagrams can be generated with the Sphinx
878+
`inheritance-diagram`_ directive.
879+
880+
.. _inheritance-diagram: https://www.sphinx-doc.org/en/master/usage/extensions/inheritance.html
881+
882+
Example:
883+
884+
.. code-block:: rst
885+
886+
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
887+
:parts: 2
888+
889+
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
890+
:parts: 2
891+
869892
.. _writing-examples-and-tutorials:
870893

871894
Write examples and tutorials
@@ -1173,28 +1196,6 @@ Use the full path for this directive, relative to the doc root at
11731196
found by users at ``http://matplotlib.org/stable/old_topic/old_info2``.
11741197
For clarity, do not use relative links.
11751198

1176-
1177-
.. _inheritance-diagrams:
1178-
1179-
Generate inheritance diagrams
1180-
-----------------------------
1181-
1182-
Class inheritance diagrams can be generated with the Sphinx
1183-
`inheritance-diagram`_ directive.
1184-
1185-
.. _inheritance-diagram: https://www.sphinx-doc.org/en/master/usage/extensions/inheritance.html
1186-
1187-
Example:
1188-
1189-
.. code-block:: rst
1190-
1191-
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
1192-
:parts: 2
1193-
1194-
.. inheritance-diagram:: matplotlib.patches matplotlib.lines matplotlib.text
1195-
:parts: 2
1196-
1197-
11981199
Navbar and style
11991200
----------------
12001201

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.