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.

Source Distribution

added-value-0.8.tar.gz (7.5 kB view details)

Uploaded Source

Built Distribution

added_value-0.8-py2.py3-none-any.whl (11.8 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file added-value-0.8.tar.gz.

File metadata

  • Download URL: added-value-0.8.tar.gz
  • Upload date:
  • Size: 7.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for added-value-0.8.tar.gz
Algorithm Hash digest
SHA256 84f1dced8e72941718545e39ce141bafa95e7fda816a3b92113c45d27245acc6
MD5 99bf54e25538c6624a9d7f0c54bdcdd2
BLAKE2b-256 05b5bc1d1229689cfbaba3dedf19b4ab2960a1ef88a05000bfdf4b13025f7cdb

See more details on using hashes here.

Provenance

File details

Details for the file added_value-0.8-py2.py3-none-any.whl.

File metadata

File hashes

Hashes for added_value-0.8-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 c10a1ca36daf0bddc7f6d5d52edc793b95dd5596f3443defc6dd52d26aa6d3d8
MD5 c6f8967b645b8b31510f51e4bbd6c1fb
BLAKE2b-256 38a6954227b509971536ffc4d32019cfbc4d9edb7a2e9983384c4d229e72c6f7

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