Skip to main content

Sphinx collections extension for mapping directories and services as document folders

Project description

Complete documentation: http://sphinx-collections.readthedocs.io/en/latest/

Welcome to

https://github.com/useblocks/sphinx-collections/raw/master/docs/_static/sphinx_collections_logo.png

Sphinx-Collections is a Sphinx extension to collect and generate additional files from different sources. These files are added to the Sphinx Source Folder, so that Sphinx takes them into account for the overall documentation build.

Sphinx Collections supports multiple collections, where each collection has its own source and target folder, specific configuration and use case based driver.

https://github.com/useblocks/sphinx-collections/raw/master/docs/_static/sphinx_collections_chart.png

A collection can be activated by default or its usage can be triggered by Sphinx tags.

Depending on the usage of a specific collection for a build, its content integration can be controlled by the if-collection:: directive .

Following use cases are supported:

Sphinx-Collections cares about keeping your collection folders clean before and after each build.

Installation

Install via pip: pip install sphinx-collections.

Then add the extension to the conf.py file of your Sphinx project:

extensions = [
    "sphinx_collections",
    # other extensions
]

Introduction

Sphinx-Collections gets completely configured by variables inside the conf.py file of your Sphinx project:

collections = {
   'my_files': {
      'driver': 'copy_folder',
      'source': '../../extra_files/'
   }
}

The driver copy_folder allows to copy local folders and their files into your Sphinx project. There are other drivers available, which support different use cases and file locations.

By default all files get copied to _collections/ + collection_name, so in this example the complete path inside your documentation folder would be _collections/my_files/. The location can be set specific for each collection by using target option.

Then you can reference the copied files by using a toctree:

.. toctree::
   _collections/my_files/index

Please see the documentation of the needed Driver to know which options are available and necessary.

Tag based collections

Use Sphinx tags to collect and integrate only needed data:

 collections = {
   'my_files': {
      'driver': 'copy',
      'source': '../../extra_files/',
      'tags': ['user_manual'],  # gets active, if "user_manual" is set as tag
      'active': False,  # by default, collection shall not be executed
   }
}

Then run sphinx-build with -t option:

sphinx-build -b html -t user_manual . _build/html

Collection based content

Use if-collection to add content to a page only, if a specified collections has been executed successfully.

.. if-collection:: my_test, my_data

   My Test & Data chapter
   ----------------------

    .. toctree::

      /_collections/my_test/index
      /_collections/my_data/index

For more information take a look into the documentation of if-collection.

Motivation

This sphinx extension is based on the needs of a software development team inside a german automotive company.

The project team was searching for a practical way to support multiple sphinx-based documentations inside a mono-repository and have the possibility to merge different documentations together or to add files based on external data.

Sphinx-Collections is part of a software bundle, which was designed to support the development of ISO 26262 compliant software. Other tools are: sphinx-needs, sphinx-test-reports, tox-envreport.

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

sphinx_collections-0.3.1.tar.gz (13.0 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sphinx_collections-0.3.1-py3-none-any.whl (16.3 kB view details)

Uploaded Python 3

File details

Details for the file sphinx_collections-0.3.1.tar.gz.

File metadata

  • Download URL: sphinx_collections-0.3.1.tar.gz
  • Upload date:
  • Size: 13.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for sphinx_collections-0.3.1.tar.gz
Algorithm Hash digest
SHA256 4dda762479d2ad2163ccb074b15f36f72810d9cd08be4daa69854a6e34c99f92
MD5 0659ac8b719382b53456d8199e3b3165
BLAKE2b-256 1d182f258a70fb9059014d7dc589b4aab09ffd9a47ba6e4235b77b888d0220f8

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_collections-0.3.1.tar.gz:

Publisher: release.yaml on useblocks/sphinx-collections

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file sphinx_collections-0.3.1-py3-none-any.whl.

File metadata

File hashes

Hashes for sphinx_collections-0.3.1-py3-none-any.whl
Algorithm Hash digest
SHA256 fb93b979cc9275bd2ad980a71fd57be5521c0f879f90f8189917a8f7ca0436ab
MD5 b99d22ccc6ee2ddb8054d3159be6b3f7
BLAKE2b-256 73858f0de226be865c7bda58c46db8d27cee0be7f9125bbc21568e5d40699286

See more details on using hashes here.

Provenance

The following attestation bundles were made for sphinx_collections-0.3.1-py3-none-any.whl:

Publisher: release.yaml on useblocks/sphinx-collections

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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