beanbag-docutils

This is a set of extensions to the Sphinx ReStructuredText-based documentation system used by our products to help generate better documentation

Amongst other enhancements, this package offers:

  • A parser for the Beanbag docstring format (a variation on the Google docstring format), which we use for Python and JavaScript documentation

  • Enhancements for Sphinx’s intersphinx system to provide per-page intersphinx resolution options (useful for pages, such as release notes, that need to link to different versions of the same docs, such as Django or Python)

  • Enhancements to ReStructuredText references to let a reference name span lines (useful for long Python/JavaScript module/class names)

  • Linking code references to GitHub documentation

  • High-DPI image embedding

  • A role for HTTP status codes

Installation

It’s very easy to get going. Just install beanbag-docutils like so:

$ pip install beanbag-docutils

We like to place ours in a doc-requirements.txt file in each of our repositories, and use:

$ pip install -r doc-requirements.txt

Sphinx Extensions

The following extensions are provided:

autodoc_utils
  • Enables parsing of the Beanbag docstring format for Python.

  • Advanced options for defining excluded and deprecated classes/functions to skip, either in a Sphinx project’s conf.py or directly in the Python modules.

collect_files
  • Allows arbitrary supplemental files to be “collected” along with any of your documentation.

django_utils
  • Roles and directives for describing Django-related concepts in your documentation.

  • Automatic support for resolving “lazy” localized strings, so they appear correctly.

extlinks
  • An improved version of Sphinx’s own sphinx.ext.extlinks that supports anchors in the string passed to the role (e.g., :myext:`name#anchor`).

github
  • Provides links to the appropriate versions of the tree in GitHub for any source code references, instead of bundling copies of the source code with the documentation.

http_role
  • Provides a http role for specifying HTTP status codes and linking them to useful documentation.

intersphinx_utils
  • Allows individual documentation pages to specify which intersphinx mappings should be used if multiple mappings contained the same reference. Useful for having, say, different release notes pages linking to different versions of Python or Django documentation.

ref_utils
  • Allows Python and JavaScript references to span multiple lines, in case of very long class or module paths.

retina_images
  • Collects all high-DPI versions of images (e.g., any with a @2x in the filename) for the resulting documentation.

See Also

  • Other Projects:

    • Review Board - Our extensible open source code review product.

    • RBCommons - Our Review Board SaaS.

    • Django Evolution - Advanced schema migration for Django, compatible with Django’s migrations.

    • Djblets - A set of utilities and infrastructure for Django-based projects.

    • kgb - Function spies for Python unit tests.

    • RBTools - Command line tools for Review Board and RBCommons.