You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The Sphinx-Needs maintainers have been actively working on this feature. Here is a concrete preview of how it will look and feel from a user perspective.
"Versioned links" allows to attach a filter expression or a hash to a link, so Sphinx-Needs can verify at build time that the target need still satisfies your expectation, e.g. that it hasn't changed since it was reviewed.
Option A: Manual versioning with a version field
1. Configure the field in ubproject.toml / conf.py:
[needs.fields.version]
schema.type = "integer"# or "string" / "float"nullable = false# every need must carry a version
2. Set a version on your needs:
.. req:: My Requirement:id: REQ-001
:version: 42
3. Link to a specific version:
.. spec:: My Specification:id: SPEC-001
:links: REQ-001[version==42]
At build time, Sphinx-Needs checks that REQ-001 currently has version=42. If the requirement was bumped to version: 43, the build reports a broken constrained link.
Note: later semantic versioning could be supported
Option B: Automatic hash-based versioning
For projects that want zero-maintenance pinning, a built-in hash dynamic function will compute a fingerprint of the need's content automatically:
[needs.fields.hash]
default = "[[hash(id, title, description)]]"fixed = true# cannot be overridden per-needfunction_priority = 1000# runs last, after all other fields are resolved
Linking by hash:
.. spec:: My Specification:id: SPEC-001
:links: REQ-001[hash=="a3f5c2d1"]
The hash is recomputed on every build. If REQ-001 changes (even a typo), the hash changes and the constrained link fails, giving a precise "the thing I linked to has changed" signal, but this could also get annoying ;-)
Syntax overview
The new link constraint syntax is ADDRESS[<filter expression>], using the same filter/query syntax already familiar to Sphinx-Needs users (field=="value", field>5, and / or, etc.):
:links: REQ-001[version==42]
:links: REQ-001[version>=40 and status=="accepted"]
:links: REQ-001[hash=="a3f5c2d1"]
Mixed usage with existing link syntaxes is fully supported:
.. req:: My Requirement:id: REQ-002
:links:
REQ-001[version==42],
<<alias: OTHER-REQ-003>>,
[[dynamic_func()]]
Note: field names are fully configurable
version and hash are just the names used in the examples above, they are regular Sphinx-Needs fields and can be named anything. Projects that prefer shorter link syntax could use single-letter names:
There is also the idea of introducing a shorthand field configuration to make the common cases even less verbose to set up. Instead of writing out the full field config, something like:
Activity
arnoox commentedon Mar 13, 2026
Preview of Versioned Links in Sphinx-Needs
The Sphinx-Needs maintainers have been actively working on this feature. Here is a concrete preview of how it will look and feel from a user perspective.
"Versioned links" allows to attach a filter expression or a hash to a link, so Sphinx-Needs can verify at build time that the target need still satisfies your expectation, e.g. that it hasn't changed since it was reviewed.
Option A: Manual versioning with a
versionfield1. Configure the field in
ubproject.toml/conf.py:2. Set a version on your needs:
3. Link to a specific version:
At build time, Sphinx-Needs checks that
REQ-001currently hasversion=42. If the requirement was bumped toversion: 43, the build reports a broken constrained link.Option B: Automatic hash-based versioning
For projects that want zero-maintenance pinning, a built-in
hashdynamic function will compute a fingerprint of the need's content automatically:Linking by hash:
The hash is recomputed on every build. If
REQ-001changes (even a typo), the hash changes and the constrained link fails, giving a precise "the thing I linked to has changed" signal, but this could also get annoying ;-)Syntax overview
The new link constraint syntax is
ADDRESS[<filter expression>], using the same filter/query syntax already familiar to Sphinx-Needs users (field=="value",field>5,and/or, etc.):Mixed usage with existing link syntaxes is fully supported:
Note: field names are fully configurable
versionandhashare just the names used in the examples above, they are regular Sphinx-Needs fields and can be named anything. Projects that prefer shorter link syntax could use single-letter names:Which then allows very compact links:
There is also the idea of introducing a shorthand field configuration to make the common cases even less verbose to set up. Instead of writing out the full field config, something like:
aschemmel-tech commentedon Oct 12, 2026
realized with versioned links, aligned with @masc2023, documented in #827