Listing entities
A .. entity-table:: asks the entity graph a question and renders the
answer. Its rows come from the project index rather than from this document,
so a table lists entities declared anywhere in the site — including the
requirements and audit events on the neighbouring pages.
.. needtable:: is accepted as a second spelling of the same directive, so
a project migrating from sphinx-needs keeps its documents unchanged.
Every entity in the project
With no :filter:, a table lists everything. The default columns are the
three fields every entity has, whatever its type declares.
Choosing columns
:columns: names the fields to show, in the order to show them. A column
may name a built-in field, an attribute, an outgoing relation, or a back-link
derived from one — verified_by is declared nowhere, and falls out of
test.verifies pointing at a requirement.
| ID | Title | Status | Owner | Verified by |
|---|---|---|---|---|
| BYFILTER_PLAT_REQ_2 | The platform survives a power cut | open | platform-team | |
| BYID_PLAT_REQ_2 | The platform survives a power cut | open | platform-team | |
| OLD_PLAT_REQ_1 | Retired: the platform boots | closed | platform-team | |
| PLAT_REQ_1 | The platform boots within one second | closed | platform-team | |
| PLAT_REQ_2 | The platform survives a power cut | open | platform-team | |
| REQ_001 | The system shall boot within two seconds | in_progress | platform | Boot timing regression test |
| REQ_BOOT | The bootloader shall verify the kernel signature | open | platform | |
| REQ_req-4444f5cf | Shut down cleanly on power loss | open | platform | |
| TAGGED_PLAT_REQ_2 | The platform survives a power cut | open | platform-team |
Headings come from the schema's own labels, so a column is never a second copy of a name that can drift from it.
Filtering
A filter is a small typed expression language with Python's spelling. It
supports ==, !=, in, not in, is None, is not None,
and, or, not and parentheses, over field names, strings, whole
numbers and True/False.
in means what it means in Python: a substring test over text, and a
membership test over a list.
| ID | Title | Tags |
|---|---|---|
| REQ_001 | The system shall boot within two seconds | boot, safety-critical |
Conditions combine, and parentheses group them:
A filter may also test whether a field was written at all:
| ID | Event | Added in |
|---|---|---|
| open | open | 3.8 |
| os.system | os.system | 3.8 |
Anything outside this language is reported by name — len(tags) > 0 is
refused as "function calls are not supported here", pointing at len,
rather than silently matching nothing.
Sorting and layout
:sort: orders rows by one field; without it, rows are in id order, which
keeps a rendered page byte-identical between builds. The presentation options
every other table directive takes work here too, and sphinx-needs'
:colwidths: is accepted as a spelling of :widths:.
That table registers an ordinary target, so requirements-by-title links to it.