最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin2浏览0评论

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.

发布评论

评论列表(0)

  1. 暂无评论