Sphinx Autodoc skip member from docstring

Colton Leekly-Winslow picture Colton Leekly-Winslow · Jan 29, 2015 · Viewed 9.1k times · Source

I am documenting a class with Sphinx and simple want to skip one of the classes members:

class StatusUpdateAdapter(logging.LoggerAdapter):
    """
    """
    def __init__(self, status_update_func, logger, extra={}):
        """
        """
        pass

    def log(self, *args, **kwargs):
        pass

How can I cause sphinx NOT to document the log member? I would like to do this in the StatusUpdateAdapter or log docstring's if possible.

Answer

vimist picture vimist · Aug 6, 2017

You can now (as of version 0.6) use :exclude-members: to exclude specific members from the documentation:

The directives supporting member documentation also have a exclude-members option that can be used to exclude single member names from documentation, if all members are to be documented.

New in version 0.6.

Source: http://www.sphinx-doc.org/en/stable/ext/autodoc.html

In your specific case, you would add :exclude-members: log into your .rst file.