Merge pull request #6979 from tk0miya/6830_autodoc_private

Close #6830: autodoc: consider a member private if docstring contains :private:
This commit is contained in:
Takeshi KOMIYA
2020-01-11 15:14:52 +09:00
committed by GitHub
11 changed files with 176 additions and 5 deletions

View File

@@ -140,6 +140,20 @@ inserting them into the page source under a suitable :rst:dir:`py:module`,
.. versionadded:: 1.1
* autodoc considers a member private if its docstring contains
``:meta private:`` in its :ref:`info-field-lists`.
For example:
.. code-block:: rst
def my_function(my_arg, my_other_arg):
"""blah blah blah
:meta private:
"""
.. versionadded:: 3.0
* Python "special" members (that is, those named like ``__special__``) will
be included if the ``special-members`` flag option is given::

View File

@@ -354,6 +354,9 @@ Info field lists
~~~~~~~~~~~~~~~~
.. versionadded:: 0.4
.. versionchanged:: 3.0
meta fields are added.
Inside Python object description directives, reST field lists with these fields
are recognized and formatted nicely:
@@ -367,6 +370,10 @@ are recognized and formatted nicely:
* ``vartype``: Type of a variable. Creates a link if possible.
* ``returns``, ``return``: Description of the return value.
* ``rtype``: Return type. Creates a link if possible.
* ``meta``: Add metadata to description of the python object. The metadata will
not be shown on output document. For example, ``:meta private:`` indicates
the python object is private member. It is used in
:py:mod:`sphinx.ext.autodoc` for filtering members.
.. note::