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
Metadata
Release files for sphinx-needs-tree-map 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sphinx_needs_tree_map-0.1.0.tar.gz | 19.6 kB | With provenance | Details for sphinx_needs_tree_map-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sphinx_needs_tree_map-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for sphinx_needs_tree_map-0.1.0-py3-none-any.whl |
Total release size: 38.2 kB
Release files / sphinx_needs_tree_map-0.1.0.tar.gz
| Download URL | sphinx_needs_tree_map-0.1.0.tar.gz |
|---|---|
| Size | 19.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d1062f48faae00515309a27ca753e6ee0f692fbab7a8b1645c2d571474856e98
|
|
BLAKE2b-256 checksum How to use checksums |
92848f8b37f3079af3eeb2ebdf678a6ce5049604289e2b5791026478f6bde171
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 9, 2026.
Transparency logRelease files / sphinx_needs_tree_map-0.1.0-py3-none-any.whl
| Download URL | sphinx_needs_tree_map-0.1.0-py3-none-any.whl |
|---|---|
| Size | 18.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
50aa58367fb2a93aa2b42a6294bd213194f4ad89de85201569cb2b6ef410814f
|
|
BLAKE2b-256 checksum How to use checksums |
f900b103a942b10c4f012ec4e954be942ffe490fdb5958c7debde5630df2612b
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
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 Jan 9, 2026.
Transparency logSecurity for sphinx-needs-tree-map 0.1.0
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.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for sphinx_needs_tree_map-0.1.0.tar.gz
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 Jan 9, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.