Complete documentation: http://sphinx-collections.readthedocs.io/en/latest/
Welcome to
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.
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.
Release files for sphinx-collections 0.3.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| sphinx_collections-0.3.2.tar.gz | 13.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinx_collections-0.3.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 30.0 kB
Release files / sphinx_collections-0.3.2.tar.gz
| Download URL | sphinx_collections-0.3.2.tar.gz |
|---|---|
| Size | 13.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
42506b0ec456b70a63be1641a84b33399503f3233bfdc1d181775c7475466b85
|
|
BLAKE2b-256 checksum How to use checksums |
e72169cb9ca119f948a4433baf8d30d4f867b441b1f6210ff91c4c4ad082dd87
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency logRelease files / sphinx_collections-0.3.2-py3-none-any.whl
| Download URL | sphinx_collections-0.3.2-py3-none-any.whl |
|---|---|
| Size | 16.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
ab93ab151a045b9dd70a8ed6f8462f3f096c1a3a73bbe1ca8efbda093b5ac6da
|
|
BLAKE2b-256 checksum How to use checksums |
7370f97f7d5f20db13afc1dc5a7d941e2f46cbdbda14e5ef603a6fbb3e0a5c5e
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.12
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Jun 22, 2026.
Transparency log