最新消息:Welcome to the puzzle paradise for programmers! Here, a well-designed puzzle awaits you. From code logic puzzles to algorithmic challenges, each level is closely centered on the programmer's expertise and skills. Whether you're a novice programmer or an experienced tech guru, you'll find your own challenges on this site. In the process of solving puzzles, you can not only exercise your thinking skills, but also deepen your understanding and application of programming knowledge. Come to start this puzzle journey full of wisdom and challenges, with many programmers to compete with each other and show your programming wisdom! Translated with DeepL.com (free version)

python - Exclude inherited class methods in sphinx autosummary - Stack Overflow

matteradmin10PV0评论

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.

Post a comment

comment list (0)

  1. No comments so far