-
Notifications
You must be signed in to change notification settings - Fork 84
Description
Environment
OS: Windows 11
Python: 3.14.2
Sphinx: 9.1.0
Sphinx‑Needs: 7.0.0
Theme: sphinx-book-theme
Context
I’m building a small IEC 61508 assurance‑as‑code demo using Sphinx‑Needs.
I define link types in conf.py as follows:
needs_links = {
"addresses": {"incoming": "addressed_by", "outgoing": "addresses"},
"allocates": {"incoming": "allocated_by", "outgoing": "allocates"},
"refines": {"incoming": "refined_by", "outgoing": "refines"},
"realizes": {"incoming": "realized_by", "outgoing": "realizes"},
"verifies": {"incoming": "verified_by", "outgoing": "verifies"},
"evidences": {"incoming": "evidenced_by","outgoing": "evidences"},
"reviews": {"incoming": "reviewed_by", "outgoing": "reviews"},
}
and needs like:
.. fsr:: Emergency Stop shall de-energize motor outputs within 100 ms
🆔 FSR_ESTOP_01
:refines: SIL_ESTOP_01
.. verif:: Measure Emergency Stop response time
🆔 VERIF_ESTOP_01
:verifies: FSR_ESTOP_01
.. evidence:: Emergency Stop response time test report
🆔 EVID_ESTOP_01
:evidences: VERIF_ESTOP_01
I want a Lifecycle Checks page where a needtable lists only needs that
have no incoming link of a given type (e.g. FSRs without any VERIF that verifies them).
What I tried
In 04_checks.rst I used several variants based on the docs:
.. needtable::
:types: fsr
:filter: "len(verified_by) == 0"
.. needtable::
:types: fsr
:filter: "'verifies' not in incoming or len(incoming['verifies']) == 0"
But on Sphinx‑Needs 7.0.0 / Sphinx 9.1.0, the table always shows my FSR
(FSR_ESTOP_01) even though VERIF_ESTOP_01 has :verifies: FSR_ESTOP_01 and
the needflow graph correctly shows the link.
Similarly, for VERIF / EVID (evidences), SIL / RISK (allocates),
and HAZ / RISK (addresses), my needtable filters still list the needs
even when the incoming links exist.
Questions
On Sphinx‑Needs 7.0.0, what is the supported needtable :filter: expression
to select needs that have no incoming link of a given type, e.g.
“FSRs without any verifies link”?
Could you provide a small working example (one or two needs with a link)
and the exact filter string, so I can adapt it for verifies, evidences,
allocates, and addresses?
I can attach a small minimal project if useful, but hopefully the snippet above
is enough to show what I’m trying to achieve.
Thanks in advance!