StrictDoc-style tree map visualizations for sphinx-needs
Project description
sphinx-needs-tree-map
StrictDoc-style tree map visualizations for sphinx-needs documentation.
Overview
sphinx-needs-tree-map is a Sphinx extension that provides interactive treemap visualizations for your sphinx-needs documentation. It allows you to visualize requirements, specifications, and other need types in a hierarchical treemap using Plotly.js.
Installation
pip install sphinx-needs-tree-map
Or with uv:
uv add sphinx-needs-tree-map
Quick Start
Add the extension to your conf.py:
extensions = [
"sphinx_needs",
"sphinx_needs_tree_map",
]
Then use the needtreemap directive in your documentation:
.. needtreemap::
:hierarchy: document
:depth: 3
:show_values:
Directive Options
The needtreemap directive supports the following options:
Filtering
:filter:- sphinx-needs filter expression (e.g.,type == 'req'):types:- Comma-separated list of need types to include:status:- Comma-separated list of statuses to include:tags:- Comma-separated list of tags to include
Hierarchy
:hierarchy:- Hierarchy mode:document(default),links, ortype:root:- Root node:document,section, or a specific need ID:depth:- Maximum hierarchy depth (default: 3)
Visualization
:size_by:- Size metric:count(default),links, orcontent_length:color_by:- Color scheme:type(default) orstatus:show_values:- Show counts in labels:interactive:- Enable interactive features (default: enabled)
Layout
:height:- CSS height (default:600px):width:- CSS width (default:100%):title:- Optional title for the treemap
Configuration
Add these to your conf.py to customize the extension:
# Plotly.js CDN URL
needtreemap_plotly_cdn = "https://cdn.plot.ly/plotly-2.35.2.min.js"
# Default dimensions
needtreemap_default_height = "600px"
needtreemap_default_width = "100%"
# Colors for need types
needtreemap_colors = {
"req": "#E3F2FD",
"spec": "#FFF3E0",
"impl": "#E8F5E9",
"test": "#FCE4EC",
"default": "#ECEFF1",
}
# Colors for statuses
needtreemap_status_colors = {
"open": "#FFCDD2",
"in progress": "#FFF9C4",
"implemented": "#C8E6C9",
"verified": "#B2DFDB",
"default": "#ECEFF1",
}
Examples
Document-based hierarchy
.. needtreemap::
:hierarchy: document
:depth: 3
:show_values:
Filter by type
.. needtreemap::
:filter: type == 'req' or type == 'spec'
:color_by: type
Status-based coloring
.. needtreemap::
:types: req,spec
:color_by: status
:show_values:
Link-based hierarchy
.. needtreemap::
:hierarchy: links
:depth: 4
:title: Requirements Traceability
Example Project
See the example/ directory for a complete example Sphinx project demonstrating all features of the extension. The example project is a fictional "Task Management System" with:
- 45+ needs (requirements, specifications, test cases, user stories)
- Multiple documents organized hierarchically
- Traceability links between needs
- Examples of all three hierarchy modes
- Various filtering and visualization options
To build the example:
cd example
uv sync
make html
# Open _build/html/index.html
Requirements
- Python >= 3.9
- Sphinx >= 5.0
- sphinx-needs >= 2.0
License
MIT License
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sphinx_needs_tree_map-0.1.0.tar.gz.
File metadata
- Download URL: sphinx_needs_tree_map-0.1.0.tar.gz
- Upload date:
- Size: 19.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d1062f48faae00515309a27ca753e6ee0f692fbab7a8b1645c2d571474856e98
|
|
| MD5 |
0ce880851a3a1153e5a8b87c7f23ea94
|
|
| BLAKE2b-256 |
92848f8b37f3079af3eeb2ebdf678a6ce5049604289e2b5791026478f6bde171
|
Provenance
The following attestation bundles were made for sphinx_needs_tree_map-0.1.0.tar.gz:
Publisher:
release.yaml on patdhlk/sphinx-needs-tree-map
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_needs_tree_map-0.1.0.tar.gz -
Subject digest:
d1062f48faae00515309a27ca753e6ee0f692fbab7a8b1645c2d571474856e98 - Sigstore transparency entry: 810258834
- Sigstore integration time:
-
Permalink:
patdhlk/sphinx-needs-tree-map@1299c7de45312b185e51309f49f05daa74e41450 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/patdhlk
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1299c7de45312b185e51309f49f05daa74e41450 -
Trigger Event:
push
-
Statement type:
File details
Details for the file sphinx_needs_tree_map-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sphinx_needs_tree_map-0.1.0-py3-none-any.whl
- Upload date:
- Size: 18.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
50aa58367fb2a93aa2b42a6294bd213194f4ad89de85201569cb2b6ef410814f
|
|
| MD5 |
25e2473ae2582d2a8679f61653836b8c
|
|
| BLAKE2b-256 |
f900b103a942b10c4f012ec4e954be942ffe490fdb5958c7debde5630df2612b
|
Provenance
The following attestation bundles were made for sphinx_needs_tree_map-0.1.0-py3-none-any.whl:
Publisher:
release.yaml on patdhlk/sphinx-needs-tree-map
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sphinx_needs_tree_map-0.1.0-py3-none-any.whl -
Subject digest:
50aa58367fb2a93aa2b42a6294bd213194f4ad89de85201569cb2b6ef410814f - Sigstore transparency entry: 810258842
- Sigstore integration time:
-
Permalink:
patdhlk/sphinx-needs-tree-map@1299c7de45312b185e51309f49f05daa74e41450 -
Branch / Tag:
refs/tags/v0.1.0 - Owner: https://github.com/patdhlk
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yaml@1299c7de45312b185e51309f49f05daa74e41450 -
Trigger Event:
push
-
Statement type: