Skip to main content

Sphinx DocumentedList extension

Project description

This file provides a Sphinx extension to convert a Python list into a table in the generated documentation. The intended application of this extension is to document the items of essentially list-like objects of immutable data (possibly enums, though python 3.4 enums are not supported yet).

In the source code, each list item, instead of being just it’s native data type, should be replaced by a tuple of two elements. The second element of the tuple should be a string which provides a description for the item.

In the first use of this extension, the aim is to document a list of supported device classes (each of which is a string). This was originally specified in the python code as a list, and the same list with descriptions was manually maintained (or, in reality, left unmaintained) in the corresponding documentation. The list is now replaced with a tuple containing both the recognized strings and the description for each, and Sphinx is able to use this extension to ‘autogenerate’ the table in the documentation.

Based heavily on slides from Doug Hellman’s PyCon talk, http://www.slideshare.net/doughellmann/better-documentation-through-automation-creating-docutils-sphinx-extensions

Installation & Usage

To use this module, place the documentedlist.py file somewhere in the PYTHONPATH that Sphinx is configured to use, or add the git checkout folder to the PYTHONPATH in Sphinx’s conf.py.

In the .rst file where the table should appear, insert the Sphinx directive provided by this module :

.. documentedlist::
    :listobject: full.importable.path.of.thelist

This extension will import the list as :

from full.importable.path.of import thelist

For a usage example, see:

https://github.com/chintal/tendril/blob/public/tendril/conventions/electronics.py#L28

and the corresponding documentation generated at:

http://tendril.chintal.in/userdoc/conventions/gedasymbols/#device-classes

License

This Sphinx Extension is made available under the BSD 2-clause License. See sphinxcontrib’s LICENSE file for the full text.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sphinxcontrib-documentedlist-0.1.tar.gz (3.9 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file sphinxcontrib-documentedlist-0.1.tar.gz.

File metadata

File hashes

Hashes for sphinxcontrib-documentedlist-0.1.tar.gz
Algorithm Hash digest
SHA256 b148237abc87abace57f023627cb717ca3e2c94d9ed838cada74332cb6c62216
MD5 f9b9a6de3b1c6579624ec4f0b9b6326f
BLAKE2b-256 56de5a5fa0f6a571de27720a451ca9101f610b191da95081ae39b8c00b5315d7

See more details on using hashes here.

Provenance

File details

Details for the file sphinxcontrib_documentedlist-0.1-py2-none-any.whl.

File metadata

File hashes

Hashes for sphinxcontrib_documentedlist-0.1-py2-none-any.whl
Algorithm Hash digest
SHA256 d1e930e7830dd3673be6cebe58a082faa66fdb94aa90d2d35c736b99d375addf
MD5 d423ab3934bae1e90f0b69c8048ebf29
BLAKE2b-256 23c7a3f638958f8132efedb00e2532698c08562456657ed520d6dfe7436a88db

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page