admin管理员组

文章数量:1435859

I have a Python package and want to generate the API documentation with the autosummary extension of sphinx.

The problem I am running into is that my main package class inherits from PyTorch's nn.Module, and when running autosummary on my package, it tries to document all the methods in nn.Module, which I don' want.

Is there a way to make autosummary ignore these inherited methods?

I am also using my autosummary call is as follows:

.. autosummary::
    :toctree: generated/
    :recursive:

    my_package

My problematic class is in the module my_package.model.MyClass.

I have tried playing with the autodoc_default_options:

autodoc_default_options = {
    'members': True,
    'undoc-members': False,
    'private-members': False,
    'special-members': False,
    'inherited-members': False,
    'show-inheritance': True,
    'module-first': True,
}

But this didn't work.

本文标签: pythonExclude inherited class methods in sphinx autosummaryStack Overflow