Sphinx Graph
'Sphinx-Graph' is a sphinx extension for plain-text, VCS-friendly, requirements management.
Key Features
- Vertex Directive: Define relationships between document elements.
- Vertex Table: Generate summary tables of vertices.
- Fingerprinting: Track changes and trigger reviews when parent elements are modified.
- Customizable Layouts: Choose how vertices are displayed in your documentation.
With Sphinx-Graph you define relationships between items in a document. These items form a directed acyclic graph (DAG). The extension:
- Checks for cyclic references
- Populates items with links to their 'parents' or 'children'
- (Optionally) tracks a hash of each item to trigger reviews when any parents change
Getting Started
Install Sphinx-Graph using pip:
pip install sphinx-graph
Add it to your Sphinx project's conf.py:
extensions = [
# ... other extensions ...
"sphinx_graph",
]
Vertices
The core sphinx directive provided by this extension is a 'Vertex'. A Vertex directive can be used to define relationships between text elements.
.. vertex:: USR-001
this is a user requirement.
This user requirement forms the basis of derived system requirements. When it is rendered in a
sphinx document it will be augmented with links to any child vertices.
.. vertex:: SYS-001
:parents: USR-001
this is system requirement of some sort.
It is derived from a higher-level user requirement (USR-001).
When it is rendered in a sphinx document, it will be augmented with links to its parent as well
as any 'children'.
.. vertex:: SYS-002
:parents: USR-001:iG91
this is another system requirement. This time the link to USR-001 is tracking the 'fingerprint'
of its parent.
The fingerprint is a 4-character hash. If USR-001 is modified, then SYS-002 will fail the build
until the fingerprint is updated (the build error provides the new fingerprint). This means that
changing a Vertex will trigger a review of all dependent vertices.
Generating Summary Tables
The vertex-table directive generates summary tables of vertices:
.. vertex-table::
:query: descendants
uid = "REQ-001"
This will create a table showing REQ-001 and all its descendants.
Benefits of Sphinx-Graph
- Version Control Friendly: Plain-text format works well with Git and other VCS.
- Flexible: Define custom relationships between any elements in your documentation.
- Traceable: Easily track dependencies and impact of changes.
- Integrated: Seamlessly works within your Sphinx documentation.
Comparison with Similar Projects
Sphinx Graph is heavily inspired by Sphinx-Needs. Sphinx-Graph started life as a proof-of-concept refactor of Sphinx-Needs using modern python and strict type checking.
- Sphinx-Needs is a more complex, feature-rich solution for requirements management, but may be heavy-weight for some use-cases.
- Sphinx-Graph is smaller, more streamlined, and uses modern Python with strict type checking.
- Sphinx-Graph can track 'suspect links' and force reviews when linked requirements are modified.
- Doorstop is a command-line tool and Python API for managing requirements as text files.
- Like Sphinx-Graph, Doorstop is lightweight and version-control friendly.
- Sphinx-Graph integrates directly with Sphinx documentation, while Doorstop requires additional setup for documentation integration.
- Sphinx-Graph offers more flexible relationship types between items compared to Doorstop's hierarchical structure.
Traditional Requirements Management Tools (Doors, Enterprise Architect, etc):
- Sphinx-Graph doesn't require complex workflows or specific expertise to maintain.
- It's more cost-effective (it's free).
- Can be maintained in plain-text alongside the code.
For more information, see the docs.
or, build the local docs-
cd docs
uv run make html
Was this useful? Buy me a coffee
Metadata
Release files for sphinx-graph 0.3.4
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_graph-0.3.4.tar.gz | 91.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| sphinx_graph-0.3.4-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 113.1 kB
Release files / sphinx_graph-0.3.4.tar.gz
| Download URL | sphinx_graph-0.3.4.tar.gz |
|---|---|
| Size | 91.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
240f5411a3b9c2b8d361b2f51912c705a33ff101cc91a8a2086cbd0a47c241b3
|
|
BLAKE2b-256 checksum How to use checksums |
147544a1f09394aaedf293a10923bbbd012542e51178af750a81a026407b18e7
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / sphinx_graph-0.3.4-py3-none-any.whl
| Download URL | sphinx_graph-0.3.4-py3-none-any.whl |
|---|---|
| Size | 21.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
32054ab29dbf07d9ff64567dedbe2cd839799bf1873d5577bb75bb1e3824f400
|
|
BLAKE2b-256 checksum How to use checksums |
6ae6310a9503394c6df1dbdbaa0a286fb603d46607706f638f3969bc23eed803
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.5 {"installer":{"name":"uv","version":"0.11.5","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|