submodule package

Introduction

This is the submodule package with its own module(s).

A subpackage

A subpackage inside a package (Source).

The following docstring was retrieved from the __init__.py file inside the submodule directory. Eventhough the need for __init__.py is deprecated, it helps the sphinx-apidoc command to identify modules in the subdirectories.

Another option to recursively search folders for modules is using the option ‘–implicit-namespaces` with the sphinx-apidoc. I preferred the structure of the .rst files generated from the method of adding __init__.py to the submodules and hence followed that method.

The submodule package contains the following modules.

Functions module

submodule.functions.multiply(a, b)

This function computes the product of the two arguments.

Parameters
  • a (float) – first argument

  • b (float) – second argument

Returns

product of the two arguments

Return type

float

See also

If this note box is rendered, then it is possible to use both docstring conventions in the python files. Here, the function descriptions above were documented using the google convention and the special annotations below were written in sphinx convention. Pretty handy!

Note

This function can accept int parameters too.

Example:

result = multiply(a,b)
submodule.functions.subtract(a, b)

This function computes the difference between the two arguments.

Parameters
  • a (float) – first argument

  • b (float) – second argument

Returns

difference between the two arguments

Return type

float

Note

This function can accept int parameters too.

Example:

result = subtract(a,b)