Sphinx:如何记录模块的所有 classes/members 而不是模块本身

Sphinx: How do I document all classes/members of a module but not the module itself

我想在模块中编写一些文档,这些文档应该在我的文档的某个位置。此时我不想记录模块的所有 classes/members。这可以通过

轻松完成
..automodule:: myModule
  :no-members:

但是,在我的文档的另一点,我想记录 myModule 的所有 类。我可以用

做到这一点
..automodule:: myModle
  :members:
  :noindex:

不幸的是,这还包括模块本身的文档,我已经在我的文档中,但我不想再在这里了。

有没有办法只显示 myModule 所有成员的文档而不显示 myModule 本身的文档,而不必手动列出所有成员?

多亏了评论,我才得以解决问题。将以下行添加到 conf.py 就可以了:

def remove_module_docstring(app, what, name, obj, options, lines):
    if what == "module" and name == "hpclogging.logger" and 'members' in options:
        del lines[:]

def setup(app):
    app.connect("autodoc-process-docstring", remove_module_docstring)