ant-python

Autorst

Description

This task automatically creates RST files from Python files present in a directory. The Sphinx documentation can then be built using Sphinxdoc task. The RST files are organized in the same way as the Python packages.

Note

Empty Python files (e.g. __init__.py) are automatically skipped.

Parameters

Attribute Description Required
dir Directory containing the distribution source code (.py files). yes
todir Directory where the RST files will be saved. yes
showInheritance Whether to show the inheritance of classes in the documentation. no, defaults to true
undocMembers Whether to show methods with no documentation. no, defaults to true
inheritedMembers Whether to show methods from inherited classes. no, defaults to false
specialMembers Whether to show special methods (i.e. __special__) no, defaults to false
privateMembers Whether to show private methods (i.e. _private or __private) no, defaults to false

Parameters specified as nested elements

fileset or any other resource collection

Specify which files to include or exclude from the search. This can be useful to exclude a package that should not be part of the Python distribution.

Examples

Let takes the package foo.bar containing one Python module hello.py. Running the <autorst> task:

<autorst dir="${path.to.package}"
         todir="${doc.dir}"
         showInheritance="false" />

will create a hello.rst file in ${doc.dir}/foo/bar with the following content:

.. automodule:: foo.bar.hello
   :members:
   :undoc-members: