Thomas
Thomas

Reputation: 1377

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

I want to write some documentation in the module which should be at one point of my documentation. At this point I don't want to document all the classes/members of the module. This can be easily done with

..automodule:: myModule
  :no-members:

However, at another point of my documentation I want to document all the classes of myModule. I could do this with

..automodule:: myModle
  :members:
  :noindex:

Unfortunately, this also includes the documentation of the module itself which I already have in my documentation and which I don't want to have here, again.

Is there a way to show only the documentation of all the members of myModule but not the documentation of myModule itself without having to list all the members manually?

Upvotes: 0

Views: 1861

Answers (1)

Thomas
Thomas

Reputation: 1377

Thanks to the comments I was able to solve the problem. Adding the following lines to conf.py does the trick:

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)

Upvotes: 1

Related Questions