SedTRAILS API

This is an example about how Autodoc can render Python docstrings. Autodoc requires the sphinx.ext.autodoc extension to be enabled in conf.py, and this file to be written in reStructuredText format.

Source code must be available when rendering the documentation

This can be achieved by any of the approces explain here: https://www.sphinx-doc.org/en/master/usage/extensions/autodoc.html#ensuring-the-code-can-be-imported

A Function

sedtrails.mock_api.sum(x: int, y: int) int

Add two numbers together.

Parameters

xint

The first number.

yint

The second number.

Returns

int

The sum of the two numbers.

Examples

You can include examples in RST

from sedtrails import sum
sum(1, 2)
# Output: 3

A Class

class sedtrails.mock_api.Calculator

A simple calculator class.

add(x: int, y: int) int

Add two numbers together.

Parameters

xint

The first number.

yint

The second number.

Returns

int

The sum of the two numbers.

subtract(x: int, y: int) int

Subtract two numbers.

Parameters

xint

The first number.

yint

The second number.

Returns

int

The difference between the two numbers.