How could I only include classes and functions docstring instead of module docstring when using Sphinx?

63 Views Asked by At

Let's say I have a python module like below:

test.py:

__doc__ = """This is the module docstring."""

class ClassA:
    """This is ClassA's docstring"""
    pass

def func():
    """This is a test function"""
    pass

I want to display the module docstring and its class and function docstring in different pages using Sphinx. Here is what I did:

In module_doc.rst:

Doc
====

.. automodule:: test
    :special-members: __doc__

In usage_doc.rst:

Usage
======

.. automodule:: test
    :members:

In Doc page, it show only the content of __doc__ as expected. But in Usage page, the __doc__ content is also displayed above the docstring of class and function, which is not my intention.

Is there any method to solve my problem?

0

There are 0 best solutions below