43. py2rst — Automatic generation of documentation

This module provides the tools to automatically generate the documentation for a pyFormex module. It is mainly intended for use by the ‘pyformex –docmodule’ command option.

This command automatically extracts class & function docstrings and argument list from a module and ships out the information in a format that can be used by the Sphinx document preprocessor.

43.1. Functions defined in module py2rst

py2rst.add_indent(s, n)[source]

Indent all lines of a multiline string with n blanks.

py2rst.sanitize(s)[source]

Sanitize a string for LaTeX.

py2rst.filter_local(name, fullname)[source]

Filter definitions to include in doc

We only include names defined in the module itself.

py2rst.check_declared_members(obj)[source]

Check if obj has declared members

Currently 3 members declarations are acknowledged: _members_ _special_members_ _exclude_members_

py2rst.get_py_members(module, fullname)[source]

Select the attributes, classes and functions from module

py2rst.get_c_members(members)[source]

Select the attributes, classes and functions from module

py2rst.do_module(modname, outfile=None)[source]

Process a module.

Prints the documentation of the module in .rst format. The output has to be processes by sphinx using autodoc to generate the full documentation. This is done with the make html command in the top directory of the pyFormex source.

Parameters:

modname (str) – Name of the module in Python dotted style. The pyformex. part may be omitted.