API Documentation¶
Sphinx can automatically generate API documentation from your code with Autodoc. See the Sphinx-Napoleon documentation for examples showing how to write compatible docstrings.
Example¶
With the following file in api_example/module.py
:
class ExampleClass:
def do_something(self, param1, param2):
"""Example function with a Google-style docstring.
Args:
param1 (str): The first parameter.
param2 (int): The second parameter.
Returns:
bool: True for success, False otherwise.
"""
This markup:
```eval_rst
.. autoclass:: api_example.module.ExampleClass
:members:
```
Will produce: