Skip to main content

Sphinx "added-value" extension

Project description

A Sphinx extension for embedded representations of Python object values into documentation.

Added-value allows the values of Python objects to be incorporated into documentation. This is achieved by adding new roles and directives which refer to Python objects in the code being documented, much in the same way as the standard autodoc and autosummary extensions work.

Roles

The :repr: role inserts the repr representation of a Python object inline. For example, given a Python module called values containing an global int called the_answer, you can write:

The answer to life, the Universe and everything is :repr:`values.the_answer`.

The :str: role inserts the str representation of a Python object inline. For example, given a Python module called values containing an global int called the_answer, you can write:

The answer to life, the Universe and everything is :str:`values.the_answer`.

The :format: role inserts the format representation of a Python object inline. For example, given the Python Standard Library math module containing the float called the_answer, you can write:

The value of pi to three decimal places is :format:`math.pi, .3f`.

The optional value after the comma is a format string as used by the built-in format function and documented in the Format Specification Mini-Language

Directives

The .. items-table:: directive allows a tabular representation of a Python object to be included in documentation.

For example, given a module called values which contains a list of lists called month_lengths, where each inner list contains a month name and the number of days in that month, a table can be displayed like this:

.. items-table:: values.month_lengths
   :header: Month, Length
   :stub-columns: 1

This adds a one-row header, and highlights the first ‘stub’ column (the month names).

Project details


Download files

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

Filename, size & hash SHA256 hash help File type Python version Upload date
added_value-0.8-py2.py3-none-any.whl (11.8 kB) Copy SHA256 hash SHA256 Wheel py2.py3 May 15, 2018
added-value-0.8.tar.gz (7.5 kB) Copy SHA256 hash SHA256 Source None May 15, 2018

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging AWS AWS Cloud computing DataDog DataDog Monitoring Fastly Fastly CDN SignalFx SignalFx Supporter DigiCert DigiCert EV certificate StatusPage StatusPage Status page