Exclude docstring module in autodoc

I am trying to use autodoc in Sphinx to print the docstrings of each function in a specific module, but to exclude the docstring module. Is it possible?

The reason is because I use docstring modules to specify command line options (with a nice docopt).

+4
source share
1 answer

Add the following to conf.py :

def remove_module_docstring(app, what, name, obj, options, lines): if what == "module" and name == "yourmodule": del lines[:] def setup(app): app.connect("autodoc-process-docstring", remove_module_docstring) 

This code removes the docstring module of yourmodule module by providing an autodoc-process-docstring event handler.

+3
source

Source: https://habr.com/ru/post/1494081/


All Articles