Changelog

Unreleased

Improvements

  • ✨ needs_from_toml follows extend: a needs_from_toml file whose top-level extend names a base file is read with the base, and with every file the base extends in turn, merged as ubCode merges them: each [needs] key is taken whole from the nearest file that sets it, the variant data is merged across the chain, and a relative path is resolved at the directory of the file that sets it (a file that extends another). So need types, link types and fields kept in a shared base file are known to the Sphinx build too, where every directive of such a type used to be an “Unknown directive type” error. A chain that cannot be followed (a cycle, a missing or invalid base) is one needs.config warning, as an unreadable file is; under needs_from_toml_table extend is not followed, and is reported as a needs.config warning. Needs the next release of ub-project. (issue #2469)

  • ‼️ A wrong-typed variant key in the ignored location fails the build: a [needs] variant_data that is not a table, or a [needs] variant_data_file that is not a string, beside a [variants] table that is read is now a configuration error naming the file and the key, as ubCode refuses it, where it was a needs.variant_data_location warning (Variant data: the [variants] table). (issue #2469)

  • ✨ A style class can carry a diagram look: needs_styles ([needs.styles.<class>] in ubproject.toml) gives a class a node look, { fill, text, border, shape }, and a need whose style names the class is drawn with it by needflow, on PlantUML and Graphviz, and by flow() in needuml and needarch. So one need type can draw its databases as cylinders ([needs.styles.database] node = { shape = "cylinder" } and :style: database), and a predicate of the style field can give the open requirements an outline in a needflow and in flow() (a needflow’s own :border_color: and :highlight: are drawn above it). A colour is # and three or six hex digits; a shape is one of ten names (rectangle, rounded, circle, ellipse, diamond, hexagon, cylinder, document, folder, box3d), drawn on PlantUML and Graphviz as the table of needs_styles says. Property by property the last class of the need’s list wins; a class’s fill is above the need type’s color, its shape above the type’s style, its border below a needflow’s :border_color: and :highlight: (Style classes). A problem of an entry is one needs.config warning, the entry’s usable properties kept. The built-in styles carry no node look, so a project that writes no entry draws what it drew. Not in this release: a class’s look on a need’s page, a table row or an edge, in a legend, in needsequence or needgantt, the colour of :highlight:, and a border’s width or line style. (PR #2599)

  • ✨ A link type says how its edges are drawn: a link type (needs_links, [needs.links.<name>]) gains line (solid, dashed, dotted, thick) and arrow (normal, none, both, circle, diamond), and its color is drawn at last: needflow draws the three on PlantUML and on Graphviz alike, arrow on the edges to need parts too, whose line and colour stay as they were drawn (line / arrow / color). So [needs.links.verifies] line = "dashed", arrow = "diamond", color = "#00AA00" draws every verification as a dashed green line with a hollow diamond, on either engine. style, style_start and style_end are written as they were, and read as these values where a link type does not set them, as the engines draw them (the last of two line words or colours, a . of the ends as dashed); a key that is set changes its own value alone (line the line words of style, color its colours), but for arrow, which takes the place of style_start and style_end whole but for the line they drew, so a direction, a length or a colour written in them goes with them (on PlantUML a line or color is written in the arrow’s brackets, and PlantUML loses the whole diagram where they come before the arrow’s first line character, among other places: style_start / style_end). A colour is # and three or six hex digits; a value of the three keys that is not usable is one needs.config warning and unset, and an empty one unset. A link type’s color was accepted whatever it held, so one that is no hex colour now fails a -W build: correct it, or add needs.config to suppress_warnings, which silences every warning about the configuration. The built-in links and parent_needs lose their colours (#000000, #333333), which no engine drew, so a project naming no colour draws what it drew, and LinkDisplayConfig.color is empty by default. Fixed with it: solid in a style or style_part ("solid", "solid,#777777") lost the whole PlantUML diagram; it is no longer written for PlantUML, nor, where it is the last line word, any line word, so the line is drawn solid, as Graphviz draws a lower-case solid; a style beside an empty style_start lost the diagram too, its brackets written right after the source name: the first - or . of style_end is now written before them; and the documentation no longer teaches red and #red as colours (PlantUML refuses the first, Graphviz draws the second black). The first build after upgrading reads every document again. (PR #2605)

  • ✨ A hidden need, read in full: needs_hidden_needs ([needs] hidden_needs) set to "collapsed" reads a need with hide set as a visible need is read, however hide was set (the option, a field default or predicate, needimport’s :hide:, a record’s hide, a list2need item, a need another extension creates): it has the parts its content marks and its anchor, the needs written inside it exist with it as their parent, a content_links rule and links_from_content read its references (no no stored node warning), needlist links it, needextract draws it, and the children of a hidden list2need item are that item’s children. It is drawn, from its hide once every needextend is applied, as its card in a closed disclosure in a builder writing HTML, its anchor outside the disclosure and its header as the summary, and in every other builder, which has no disclosure, as a visible need’s card is drawn, so that builder writes what it writes with the hide taken off, but for a hidden need’s templates, which stay unrendered, and for what reads hide itself (and a gettext catalog holds the hidden text). A project that sets it can newly see needs that did not exist, a nested need refused for an id another need has, a markup error or a :need: reference to a missing need in hidden content reported for the first time, needs.views_include_parts and needs.needextract notices about what a hidden need now has, and a text or man build that ends where a hidden need holds a need nested in it, as it ends for a visible need (hide has the list). Unset, nothing changes: a hidden need is read and drawn as before. The new configuration value makes every project’s first build after upgrading re-read every document, once. (PR #2597)

  • ✨ A join can link need parts: links_from_match takes include_parts, and so does a derived links rule with join, where it was refused (needs.derive_invalid). With it, the parts of every need are candidates too, each read as a part answers a filter: its own id and id_complete, its text as content and title, no parent_need, its need’s value of every other field. So [[links_from_match("id_complete", "case", include_parts=True)]] links the parts whose address the need’s case names. A part that matches is linked as <need>.<part>, after its need, in part-id order, and the need’s own parts are left out with it unless include_self. Without it, nothing changes. (PR #2567)

  • ✨ An import under a namespace: :namespace: SUP on needimport (namespace), or namespace = "SUP" on a needs_external_needs source, puts the file’s needs into the namespace SUP, so that a supplier’s ids cannot clash with the project’s: the file’s REQ_1 becomes SUP::REQ_1, its nc::REQ_2 becomes SUP::nc::REQ_2, and every reference inside the file to one of its own needs follows. It is id_prefix with the text SUP::, with the namespace checked; several levels are allowed (sup::m2). A value that is not a namespace, or one given beside an id_prefix, is refused: at a needimport with one needs.needimport warning, and the directive imports nothing; for a source, as a missing base_url is, stopping the build. With needs_namespaced_ids off (the default in 9.x) the ids get the prefix all the same and are read as plain ids, and each such import gives one needs.namespaced_ids_off warning. With it on, a need whose id cannot be joined to a namespace (a::::b, or an id starting with :) is imported as SUP::a::::b, a plain id outside the namespace, and each import holding such ids gives one warning of a new type, needs.import_namespace, naming how many and the first five. A sphinx-needs older than this one ignores the namespace key of a source without a word (the needs arrive with the file’s own ids), and reports the needimport option as unknown. (PR #2568)

  • ✨ What a view’s filter selects: needs_views_include_parts ([needs] views_include_parts) says whether the filter of a needtable, needlist, needflow or needgantt, of a needpie line or a needbar cell (and of either chart’s scope) and of need_count is tested on the need parts beside the needs. True tests every need and every part, as every release so far has; False tests the needs alone, so a view shows a need’s parts only where it asks (a needtable’s or a needflow’s :show_parts:), a filter that tests each need on its own selects the needs it selects under True in the same order, is_part selects nothing, a needflow draws a link to a part of a need it shows as an edge to that need, in the link type’s style_part (dotted by default), and filter code and a filter function are handed needs alone (a part they build themselves is dropped, unless needs_allow_unsafe_filters). Unset, it is True in 9.x and False from 10.0. While it is unset, each view, chart line or cell and :need_count: whose result holds a need part reports needs.views_include_parts, once, where it is written, saying how many need parts its filter selects (a count: how many it counts), before any :max_items: cap; so does a needflow that from 10.0 draws links to parts of its needs as edges to the parts’ needs, saying how many: those of the needs its max_items window keeps once it holds needs alone. Set the value either way (True keeps the views as they are, False selects needs alone now) or suppress the warning type to silence it, until which a -W build of such a project fails on this release. A needtable with :show_parts: reports the parts whose need it does not list, and is not reported where its matched parts are each listed under their need; needextract is not reported. The report is decided from each place’s result: it cannot see a view whose filter string, filter code or filter function reads needs itself (a needflow among them can be reported with a number of links it does not then draw), nor a chart’s :filter-func:, and it can name a place whose output stays the same (filter code that builds parts itself, with unsafe filters allowed; a :need_count: ratio whose two halves both hold parts; a needflow drawn by graphviz whose filter selects parts of a need it does not show, which graphviz does not draw). Functions and rules that take include_parts, needextend, warning checks, constraints, the builder’s filter and needs.json do not read the value; changing it re-reads no document. From 10.0 a view lists needs, not need parts, unless it asks: set needs_views_include_parts either way to keep a project’s views through that release.

  • ✨ A needflow’s edge to a need names the parts it links: with needs_views_include_parts False (the default from 10.0) a needflow draws the links of one need, of one link type, to parts of one need it draws as ONE edge to that need, in the link type’s style_part, labelled with the part ids in the need’s order of its parts, each once: SPEC_2, linking REQ_1.zeta and REQ_1.alpha, is one dotted edge to REQ_1 labelled zeta, alpha, where it was two unlabelled edges. A link to the need itself stays an edge of its own, unlabelled; each link type draws its own edge; with show_link_names the label is the link type’s name and the part ids, on two lines (Need parts). An external need’s part now links the part’s anchor, as :need: links it, where it linked the need’s URL: its needtable row, a needtable cell naming it, its node in a needflow and needuml’s ref() of it. Under True and unset a needflow draws what it drew but for two kinds of line: an external part’s node, which links the part’s anchor, and graphviz’s edge from a need to its own part, which no longer names the need’s cluster as its tail (dot warned on it, and the build did not show the warning). Separately, a link type whose style_part is empty draws a plain line in a PlantUML needflow, where it wrote -[]->, a syntax error. The needs.views_include_parts report still counts a needflow’s links, not its edges. (PR #2588)

  • ✨ A needflow draws each need’s parts inside it: with show_parts a needflow draws each need it draws with every need part it has, inside it, in the need’s order of its parts, whether a link names the part or not, and a link to a part as an edge to the part’s node, in the link type’s style_part. Its result then holds needs alone: a part its filter selects is drawn only inside its need, :max_items: counts needs, and a filter that selects parts alone draws nothing. What it draws is the same whatever needs_views_include_parts says, but for a filter that reads needs itself (a filter string, filter code or a filter function), which is handed needs and parts under True and needs alone under False, as in every view; it makes no needs.views_include_parts report, and the report of a needflow without the option now names it. An upgraded project re-reads every document once, as the needflow’s stored options gain a key. (PR #2589)

  • ✨ An imported need keeps the parts its record states: a needimport record’s parts that its content does not mark with a need_part / np role were dropped, and every link and :need: reference to one was dead (needs.link_outgoing, needs.link_ref). The need now has them, after the parts its content marks, in the record’s order, each with its key as its id and its text on one line: each run of white space that holds a line break (LF, VT, FF, CR, NEL U+0085, LS U+2028 or PS U+2029) is one space, in the stored part and so in needs.json, filters and every place the text is written, and every other character is kept; where both give an id, the content’s part is the part, with its text, and nothing is reported. A part id is one word: a record part whose id holds white space or a control character is not taken, and is dropped as before. On the page the stated parts are shown in a block after the need’s content (the class needs-stated-parts), one line per part with its text, its id and its anchor NEED.part, styled as a part in the content with the class need-part-stated beside need-part. html, singlehtml, epub, LaTeX and texinfo anchor each line; text and man print each line’s text and id after the need’s content, text in the need’s cell with every paragraph of it on one line, man with no blank line before the first. Links and references to a stated part are live and land on its line, their warnings go, and the importing project’s needs.json, tables, flows and filters have it (see stated parts). A need’s parts are stored in that order, its content’s as written then the stated ones, and a needtable’s :show_parts: rows, needlist, needflow, needextract and the block list them in it; a needtable whose filter selects parts sorts them as it sorts its rows, and links_from_match and a derived join take them in part-id order, as before.

    A view now lists the stated parts: a stated part is a part like any other, so a view’s filter tests it while needs_views_include_parts is unset or True. With the value unset (the 9.x default), every view whose filter an imported need passes now also lists that need’s stated parts and reports needs.views_include_parts once where it is written, so a -W build that passed fails. Set the value to False to select needs alone, or to True to keep the parts without the report. One more warning can appear: a PlantUML needflow that draws a stated part whose one-word id holds a double quote, a backslash, @ or a square bracket fails to draw it and reports [plantuml] (graphviz draws it).

    Importing a needs.json that Sphinx-Needs wrote changes nothing on the page for a need that had no stated part there, where this project reads each need’s content as the writing project did: its record states only the parts its content marks. A need that had stated parts there (imported, or given by create_need) is written with them in the file’s order, which is by id, and this project takes them in that order, with the same texts, so its block can list them in another order than the writing project’s. In two cases a record’s parts are now stated parts, where they were dropped: a content holding an .. include:: this project cannot resolve, or may not read (needs_import_restrict_content), whose parts the record carries without their text; and a content in another markup than this project reads it in, such as a MyST need read as reStructuredText, whose {np} role is no role there, so that its part’s text is on the page twice, in the content and in the block (needs_import_parse_by_doctype reads each content in the markup its record names, where this project has a parser for it, and removes that case). A hidden imported need and an external need keep their record’s parts alone, as the record gives them, as before.

    Through the API, create_need() takes parts, a mapping of part id to text, merged by the same rule; it refuses a part id that is not one word. The deprecated add_need keeps the parts it is given for a need on a page, where it dropped them with one needs.part warning per need. NeedPartData records whether a part comes from its need’s content or is stated (origin), which needs.json and filters do not read. Every project re-reads its sources once after upgrading. (PR #2581)

  • 👌 The warning for the keys of a need’s given parts that the format does not define (any but id, content and the <link>_back of a link type the project has) now has its own code, needs.unknown_part_keys, and comes once per need, naming each such part in the order given with its keys, where it came once per part under needs.part, the code of a part outside a need. Only a project that imports or loads records whose parts carry such keys is affected: a needimport or a needs_external_needs source, or parts given to add_need, add_external_need, generate_need or ingest_need_record. A project that lists needs.part in suppress_warnings to silence it sees it again, and a -W build then fails: list needs.unknown_part_keys. Which parts a need keeps is unchanged. (PR #2586)

  • ✨ needs.json draft “2a2” (experimental), replacing “2a1”: with needs_json_format_version = "2a2", a need’s parts are a section of its record, "parts": [{"id": "zeta", "text": "last id first"}, {"id": "alpha", "text": "first id second"}], beside its content and in the order the need holds them – the parts its content marks in the order written, then the parts it states (its record’s, or those it was given) in the order given – where “2a1” wrote them as content.parts, which a file written without its content lost. Leaving out the content (needs_json_exclude_fields) keeps the parts, with their texts; naming parts leaves out the section alone; a need without parts has no parts. A link to the empty part, REQ_1., stays the dead link it is through a draft file: written {"id": "REQ_1", "part": ""}, read back as REQ_1. and reported again, where a 2a1 file turned it into a live link to REQ_1. needimport and needs_external_needs read “2a2” and refuse a “2a1” file, with the warning they give every format they do not read; a part entry of a wrong shape, or a second entry of one id, is one warning, and the need is read without it. The value "2a1" is an unknown value now: a project that sets it gets one needs.config warning, which names "2a2", and a needs.json of format 1, until it sets "2a2". ENV_DATA_VERSION is 35, was 34, so that a page whose needimport read a “2a1” file reads it again: the first build after upgrading reads every document again. See needs.json format 2a2 (draft). (PR #2594)

  • ✨ A link type may say where the linked need stands: points_to = "upstream" (the linked need comes first, the default), "downstream" (it comes after) or "peer" (neither) (needs_links), and a need type’s entry may give its own value for the links written on its needs, read through inherits (Fields per need type); FieldsSchema.points_to(need_type, link_type) answers it. It is checked and kept, and sphinx-needs does not act on it, so a configuration shared with a tool that reads it builds under -W: before, the key was reported as unknown. A value that is none of the three names is a needs.config warning, and ignored. It is not in the needs.json. ENV_DATA_VERSION is 37: the first build after upgrading reads every document again. (PR #2554)

  • ⬆️ jsonschema-rs is allowed up to 0.63 (>=0.37.1,<0.64; it was capped below 0.59) (changed output) (PR #2596)

    A link schema’s minContains or maxContains violation now says how many links matched: where it said None of ["SPEC_1"] are valid under the given schema, which was untrue whenever some links matched, it says ["SPEC_1"] has less than 2 items valid under the given schema (or has more than 1 item).

  • ⚡️ A need that does not set a link type takes the link type’s default (or a predicate’s) as a new list of the same links, rather than a deep copy of each link: a project of 1452 needs and 484 link types builds about 15 % faster (24.0 s to 20.4 s on Python 3.13, 27.5 s to 23.3 s on Python 3.12, measured locally). A default holding a dynamic function is still copied deeply. No output changes. (PR #2616)

Bug fixes

  • 🐛 An appended style keeps every class’s look: a needextend’s :+style: adds its classes after a comma and a blank, so :style: red and :+style: green_bar give red, green_bar, and the need’s card and its node in a needflow or flow() draw both classes. The append joined with a blank, which merged the need’s last class and the first appended one into one token, red green_bar: the card drew red and a bare green_bar class that no style rule names, and a diagram neither class’s needs_styles look, with no warning. Only the parts that are not empty are joined, a computed part ([[copy("status")]]) by the text it resolves to, blanks alone being empty, so an empty :+style: leaves no trailing blank, and an append onto an unset style sets it as written. An appended text is taken as written: :+style: , green_bar on red gives red, , green_bar, whose empty token is no class. Every other string option still joins an append with a blank. ENV_DATA_VERSION is 38: the first build after upgrading reads every document again. (changed output) (PR #2623)

  • 🐛 A blank between a variant’s name and its : is ignored: <<v1 :a, b>> kept the blank in its condition, "v1 ", which names no needs_variants key, so the condition was evaluated as an expression and the field failed with name 'v1' is not defined – or, where the need has a field named like the variant, read that field instead of the variant. The blanks between a condition written without brackets and its : are now dropped, as those before the condition and after the : already were, so <<v1 :a, b>> names the variant v1 as <<v1:a, b>> does, in a field and in a needflow’s :border_color: alike. A condition in brackets is taken as written: <<[ v1 ]:a, b>> reads as it did (Variant functions). Changed output: where a need has a field named like the variant, <<safety :a, b>> resolved silently from that field; the variant now decides, as it does without the blank. (PR #2621)

  • 🐛 A schema key of [needs] in needs_from_toml is ignored, as ubCode ignores it: a [needs.schema] sub-table holding a schema_-prefixed key (schema_debug_path) stopped the build with a KeyError, and a schema that is not a table was an Error loading 'needs_from_toml' file warning and nothing of the file was read. The sub-table never set anything (its keys without the prefix were skipped), and ubCode does not read it. The schema_* options are keys of [needs] itself (schema_definitions_from_json = "schemas.json"), as they always were; a schema key is now ignored, as any other unknown key of [needs] is.

  • 🐛 A word ending in _ in a need card’s label no longer ends the HTML build (issue #2613): the need card parses its labels as inline reStructuredText – a link type’s outgoing and incoming labels (by default its name and <name> incoming), the field names meta_all shows, the lines of a layout and the prefix of its meta, image and link – and a reference no card can resolve ended the build with AssertionError: References must have "refuri" or "refid" attribute (or a KeyError or NotImplementedError): a word ending in _ such as see_, a field or link type named a_ (set through :a\_:, MyST or needimport), and a footnote, citation or substitution reference ([1]_, [CIT]_, |sub|). Each is now shown as written, see_, and the build goes on; **strong**, roles and a reference with an embedded URI are drawn as before. (PR #2614)

  • 🐛 A field or link type whose name ends in _ is one warning (issue #2610): docutils reads a reStructuredText option’s name as inline markup and may read a name ending in _ as a hyperlink reference, so :a_: reaches the directive as the option a, and a field or link type named a_ is not set by it (Unknown option 'a', or, where a is declared too, a set instead). Each such name, from needs_fields, needs_extra_options, needs_links, needs_extra_links, a need type’s fields or links, or their ubproject.toml tables, is now one needs.option_name_underscore warning naming its declaration; the name is declared and works as before. A -W build of a project declaring such a name now fails on it: rename the field or link type, or add "needs.option_name_underscore" to suppress_warnings (option names and case). (PR #2612)

  • 🐛 A link type’s older keys no longer end the build, and lose a PlantUML needflow in fewer places (issue #2607): PlantUML loses the whole diagram where an arrow’s brackets come before its first line character (-, ., =, ~), and a style, style_part, line or color was written there: beside an empty style_start and a style_end starting with <, a head (o->), a blank, = or ~, and beside a style_start of blanks alone or ending in a head (<, o, *). Where style_start holds no line character, the brackets are now written right after the first line character of the arrow (<-[dotted]>, o-[dotted]>, =[dotted]>), drawn with the heads, the direction and the length the arrow has without them, but for a style_end with a second line character before a direction word, or before a 0 with more of the arrow after it (< and --up-> are <-[dotted]-up->), which is still lost; a style_start that holds one, and ends holding brackets of their own (-[norank]->), which PlantUML would draw otherwise, are written as before (style_start / style_end). A style or style_part with a blank around a token or an empty piece (dotted, #AA0000, dotted,) lost the PlantUML diagram too; it is given to PlantUML trimmed of blanks, its empty pieces left out (style / style_part). And a style, style_part, style_start or style_end that is no string (a number, None, a list) in needs_links or needs_extra_links ended the build with a Python exception on Graphviz, and a style_start or style_end on PlantUML too: it is drawn as the link type’s look reads it, a style with no line and no colour and a style_start or style_end as empty, but for a style or style_part that is truthy on PlantUML, written in the brackets as before; on Graphviz, a style_start and a style_end that are both empty or no string get the existing Unknown link start/end style '' warning, where the build ended. Such a value is now also said, once per link type and key, as a new needs.config warning, in needs_links, needs_extra_links and their ubproject.toml tables (a need type’s links already reported it, and ignores the key): a -W build of such a project now fails on it; write the value as a string, or add needs.config to suppress_warnings. Every arrow whose text changed lost its diagram, or the build, before. (PR #2609)

  • 🐛 A need naming a layout that is not defined no longer ends the build (issue #2324): written on the need (layout), carried by a record needimport reads, given by a needextract’s :layout:, or naming a card of needs_card_layouts that was skipped when it was compiled (an extends naming no specification, regions no grid can draw), the name is reported as a warning of a new type, needs.layout_unknown, naming the need, the layout and the layout used instead: needs_default_layout, or clean when that one is not defined either. The name a need carries is checked on the need, as a dead link is, and on the same builds (every build that reads or writes a page, and from Sphinx 8 one that does neither too): every need of the project that is not hidden and not external, once, at the need where it has a location, however often it is drawn, also one no builder writes (none under needs_include_needs = False). A hidden or an external need is reported only where it is drawn (by a view, or a hidden need drawn collapsed under needs_hidden_needs), while that page is written; a needextract’s :layout: is reported while its page is written, at the need it draws. A report made while a page is written is made again only by a build that writes that page. Where the need was drawn, the name ended the build with SphinxNeedLayoutException: such a project did not build before, and a -W build of it now fails on the warning, as on any other. Newly warned is a project in which such a need was never drawn: one built only with the needs builder, which draws no need, or one that defines a layout in conf.py only under a tag and uses it in needs under .. only:: of that tag. It built without a word, and now gets one warning per such need, which fails a -W build. Define the layout, or add "needs.layout_unknown" to suppress_warnings, which silences every such name, also of a need that is drawn. An error inside a layout’s own lines (an unknown layout function or grid, an argument a function refuses) still ends the build. (PR #2598)

  • 🐛 An unresolvable needs_default_layout – empty, or naming no layout (a skipped card of needs_card_layouts among them) – is one needs.config warning, on the builds that check the needs’ layout names, and clean is used in its place; it ended the build at the first need drawn with it. It is checked with those names, when the needs are post-processed, so a layout an extension adds before the documents are read resolves; one that add_need_layout adds after that step (from a doctree-resolved handler, say) is drawn, but reported as not defined. A project whose every need names a layout of its own built with such a value without a word, and now gets the warning. (PR #2598)

  • 🐛 A card of needs_card_layouts with collapse = "open" draws the meta region’s toggle, starting open whatever the need’s :collapse: says, as "closed" draws it starting closed; it drew no toggle, so a reader could not close the meta region. The compiled layout says so with a new optional keyword of the collapse_button layout function, fixed=True (the button starts as initial says, whatever the need’s :collapse: says), which a needs_layouts entry can use too. "honour" and "closed" compile and draw as they did. (PR #2598)

  • 🐛 A card of needs_card_layouts with header = false and a meta region (and neither a footer nor a side region) is drawn, the meta region above the content, on a new grid, simple_headless; it was skipped as not expressible, and a need naming it ended the build. With a footer or a side region it is still skipped, and a need naming it is now a needs.layout_unknown warning. No other grid changes. (PR #2598)

  • 🐛 Changed default: a card of needs_card_layouts whose side region names no position draws it on the right; it drew it on the left. A project with such a card sees its side column move: write position = "left" to keep it where it was. A card extending one that names a position (clean_l, say) keeps that position, and the built-in layouts (clean_l, clean_r, focus_l, focus_r, …) do not move. (PR #2598)

  • 🐛 In the places below that take a need id, a need part’s address ID.part reads as its need, as a link to a part already did.

    The places: the targets of need_outgoing and need_incoming, the uml(id) and flow(id) functions and the links import() follows, the :start: of needsequence, the need_id of copy and of links_from_content, and the from of a derived field’s copy and content_links rules; links_from_content and content_links read the need’s whole content. :need_incoming: given a part address lists the links that point at the part, its own back links. The roles, the needuml functions and needsequence ended the build on a part address, and copy, links_from_content and a rule’s from reported an error and gave no value. An address naming a part its need does not have is treated as an id naming no need, except that the two roles report it as :need: reports a missing part. Changed output: a :need_outgoing: or :need_incoming: naming no need, which ended the build too, is now reported as :need: reports one (a needs.link_ref warning) and rendered as an unresolved reference. The need card’s outgoing row and the list :need_outgoing: renders show a link to a part of an external need as they show one to a local part, linked to the part’s anchor as :need: links it, where they showed the need’s id and linked the need. (PR #2551, PR #2553, PR #2567)

  • 🐛 Seven more places read a need part’s address ID.part, or a link to a part, as a link to a part is read: the address is split once at its first ., and names the need when the need has the part.

    • needextract given REQ_1.p1 extracts REQ_1, where it read the address as it read any argument naming no need (as a filter, reported as invalid, or, under an id pattern accepting it whole, as an id naming no need). An argument that is the address of a part an existing need has always names that need, also when it could be read as a filter: given a need var with a part flag, var.flag extracts var. Any other argument is read as before, an address of a part the need does not have included.

    • needextend given a part address still refuses it, with the same warning and strictness, now saying that the address names a part of the need and to extend the need.

    • needflow’s :root_id: naming a part starts the walk at the part’s need, where it drew nothing, and the walk follows a link to a part to the part’s need. The walk’s first incoming step follows only the links that point at the part, its first outgoing step follows the need’s links, and every later step follows the links of the need it reaches.

    • A schema’s network rule validates the need a link to a part names, where it reported a broken link (issue #2337).

    • A link to the empty part, REQ_1., which no need has, keeps its . where the link is stored, written to needs.json and reported, where the . was dropped.

    Given to needextend or :root_id:, an address naming a part its need does not have is treated as an id naming no need, and a link to one stays a dead link.

    Changed output:

    • A :root_id: diagram whose needs link to parts now holds the needs those links lead to.

    • A needtable link cell splits a link at its first ., where it took the second dot-separated segment as the part, and writes a link to a part its need does not have as text, as it writes a link to a need that does not exist, where it linked #ID.part (issue #2488). A link naming a need whole, whose id holds a ., is written as before.

    • A needflow edge is drawn as a part edge when its link names a part, so a link from a need whose id holds a . is drawn as a link between needs, where it was drawn as a part edge (issue #2488).

    • A link written REQ_1. is REQ_1. in needs.json, in its dead-link warning and in a filter ("REQ_1." in links), where it was REQ_1. So a needtable link cell writes it as text, a needflow draws no edge for it and its walk does not follow it from the need that holds it (it still counts in REQ_1’s back links, so a walk into REQ_1 reaches the need holding it), and a schema’s network rule reports it as a broken link, where each read it as a link to REQ_1.

    The first build after upgrading reads every document again. (PR #2552, PR #2553)

  • 🐛 The text of a need part written (id) text no longer keeps the white space after its (id) (issue #1437): (p1) first has the text first, where it had " first", and a text written on the line after its (id) no longer starts with a line break. White space at the end, which a MyST role can hold, is removed too; white space and line breaks inside the text are kept. White space is Unicode’s White_Space. No part id changes, and a part with no (id) keeps its whole text as written. A part a record states keeps its text as given wherever that part is kept, as the parts of an external need are, but for its line breaks where a need whose content is read takes it (see the entry on the parts a record states, above).

    Changed output: a part’s text wherever it is shown or read: in needs.json parts (and content.parts of the draft format 2a1); as content in a filter; in the text of :need: and of a need card’s link to a part, whose 30-character cut (needs_role_need_max_title_length for :need:) now counts from the first word; in needtable :show_parts: rows and needflow labels, so a needflow image is written again under a new name; and on the page where a part directly follows a character other than white space, such as punctuation: (\ :np:`(p1) first`) renders (first p1) where it rendered ( first p1). A filter comparing content == " first" must drop the space. The first build after upgrading reads every document again. (PR #2555)

  • 🐛 A need part in a need’s content no longer stops a builder from writing its page. text, man and epub ended the build on a page with a part (departing unknown node type: NeedPart), and texinfo warned unknown node type: only html and latex knew the node. A writer, another extension’s included, now gets such a part as the inline text it is, with its id and its link. Changed output: xml and pseudoxml no longer write a NeedPart element around a part; the part’s inline (class need-part, the part’s id) inside it is written as before. html and latex output does not change. (issue #2556, PR #2558)

  • 🐛 A needflow drawn with the graphviz engine renders when it draws a need part with no text, or a need with no title: dot refused the empty <b></b> that took the text’s place, and the whole diagram was not rendered. Such a node is now labelled by its type and id. The PlantUML engine was not affected. (issue #2557, PR #2558)

  • 🐛 A needflow drawn with the graphviz engine renders when it draws a need whose type has an empty title in needs_types: dot refused the empty <font point-size="12"></font> that took the type’s place, and the whole diagram was not rendered. A node whose type title is empty, or white space only, now has no type line and is labelled by the rest (its title, where it has one, and its id); a need part keeps its (part) line. Every other node’s label does not change. (PR #2561)

  • 🐛 A page with a needflow drawn with the graphviz engine builds with the epub builder, which ended the build on it (departing unknown node type: NeedflowGraphiz): epub writes with the html writer but looks the visitors of a node up under its own name, and another extension sphinx-needs loads registers one there, so a node registered for html alone was unknown to it. Every node sphinx-needs registers for html is now registered for epub with the same visitors. So a :need: role in the title of a page that a toctree lists, and a need part in a section title, no longer end an epub build either. Changed output: a needtable in an epub carries the attributes it carries in html (data-needstable-* on the table, data-* and scope on its rows and header cells). html, latex and every other builder’s output does not change. (PR #2561)

  • 🐛 A needlist, needtable or needextract that lists a need on a page the latex or texinfo builder leaves out, such as an :orphan: page or one only another of the latex_documents reaches, no longer ends the build (sphinx.errors.NoUri). The need is listed, its text with no link, as Sphinx writes a cross-reference whose target the builder leaves out. Where the need’s page is written, nothing changes, and the output of every other Sphinx builder does not change. (issue #166, issue #347, issue #902, issue #1288, PR #2564)

  • 🐛 An incremental build no longer keeps needs of needs_external_needs that an earlier build loaded and the sources no longer give. Such needs stayed in the environment beside the current ones, and kept warning, when a source’s id_prefix, json_path, json_url or version changed, when a source was removed, or when a need was removed from a source’s file, until a build started from a fresh environment (-E). The needs the previous build loaded are now removed before the sources are loaded again. That step removes nothing else: a need of the project that has taken one of their ids, and an external need an extension added through add_external_need, are left as they are. A fresh build does not change. The first build after upgrading reads every document again. (issue #2523, PR #2565)

  • 🐛 An incremental build re-writes the page of a need showing a value copied from another need, a derived copy rule’s from or the need_id of copy naming it, in two cases where the page kept the old value until a full build: the need named has a . in its id and changed, and a need whose id is a part’s address ID.part was added or removed in another document, so the copy reads that need, or the part’s need again. The page of the need a needextend names by an id holding a . is re-written when the extend changes, likewise. (PR #2567)

  • 🐛 A need part’s title is its text, wherever a part is read, as a needtable row and :need: already showed it; Filter string said a part keeps its own, and the code read the title of the part’s need (issue #2356). A need’s own title does not change, and a needflow with its default labels shows a part’s text as before.

    Changed output: a filter that meets a part reads its title as its text, whether or not it asks for parts. The filter of a needtable, needlist, needflow, needgantt, needpie or needbar, or of need_count, that tests title, a needflow’s highlight or border_color, a needgantt’s milestone_filter and a sort_by title now match or order a need part by its text, where the view’s filter tests need parts (needs_views_include_parts), so such a view lists, counts or marks a need’s parts only where their text matches, where it matched them by their need’s title: :filter: title == 'Alpha' listed the need titled Alpha and each of its parts, and now lists the need alone. A needlist line of a part shows the part’s text (p1: brake fast), where it showed its need’s title (p1: Alpha); a needgantt element of a part is labelled by its text; a needtable sorted by title sorts the rows of parts by their text. A filter or join that asks for parts (include_parts) and tests title – links_from_filter, a derived links rule’s where, and the joins of links_from_match and of a links rule with join – matches a part by its text, and no longer matches the parts of a need by the need’s title, so the links it derives can change. In Python, NeedPartItem["title"] (NeedPartItem, what an extension, filter code, a filter-func or a dynamic function reads of a part) is the part’s text, and a custom needs_diagram_template that reads {{title}} gets the part’s text. The need’s title is the title of the need a part’s id_parent names: a filter meant for the parts of a need names that need, such as is_part and id_parent == "REQ_1". needs.json does not change, except through such a derived link and the back links it gives.

  • 🐛 A needtable with show_parts lists a need part once, under its need, where a filter matching the need and the part listed the part twice: as a row of its own, and again under its need (issue #336). A part the filter matches whose need is not a row keeps its row of its own. This is decided before the sort and the :max_items: cap.

    Changed output: such a table has fewer rows, and its :max_items: cap counts a need with its parts as one entry, so it can keep more needs than before, and its notice and needs.max_items warning give the smaller total. A part the filter matched is listed once, under its need, without the row style its own row had: :style_row: is not applied to a :show_parts: row. This fix changes no table without :show_parts:; such a table whose filter or sort reads title changes through the fix above.

  • 🐛 A needgantt draws an element whose title holds a line break or brackets, or is empty, where PlantUML refused the whole chart. A need part’s title is its text, where each of these is ordinary, and a need’s title could hold them too. The element’s label is now its title on one line, each run of white space one space, the element’s id when the title is empty, and each bracket written so that the chart draws it as a bracket.

    Changed output: a double space, a tab or a no-break space inside a title is drawn as one space. A title with single spaces and no bracket is drawn as before.

  • 🐛 The text of a need part role is on the page where the role makes no part. A second role with a part id its need already has, such as (p1) the second after (p1) the first, and a role outside every need rendered nothing, in every builder: Marks the first p1 and the second here. read Marks the first p1 and  here.. Such a role is now its text, as plain text: no id, no anchor, no link and no need-part class. The first role of an id is still the part, and the needs.duplicate_part_id warning, still one per repetition, now says so (Need 'REQ_1' already has a part 'p1': the first role of an id marks the part, this one is shown as plain text.), where it said the part “may get overridden”, which has not been so since 6.0.0. A role in a section title is not changed and still shows no text.

    A part’s address ID.part is now an anchor in latex and texinfo output. LaTeX wrote no label for it, so every link and need reference to a part was an undefined reference in the PDF, and texinfo wrote the anchor at the end of the output file, so a link to a part landed there. Both now anchor it at the start of the part’s text, once per page: where a page shows the part twice, as a needextract of a need on the need’s own page does, at the first, as a browser does with an id a page holds twice. A part is not anchored at its text in a caption (of a figure, a code block or a literalinclude), where a LaTeX anchor stops pdflatex, so there it is left as it was in both, nor, in texinfo, in text that writer writes as plain text (an admonition’s title, a hyperlink’s text, a centered line), so its anchor stays where it was.

    Changed output: the repeated and the outer roles’ text, in every builder; in latex, a label at the start of each part, once per page: \phantomsection\label in running text, a bare \label in a title, none in a caption; in texinfo, its @anchor there instead of at the end of the file. A part in html, dirhtml, singlehtml and epub is written byte for byte as before, its id on the need-part span, and so is a part in xml and pseudoxml. Stored parts, needs.json, filters and links do not change. (PR #2577)

Documentation

  • 📚 Three corrections: the example under needs_default_style set needs_default_layout to 'border_yellow', which is neither the option nor a style; it sets needs_default_style = 'yellow_border'. The class list under Layouts & Styles printed the style class as needs_style_needs_blue; it is needs_style_blue, and the list now shows the line a build writes, needs_type_<type> included. needs_flow_link_types and link_types taught the setting as choosing the link types a needflow draws; it changes no diagram on either engine (a needflow without :link_types: draws every link type but the summary ones), and the two pages now say so. The setting is not deprecated. (PR #2598)

Internal changes

  • 🧪 A contract for need parts and a conformance corpus that pins it, tests/fixtures/parts_conformance.toml: a part is an id, a text and the links that point at it, of one need, with no fields, no type and no outgoing links. Its cases, one project each, pin the role’s grammar, which need a part belongs to, a repeated id, the address ID.part[condition], links to a part and their back links, and what a part answers in a filter that asks for parts; design/parts-contract.md states the rules and names what is not on the page yet. This repository is the corpus’s repository of record, and ubCode is to vendor it. One case is marked as an expected failure of sphinx-needs: a hidden need has no parts (issue #1321). No behaviour changes. (PR #2550)

9.3.0

Released:

19.11.2026

Full Changelog:

sphinx-needs-v9.2.0…sphinx-needs-v9.3.0

Qualified need directives lead this release: every need type is also written .. need:<type>:: (a {need:<type>} fence in MyST), and needs_directive_name says whether the bare .. <type>:: is the need where another directive has that name too, so a project keeps both sphinx-design’s step and a need type step. A need id may name a namespace: with needs_namespaced_ids on, nc::m2::REQ_1 is the need REQ_1 in the namespace nc::m2, and c.in_namespace(), c.id.ns and c.id.local select by it. The switch is off by default in 9.x and on by default from 10.0: set it either way to keep a project’s reading through that release. Two further additions are opt-in: the draft needs.json format 2a1 (experimental), whose records carry each need’s source from project to project, and needs_import_restrict_content, which parses imported content with file insertion and raw markup switched off. Templates render with minijinja 3.1, where 9.2.0 used 2.x, and a value a template builds itself may print differently. Several fixes change output; two to read before upgrading: a boolean is no longer accepted as an integer or number value (PR #2540), and a filter that fails where it is tested need by need, or a needsequence or needgantt over a part link, a dead link or an unknown link type, no longer ends the build (PR #2541). ENV_DATA_VERSION is 28, was 25: the first build after upgrading reads every document again. This release requires ub-needs-exchange 1.2.0 and ub-project 1.3.0.

Improvements

  • ✨ Namespaced ids, opt-in: with needs_namespaced_ids on, a need id holding :: names a namespace, nc::m2::REQ_1 being the need REQ_1 in the namespace nc::m2, and a filter selects a namespace and everything below it with c.in_namespace("nc") (Namespaced ids, PR #2517)

    Turn it on with needs_namespaced_ids = True ([needs] namespaced_ids = true). It is off by default in the 9.x series and on by default from 10.0: set it either way to keep a project’s reading through that release. With it on, an id is split at its last ::, each segment before it made of ASCII letters, digits, _ and -; the id itself is unchanged, the need’s key, anchor and needs.json id, and a link names it whole. In a filter, c.id.ns is the namespace as text ("" for none), c.id.local the local id, and c.in_namespace() compares by segments, so nc does not select ncx::REQ_1 (Filtering by namespace (c.id, c.in_namespace)); in Python a need has id_ns, id_ns_segments and id_local. The three filter names are defined in every project; off, every need is in no namespace. The filter names and the attributes are experimental; the switch is not.

    A project that does not set the switch sees no change but one full re-read of its sources after upgrading (every need now stores its namespace). A project that turns it on sees, besides the new names:

    • needs_id_regex and a need type’s id_regex accept an id whose local id matches, or which matches as a whole: with the default pattern nc::REQ_00001 is accepted, and every id accepted before still is. As the local id is tried first, a pattern cannot refuse a namespace (^(?!.*::)… accepts nc::REQ_1);

    • an id the project writes or generates that holds :: but does not split cleanly (A::::B, std::vector<int>::size) is kept as a plain id and reported as needs.id_namespace, which fails a -W build until the id is corrected, the switch is turned off again, or the warning type is suppressed (suppress_warnings = ["needs.id_namespace"]); imported and external needs are not reported;

    • a dead link or a :need: role naming a bare id that no need has, and exactly one need has as its local id in a namespace, ends (did you mean 'nc::REQ_2'?);

    • an id_prefix ending in :: on needimport or needs_external_needs puts the imported needs into that namespace.

  • ✨ A filter that reads c.id.ns, c.id.local or c.in_namespace() while needs_namespaced_ids is off is reported as needs.namespaced_ids_off, naming the filter, once per place it is written (once per build where the place gives no location, such as a constraint): every id is plain then, so c.in_namespace("nc") selects no need and not c.in_namespace("nc") every need. The answer is unchanged; turn the switch on, or suppress the warning type (suppress_warnings = ["needs.namespaced_ids_off"]). With it, a c.is_a naming no need type (needs.filter_type) is no longer lost in a calc_sum filter over a computed field, nor at a place with no location (a constraint, say) that shares its filter string with a copy filter (PR #2518)

  • ✨ needs_import_restrict_content, opt-in: the content of a need needimport creates, and the text its templates render, is parsed with docutils’ file insertion and raw markup switched off: an include, literalinclude, csv-table :file: or raw in it does not run, a needimport in it reads no file, and MyST’s raw HTML in it is removed (needs.import_restrict). Turn it on with needs_import_restrict_content = True ([needs] import_restrict_content = true); it is off by default in 9.x and planned to be on by default in a later release. It narrows what imported content can do and is no substitute for trusting the file: its entry lists what it does not cover, filter strings, which are evaluated as Python, among them (issue #2259, PR #2542)

  • ✨ Qualified need directives and needs_directive_name: every need type is also written .. need:<type>:: (a {need:<type>} fence in MyST), and a project chooses whether the bare .. <type>:: is the need where another directive has the name too (PR #2507)

    need is a Sphinx domain of sphinx-needs’ own that serves each need type’s directive under its qualified name, whatever else the project loads (The qualified spelling: need:<type>). needs_directive_name, and a directive_name in a needs_types entry for one type, say what the bare name is: "claim", the need, over the other directive (what a need type has always done); "yield", the other directive, so a project keeps both sphinx-design’s step and a need type step, written .. need:step::; or "qualified", never the need. Both keys are read from ubproject.toml too ([needs] directive_name), where ubCode reads them.

    While neither is given, a need type taking another directive’s name is one needs.directive_name_clash warning that names the fix, in place of Sphinx’s directive 'step' is already registered and will not be overridden [app.add_directive], which said the opposite of what happened. It is silent where app.add_directive is suppressed, as Sphinx’s was. A need type named as a std or primary-domain directive (glossary, data), which a bare directive never reached, is now reported the same way, where nothing was said. A need type’s directive with a : is a needs.config warning and its entry is ignored, and add_need_type refuses it.

  • ✨ needs.json format 2a1 (experimental draft): write it with needs_json_format_version = "2a1", off by default (PR #2484)

    Each need in a 2a1 file carries its source: the lines of its directive in the file it is written in, each file it was included through, the needs.json it was imported from, and the docstring or the service it came from, innermost first, then the page it is placed on, with its sections. A record is {id, type, fields, links, content, source}: every value of the fields its need type declares (a default and a typed empty too: the file carries no schema), but for a null, which is left out and read as unset, links as a bare id or {id, part, condition}, and nothing computed – no back links, no is_* or type_* keys, none of format 1’s location keys. The needs builder, needs_build_json and the per-id builder obey the option; needs_json_exclude_fields, needs_builder_filter, needs_reproducible_json and needs_json_include_link_conditions apply, while needs_json_remove_defaults and needs_file are ignored, each with a warning. The format is needs.json format 2a2 (draft).

    needimport and needs_external_needs read a 2a1 file, and an imported or external need keeps the source its record carries before the hops of this build, so re-exporting it writes them all: the source travels with a need from project to project. Each such hop names the project it belongs to (origin). What the need answers about where it is from (docname, lineno, sections, section_name, signature, is_external, external_url, c.source) is what it answers read from a format-1 file. A needimport :filter: or a target_url template over the record itself sees less: its fields, links and content, and docname, sections, section_name and signature, but no lineno, is_*, type_name, external_url or other computed key.

    A 2a1 file is readable only by the release that wrote it, and each build that writes one says so in a needs.beta warning (a build that writes no needs.json is not warned). Sphinx-Needs 9.1.0 and 9.2.0 refuse it with one warning per reader that names its format version, 9.0.0 with one that its 'versions' is missing, and 8.5.0 aborts the build on it. At the default, 1, the needs.json is written exactly as before, but for one case that crashed: a needs_file with no versions (a 2a1 file, say) is one needs.json_load warning and a new file, where the build stopped with a KeyError.

  • ⬆️ Templates render with minijinja 3: minijinja>=3.0.5,<4, which was ~=2.15 (changed output) (PR #2475)

    The data sphinx-needs hands a template prints as before: need fields, needs_render_context and the needreport variables are Python values, printed as Python prints them. What moves is a value a template builds itself, mostly towards Jinja2’s behaviour:

    • a list or map a template writes, and every filter result, prints with Python’s quoting ({{ ['a'] }} is ['a'], was ["a"]), and items, dictsort and groupby give tuples ([('a', 1)]);

    • tojson spaces its output as json.dumps does ({"a": [1, 2]}, was {"a":[1,2]});

    • round rounds half to even (2.5|round is 2.0), and a negative precision rounds (15|round(-1) is 20);

    • // and % follow Python (7 // -2 is -4); 1 / 0 is an error, where it printed inf; 2 ** -1 is 0.5, where it was an error; -foo.bar negates the attribute, where it was an error;

    • title keeps an apostrophe’s letter (Don't), min, max and sort on several attributes ignore case, '%s'|format and '{}'.format print a float in full, find counts characters, and islower and its siblings answer as Python’s do;

    • int takes default= and base=, and min, max, sum and join take attribute=;

    • a macro whose name starts with _ cannot be imported from another template.

    It also fixes three faults of 2.x: {{ 'abc'.count('') }} hung the build forever (it is 4), one panic in a template broke every later render on its environment, and a filter that rendered a template on its own environment deadlocked. The full list is minijinja’s own changelog.

  • ⬆️ Templates render with minijinja 3.1: minijinja>=3.1.0,<4, which was >=3.0.5,<4 (changed output) (PR #2500)

    The data sphinx-needs hands a template prints as before. What moves is again a value a template builds or tests itself, mostly towards Jinja2’s behaviour:

    • true and false compare and sort as 1 and 0: [true, 2, false, 1, 0]|sort is [False, 0, True, 1, 2], which was [False, True, 0, 1, 2], [true, 1]|unique|list is [True], {true: 'a', 1: 'b'} is the one-key map {True: 'b'}, and [true, 0, false]|min is 0;

    • max and groupby keep the first of equal items: max(attribute='a') of two items with the same a is the first, ['B', 'b']|max is B, and groupby('k', case_sensitive=false) names a group by its first spelling;

    • an undefined value is empty, as in Jinja2: |length and |count of it are 0, |first and |last are empty, and |items is [], where each was an error; none|reverse is an error, where it was empty;

    • title and capitalize follow Unicode’s case mappings ('ΟΔΟΣ'|title is Οδος, and 'džemal'|capitalize is Džemal);

    • a map reverses: {'a': 1, 'b': 2}|reverse|list is ['b', 'a'], and |last of it is b, where it was an error;

    • a negative repeat is empty ('ab' * -1 is '', and [1] * -2 is []), where it was an error;

    • replace takes a count ('aaa'|replace('a', 'b', 2) is bba).

    It also turns two panics into ordinary results: 4 is divisibleby(0) is an error that says it cannot calculate 4 % 0, and a slice with a negative step works ([1, 2, 3][5:0:-1] is [3, 2]). The full list is minijinja’s own changelog.

  • 👌 needs_from_toml is read as TOML 1.1, through ub-project 1.3.0, which this release requires: an inline table may span lines or end with a trailing comma, a string may use the \e and \xHH escapes, and a time or a datetime may leave out its seconds; valid TOML 1.0 reads as before (PR #2476)

Bug fixes

  • 🐛 needs_json_format_version can be set on the command line: -D needs_json_format_version=2a1 writes a 2a1 file

    Sphinx converted a -D value by the type of the option’s default, the integer 1, so 2a1 was dropped as an invalid number and the file was written in format 1. The value is now passed through as the text it is, and the text "1" is format 1 wherever it is set (-D needs_json_format_version=1, conf.py, ubproject.toml); from conf.py and ubproject.toml it was reported as an unknown value. Unset, the option still reads the integer 1. A build whose value differs from the previous build’s reads the project again, so that it writes the file in the format asked for on every supported Sphinx (on Sphinx 7.4 a build that read nothing wrote no file); -D needs_json_format_version=1 after a build that left the option unset, or the reverse, is such a build: the text and the integer are both format 1 and differ as values (issue #2530, PR #2539)

  • 🐛 A needsequence over need ids holding :: (or another character PlantUML refuses in a name, such as -) renders, and shows each participant by its title or its id (PR #2515)

    It wrote each need id as it is as a PlantUML participant name. For a participant that sends a message, which is declared with its title, an id such as SUPPLIER::USER_A (which the default needs_id_regex accepts) or USER-A made the diagram a PlantUML syntax error, and so did a receiver that sends none, but for one whose id holds :, which was drawn wrongly instead (SUPPLIER::B as a participant SUPPLIER with the message :B: …). A participant is now named as needflow names a need in a PlantUML diagram, over the participants of the one diagram: each character PlantUML refuses in a name becomes _, and two ids that become the same name are told apart by a numeric suffix. What the reader sees keeps its text: a participant that sends a message shows its title, and a receiver that sends none shows its id, as before; in a diagram where such a receiver’s name is not its id, every such receiver is declared, in the order the arrows reach them. The message labels are unchanged, and a diagram whose ids hold none of those characters is written as before. The first build after upgrading reads every document again.

  • 🐛 The default item of a variant may hold ::, as a need id such as SUPPLIER::REQ_2 does (PR #2515)

    <<[False]:X, SUPPLIER::REQ_2>> read its last item as the variant name SUPPLIER with the value :REQ_2, so the field or link was left empty with a needs.dynamic_function warning that name 'SUPPLIER' is not defined. What remains of a variant is now its default value when it holds no single : (one with no : beside it), so the value is SUPPLIER::REQ_2. While a single : remains, an item’s name ends at its first :, as before: a variant reads differently only where the colons left in it all stand in runs of two or more (<<x:nc::A, nc::B>>, <<a:::b>>), and <<debug::need:`X`>> still names debug. The first build after upgrading reads every document again.

  • 🐛 needs_build_json_per_id and the needs_id builder encode the characters of a need id that a file name cannot hold on every system, such as :, in the name of the need’s file (changed output) (PR #2515)

    Each file was named <id>.json with the id as it is, so SUPPLIER::REQ_1, which the default needs_id_regex accepts, gave SUPPLIER::REQ_1.json, a name Windows refuses, and an id holding / could not be written (an error). < > : " / \ | ? *, the control characters U+0000 to U+001F and % are now each written as % and two upper-case hex digits (SUPPLIER%3A%3AREQ_1.json), in both needs.json formats. The file of an id holding none of them keeps its name, and every file’s content is unchanged; files an earlier release wrote under the old name are not removed. Not handled: an id too long for a file name, Windows’ reserved device names (NUL, CON, …), and names differing only by case.

  • 🐛 An id_prefix of needimport or needs_external_needs leaves a longer ::-joined id in a need’s content as it is (changed output) (PR #2515)

    The prefix rewrites each id of the file written in a need’s content, and it took : as a word boundary, so with the file id PLAIN_1 and the prefix SUP:: the text other::PLAIN_1 became other::SUP::PLAIN_1 and PLAIN_1::x became SUP::PLAIN_1::x, although neither names the file’s PLAIN_1. A file id directly after a :: that follows a letter, digit, _ or -, or directly before a :: that one of those follows, is now left as it is, whatever the prefix; any other character beside the :: (white space, punctuation, a third :, the end of the text) joins nothing. So an id of the file that itself holds :: (nc::REQ_1) is still rewritten as a whole, and so are an id beside a single : (:need:`PLAIN_1`, PLAIN_1: text) and one before a :: that ends the text or is followed by white space (see PLAIN_1:: before a literal block). Each id of the file is tested on its own, so where a longer file id is now left as it is, a shorter file id inside it may be rewritten: with the file ids REQ_1.SUB_2 and SUB_2, x::REQ_1.SUB_2 becomes x::REQ_1.SUP::SUB_2, where it was x::SUP::REQ_1.SUB_2. The first build after upgrading reads every document again.

  • 🐛 A one-word needextend argument holding (, =, ' or " is a filter (changed output) (PR #2515)

    needextend read every one-word argument as a need id, so c.this_doc(), c.is_a('req') and status=="open", written without a space, were reported as ids that do not exist (and ended the build under needs_needextend_strict). A one-word argument holding any of (, =, ' or " is now a filter; every other one-word argument is an id, as before, so a comparison without = such as priority>3 is still read as an id (write it "priority>3"). A one-word argument naming an existing need whose id holds (, =, ' or " is now a filter too; write it <id> (<REQ_001(A)>), as <…> still forces an id. The first build after upgrading reads every document again.

  • 🐛 A filter that is not a Python expression no longer aborts the build where a view’s :filter:, the needextract argument, a needpie or needbar :filter: or line, need_count, needuml’s filter(), needs_warnings or needs_builder_filter takes it (PR #2515)

    needextract:: nc::missing (an id the needs_id_regex refuses is read as a filter), or the same string as the :filter: of a needtable, needlist, needflow, needgantt, needextract, needpie or needbar, a line of a needpie or needbar, a need_count, needuml’s filter(), a needs_warnings entry or the needs_builder_filter, ended the build with invalid syntax. It is now one needs.filter warning naming the string and the error, at the directive, where there is one, and it matches no need. needextend’s filter form and copy(filter=...), which reported such a string already, keep their messages. needflow’s :highlight:, needgantt’s :milestone_filter:, needs_constraints and needsequence’s :filter: report it too, as any filter that fails there (issue #2252). Not changed: a filter too deep for Python’s parser still ends the build, as before.

  • 🐛 Every link condition reads back as it was written, one that ends in ] or starts with [ included, so a needs.json written with link conditions keeps them through needimport and needs_external_needs (changed output) (issue #2489, PR #2494)

    A condition runs to the closing brackets that end the link, as many ] as it was opened with: REQ_001[status in ["open"]] and REQ_001[[x == a[0]]] are the conditions status in ["open"] and x == a[0]. A need directive with such a link was refused (needs.create_need), and needimport and external needs dropped its condition without a warning, also from a needs.json sphinx-needs wrote itself. A condition that starts with [ read back as another condition, or not at all: one that also ends with ] is now written with one space after the opening brackets (REQ_001[[ [x] == a[0]]]), which the reader drops, and one that does not is read where the link closes with fewer brackets than it opened with (REQ_001[[1] == y]). Every link that was read without a warning is read as before; a link that was malformed may now read as a link with a condition.

  • 🐛 A :need: reference to a part of an external need names the part and links its anchor (changed output) (issue #2487, PR #2493)

    It rendered the external need’s bare id and linked the need, so the part was lost, and so was a text given in the role. It is now written as a reference to a part of a need of the project: the part’s text and the full ID.part (first part text (UP_001.p1)), or the role’s text, keeping the external need’s css class. The link goes to the part’s anchor, #UP_001.p1, when the fragment of the external need’s URL is the need’s id, alone or after the id_prefix of one of the project’s external sources, as on the default …/<docname>.html#<id>. A target_url of another shape is linked as it is. A reference to a whole external need still renders its id, also with a text given in the role.

  • 🐛 A part id repeated in one need is reported once, as needs.duplicate_part_id, and no longer also as a part “not associated with a need” (needs.part); the first part of the id is still the one kept (issue #2485, PR #2492)

  • 🐛 add_need warns, once per need, of the parts it was given that a need on a page drops (issue #2486, PR #2492)

    A need on a page takes its parts from its content (its need_part / np roles), which replaced the given ones silently. The result is unchanged: a given part whose id the content marks takes the content’s text, and an external or a hidden need keeps the parts as given. Now each other given part id is named in one needs.part warning.

  • 🐛 A full_title that is not a string no longer aborts the build: create_need refuses it with a warning, and a needservice need takes no full title from a link type or a value that is not a string (issue #2479, PR #2491)

    create_need, add_need, generate_need and generate_need_id raise InvalidNeedException (invalid_value, “full_title must be a string, not list”) for a full_title that is neither None nor a string, which a producer reports as it reports any refused need. That holds whether or not an id is given: without one they raised AttributeError: 'list' object has no attribute 'encode', which ended the build, and with one the value was ignored. A needservice datum’s full_title is the full title a need without an id has its id hashed from only when it is a string and the project has no link type of that name, as for a sphinx-codelinks one-line marker; it is still the need’s link or field. So a service need whose full_title is a list (a link type, or a field declared as an array) is created, with the id of its title, and one whose full_title is a link given as a string now has the id of its title, where it had the id of the link’s value (changed output).

  • 🐛 A link type named full_title is kept on needimport, external needs and codelinks multi-line needs (issue #2466, PR #2477)

    A needs.json written by sphinx-needs 5.0 or earlier carries a legacy full_title string on every need: in a project with such a link type it is now read as that need’s link targets, one warning per unknown target (link_outgoing, or external_link_outgoing for an external need), where it was dropped silently; filter those needs out with the needimport’s :filter:, or rename the link type (the only way out for external needs).

  • 🐛 needimport’s own warnings name the file and line the directive is written on, not the parser’s running line, under an rst_prolog or an include (changed output) (issue #2463, PR #2478)

    Inside an included file they named the including page; they now name the included file and the line the needs the directive imports record, also in an include sliced by :start-line:. Every warning of one directive names that one place, those about its records (an empty id, a need that cannot be created, unknown keys) included. A needimport that another extension generates is written in no file, and is still reported at its page.

  • 🐛 A field or link type named description is kept on needimport, external needs and codelinks multi-line needs, also on a need without content, so a project’s own needs.json reads back as written, unless it is written with content excluded (changed output) (issue #2465, PR #2481)

    sphinx-needs before 4.0 wrote a need’s content as description; that legacy description is now read as the content only when the record has no content key, after its schema defaults are merged – the rule of ub-needs-exchange 1.2.0, which this release requires. A need without content, which sphinx-needs writes as "content": "" (or, with needs_json_remove_defaults, as the schema’s content default), lost its description field into the content, and a need with neither content nor a description (a nullable field written as null) was refused. A link type of that name was refused on needimport and external needs and lost on a codelinks block. A body-less codelinks block without an id and with an empty title is given the id codelinks predicts for its duplicate check and [docs] link, and a body-less imported need no longer warns needs.import_doctype under :parse_by_doctype:. A file written with content excluded (needs_json_exclude_fields) has no content key and reads as a pre-4.0 file, as before: its description is taken as the content.

    A hand-written record with an empty content beside a description meant as its content now keeps the content empty, and, in a project that declares no description, an imported need reports that key as unknown (needs.unknown_import_keys, or needs.unknown_external_keys for external needs); move the text into the content. One whose content is not a string (null, 0, false, [], {}) beside a description is refused, as such a content already is without one.

  • 🐛 A filter string with leading spaces or tabs selects what it selects without them in needs_warnings, needs_builder_filter, a needpie line, needuml’s filter(), the filter of the dynamic functions copy, links_from_filter and links_from_match, and a quoted needextend argument (changed output) (issue #2521, PR #2537)

    " status == 'open'" was refused there as not valid (unexpected indent) and matched no need: a needs_builder_filter written so exported none, a needextend extended none and the dynamic function failed, while a constraint or a link condition read the same string past its padding, as Python’s eval does. These places now read past exactly what eval reads past, spaces and tabs (a newline or a form feed followed by a space is still refused, as eval refuses it); a c.is_a in such a string naming no need type is reported (needs.filter_type) as in the unpadded one; and a warning quoting the filter quotes it as written. A derived field’s where and test are the exception: a declared rule, which must parse as written, so a padded one is still refused (needs.derive_invalid). A directive option such as :filter: was never affected: docutils strips it.

  • 🐛 A c.is_a naming no need type is reported once at each place it is written, with the place’s file and line (an external need’s link condition names the need), where a filter is tested need by need – a needflow :highlight:, a needgantt :milestone_filter:, a needsequence :filter:, a link condition – and at each of two needextends of one document with the same quoted filter (changed output) (issue #2528, PR #2537)

    There, needs.filter_type was reported once per build for the string with no location, however many places wrote it, and a place with no location sharing the string (a constraint) took their report; a highlight, milestone filter or sequence filter that no need was tested on, and the second of two such needextends, were not reported. It is now reported together with needs.namespaced_ids_off, at the same places and as often; a constraint, which has no location, is still reported once per build for its string.

  • 🐛 A boolean is no longer accepted as an integer or a number: true or false in such a field, or as an item of an array of either, is refused as any other value of the wrong type is (changed output) (issue #2533, PR #2540)

    Python counts a bool as an int, so the type check let a boolean through: the need was created holding it, the schema validation then reported it (sn_schema_violation.field_fail), and a filter such as effort > 0 was true for it. A needimport, external or needservice record holding such a value is now refused with that route’s own warning (needs.import_need, needs.load_external_need, needs.load_service_need), and so is a record that takes a boolean default from the file’s own needs_schema. A project’s own code calling the creation API (create_need, add_need, add_external_need, ingest_need_record, generate_need) with such a value gets the InvalidNeedException it gets for any other value of the wrong type, where the need was created before (silently, with needs_schema_validation_enabled = False). A boolean default or predicates value of such a field is reported as needs.config and not used, and on a need type as needs.type_conflict (it was refused as needs.type_widening before). A dynamic function or variant data returning a boolean for such a field is reported as needs.dynamic_function, and the value is dropped. An integer is still a number.

  • 🐛 A filter that fails where it is tested need by need – a needflow :highlight:, a needgantt :milestone_filter:, a needsequence :filter:, a needs_constraints check – no longer aborts the build (issue #2252, PR #2541)

    A filter there that is not Python (nc::MISSING), names what a need does not have (ab == 1), raises while it is evaluated (int('x') == 1) or is a constant ended the build with a traceback (NeedsInvalidFilter). It is now reported as a view’s :filter: reports it: one needs.filter warning naming the string and the error, at the directive, however many needs it fails on. It matches no need it fails on and answers every other need, so a filter that fails on every need highlights no need, makes no task a milestone and draws no message. A constraint check, which has no directive, is reported once, ending (from constraint 'c1', check 'check_0', first on need 'REQ_1'), and is not evaluated on a need it fails on: it neither passes nor fails there, runs no on_fail action, and the need’s constraints_results and constraints_passed are what they would be had the check not been declared. A filter that works selects what it selected.

  • 🐛 A needsequence or needgantt over a link to a need part, or to a need that does not exist, or with a link type that does not exist, no longer aborts the build (issue #2336, PR #2541)

    Both looked a link up as a whole need id, so a link such as USER_B.p1, and a dead link, ended the build with a KeyError. A link to a part the need has is now a link to the need owning the part (a needsequence message to USER_B, a needgantt constraint at [USER_B]). A link to a part the need does not have (USER_B.nopart), like a link to a need that does not exist, is a dead link: it is left out of the diagram, as needflow draws no edge for it, and the dead-link check reports it, as it did (needs.link_outgoing). In a needsequence’s :link_types:, a link type written in another case (LINKS), which the directive accepts, ended the build; it is now walked as the link type it names (links). A back-link name (links_back) gets the directive’s “Unknown link type” warning (needs.needsequence) and is walked, as before. A name that is neither a link type nor a back-link name ended the build right after that warning; it is now left out after it. A name in a needgantt’s :starts_with_links:, :starts_after_links: or :ends_with_links: that is no link type (a back-link type such as links_back included) ended the build (SphinxNeedsLinkTypeException); it is now one needs.needgantt warning with the same text, at the directive, and is left out.

9.2.0

Released:

04.11.2026

Full Changelog:

sphinx-needs-v9.1.0…sphinx-needs-v9.2.0

Where a need comes from is the first story of this release. Each need records the places its text came through – the file its directive is written in, an included fragment, the needs.json it was imported from, the test report it was read from, the code entity a sphinx-codelinks marker is attached to – and a filter reads them as c.source: c.source.kind, path, line, paths and symbol select the needs traced from code under ../src/, the needs of one test report or those written in one fragment, answered without eval. Extensions create needs through the new create_need(), with the fields and links as two mappings and one NeedItemSource, and ask which option a need type’s directive takes with resolve_need_option; add_need is deprecated in its favour, and a new section of the API page says what is public. The second story carries on the per-type model of 9.1.0: a link type derives a chain’s far ends as links, a summary link type marks a shortcut across the trace, c.is_a('req') follows inherits, a need type declares a severity, the back links it must receive and the shape of its ids, an extension declares a field on its own need types alone (add_field(..., types=[...])) and a project’s needs_types entry narrows an extension’s type, copy takes where and any / all take empty. Several fixes change output: a need from a needimport, a needservice or a sliced include records the line it is written on, a need inside a C, C++ or JavaScript domain object takes that object’s name as its signature, a hidden need is located as a visible one in its place is, and an incremental build re-writes every page showing a need that changed. A directive option now matches a field or link type ignoring case, and two names equal ignoring case are a configuration error that stops the build. The first build after upgrading reads every document again. This release requires ub-project 1.2.0.

Improvements

  • ✨ c.source in a filter reads where a need comes from: the needs traced from code under ../src/, the needs from one test report, the needs written in an included fragment (Filtering by where a need comes from (c.source))

    Beside c.this_doc() and c.is_a(): c.source.kind is the producer (import, external, report, code, generated, page), c.source.path and c.source.line the file the need is written in and its line there, c.source.paths every file it came through that the build records, innermost first (test membership: it may gain entries), and c.source.symbol the qualified name of the code entity a traced need is attached to; c.source.document and c.source.sections are aliases of the need’s docname and sections. A path is relative to the source directory, with .. for a file outside it. A facet the build does not know yet is None – the path of an imported or an external need, or of a test case – and later releases only fill it. The facets are in the portable filter language, answered without eval, and computed only where a filter reads them. They are not available in a field predicate, a needimport :filter: or a variant condition, where the error says so. docname, sections, lineno, is_import, is_external and signature are unchanged.

  • ✨ A link type derives a chain’s far ends as links: copy of id and collect of a link type, over a link type, declared on a link type (A chain as links: copy and collect on a link type, issue #2370)

    { kind = "copy", field = "id", over = "satisfies" } on a specification and { kind = "collect", field = "chain", over = "implements" } on the rungs below give every need of the chain the requirements it traces to as links, and each requirement the needs that reach it as back links. Each link is kept once by its target and part, its condition dropped; a dead link is carried, and reported where it is written. Such a link type is a summary (summary = false beside the rule is refused), counts toward needs.derive_dense, and is computed with the link types: an over naming back links, and a field naming a value field or back links, are refused at load (needs.derive_invalid), and needs reading one another’s chain around a ring are needs.derive_cycle. over may name a union, read through its members, so a chain climbs several link types at once (over = "trace_up"); a collect of its own link type over a link type another kind of rule computes is refused. A dead link carried is flagged (has_dead_links) and drawn forbidden only as the link type it is written in says. A collect, or a copy over a link type another rule computes, links needs its need does not name, so in a project with one every change of a need re-writes every need-relevant page on an incremental build (Incremental builds). On a field, copy and collect are unchanged.

  • ✨ Summary link types: summary = true on a needs_links entry, or on a need type’s entry of a link type declared on need types alone, marks a link type whose links are shortcuts across the trace rather than steps in it, such as a test result linked straight to the requirements it covers (Summary link types, issue #2370)

    It works as any link type wherever it is named (a filter, a needtable column, a rule’s over, a needflow’s :link_types:, a schema rule), and a need holds its links and back links as usual; but a needflow without :link_types: neither draws it nor walks it from :root_id:, so a diagram does not show every path twice. The schema of the needs.json marks it, and its back links, "summary": true, and a union cannot name it as a member (needs.derive_invalid). It is set on the link type for every need type: on a link type declared on need types alone, by the first need type’s entry declaring it, which the others may repeat or leave out (another value is needs.type_conflict, that entry ignored); on one declared in needs_links, a need type’s entry giving it is a needs.config warning. In a rule it is no key (needs.derive_invalid); copy = true beside it is a needs.config warning, and nothing is copied into links. Without it nothing changes.

  • ✨ c.is_a('req') is true for a need whose type is req or inherits from it (issue #2322, issue #2402)

    type == 'req' compares the type’s name alone; c.is_a('req') follows inherits, directly or through other types, as the project’s need types declare it: with sys_req inheriting req and hw_req inheriting sys_req, it selects the needs of all three, as type in ['req', 'sys_req', 'hw_req'] does. It reads the need’s type and the need type declarations, and no field: a need carries no list of its types. A name that is no need type selects nothing; a string literal naming one is reported as needs.filter_type, with the type it is the title of or is close to: once per filter and place it is written, once per filter string where it has no place (such as a derived field’s where), and once per needs_warnings entry, naming it. Silence a deliberate one with suppress_warnings = ["needs.filter_type"]. It is a check beside c.this_doc(), in the portable filter language with a string literal as its argument, answered without eval, and in the eval tier for any other argument. It reads the need alone, so it is available in a filter configured in conf.py and in a derived field’s where, where c.this_doc() is not; like c.this_doc(), it is not available in a needimport :filter: nor in the predicates of a needs_fields entry. c.is_a tests the need’s type: to follow a link type named is_a, use the link. See Filtering for a type and the types inheriting from it.

  • ✨ A needs_types entry naming a need type an extension adds narrows that type, where it was ignored (issue #2371)

    An entry for sphinx-test-reports’ testcase, or any type an extension adds with add_need_type, is a narrowing of it, as an entry naming a default type is: the keys it gives win, the title, prefix, color and style it leaves out are the extension’s, and its inherits, fields and links (with derive, target_types, minItems / maxItems, a narrower schema) apply to the type’s needs, as on a type the project declares, whenever the extension adds the type. So [needs.types.testcase.links.evidence_for] derive = {...} gives test cases a derived link type of their own (joining on the case_name of test needs takes [needs.types.test.fields.case_name] too, once sphinx-test-reports declares its fields on its own types, below). The entry takes every key of a need type’s, back_links, id_regex and a field’s severity (below) included, and only narrows: its declaration of a field the extension declares starts from the extension’s, so one widening it is a needs.type_widening warning (one re-typing it a needs.type_conflict), and is ignored. A bare entry still declares no type (the default types are kept beside it). A bare entry naming no default type and no type an extension adds is ignored as before, but reported once the schema is built, naming derive_by_type as the spelling that attaches a rule to a type the project does not declare – the documentation now says that is what derive_by_type is for, rather than only that it is older. The GitHub services’ types are not narrowed: an entry with a title and a prefix replaces one, and a bare entry for one is ignored, with a warning naming the service’s type. See narrowing an extension’s type.

  • ✨ An extension declares a field on its own need types alone: add_field(name, description, types=[...]) (issue #2372)

    The field is the extension’s declaration – its schema, nullable and default – on the need types named (and the types inheriting from them), and absent on every other type, exactly as a field a project’s need type entries declare alone: None there, and a value set there is one needs.undeclared_for_type warning. A project need type that carries the field names it in its entry ([needs.types.test.fields.case_name], an empty entry included), which declares it there too; a needs_fields entry of the same name is the field, on every type, as before. A type named that nothing declares when the schema is built is one needs.config warning, the field declared on the others. FieldsSchema.declaring_types(name) names the types declaring a field declared on need types alone, either way, and the needs.json schema writes such a field nullable where the extension’s declaration is not, with a null default where it gives no literal one (so needs_json_remove_defaults leaves the key out). sphinx-test-reports declares its eighteen fields this way from 4.0.0. See fields an extension declares on need types alone.

  • ✨ Each need now records where its text came from, as a list of hops on need.source (provisional; see Python API, PR #2399)

    need.source.hops starts at the innermost place sphinx-needs knows the need came through – the file a directive is written in (an included file’s own, in an include), the needs.json an imported need was read from, the service that made a need, an external need’s page, with its sections there – and ends at the page the need is placed on, with its sections and the domain objects it is written in (an external need has no such page). In a nested reStructuredText include, each file the need’s file was included through is a hop between the two, innermost first and with no line (a MyST {include} is never recorded, so a chain through one records its reStructuredText links alone). A need an extension creates on its page (NeedItemSource.on_page, add_need) records the page’s file, with no line. A need in a docstring autodoc reads starts at a code hop of its Python file, with the language python and, where the definition autodoc names holds the need in its docstring, that definition’s file (for a member inherited from another module, that module’s) and its name in the file in sphinx-codelinks’ Python kinds (class Shape > method area), with its qualified name rendered as sphinx-codelinks renders it (Shape.area, make.<locals>.Made), so it compares with the code hop of a sphinx-codelinks marker in the same docstring. A sphinx-codelinks marker’s code hop carries the qualified name its analysis renders (ns::Widget::draw, <Widget as Shape>::area). A hop records a line range only where the file, read from disk, holds the need’s text there: under reStructuredText every line of the directive equals the file’s line (whole lines), under MyST the line opens the directive’s fence with its name and title; elsewhere it records no line (it can still be wrong only where the file holds an identical copy of the need’s text at the line the parser claims). It is provisional until it reaches needs.json: through 9.x a minor release only adds to the shape, and a rename or a removal waits for 10.0 (What is public). Nothing a filter, a table or needs.json shows changes; the first build after upgrading reads every document again. The five concrete NeedItemSource* classes this release started with are one class now, NeedItemSource (below); NeedItemSourceProtocol is unchanged.

  • ✨ A derive rule of kind copy takes where beside over or join (copy, issue #2246)

    where narrows the targets before select reads them, as it does for the other kinds and for links with join: select = "first" takes the lowest-id target that passes where and sets the field, "unique" counts only those, and "list" keeps their values. A target the filter cannot be evaluated on is dropped, without a warning. A copy of the need’s own field, or of the need from names, still takes no where (needs.derive_invalid).

  • ✨ A derive rule of kind any or all takes empty, the value it gives over no candidate (any and all, issue #2377)

    Over no candidate all is true, which on a requirement nothing tests reads as “every test passed”; all_passed = { kind = "all", test = "status == 'passed'", over = "tests_back", empty = false } gives false there instead. No candidate is what is left once where has dropped the needs it does not hold on. Unset, empty is the kind’s own value (all true, any false), so no existing rule changes; on any other kind, or with a value that is not a boolean, the rule is refused (needs.derive_invalid).

  • ✨ A need type’s declaration of a field or link type carries a severity: a constraint reported, not failed (issue #2374)

    severity = "warning" (or "info") on a [needs.types.<t>.fields.<f>] or .links.<l> entry is the severity of every constraint of the type’s declaration – its schema keywords, its links’ minItems and maxItems, and nullable = false – where each was a violation. The failures are reported as sn_schema_warning.field_fail (sn_schema_info.*), a warning rather than an error. A field not nullable below violation is asked for, not enforced: a need without it is created, the field None, and reported at that severity (schema path fields > nullable), so switching the schema validation off (needs_schema_validation_enabled) silences it; the needs.json writes such a field nullable. A type inheriting the declaration keeps its severity and may raise it; one lowering a severity an ancestor gives is a needs.type_widening warning, and is ignored. A severity on a needs_fields or needs_links entry, which takes none, is a needs.config warning. Without a severity nothing changes. The fields-per-type conformance corpus may now pin a finding’s severity. See A constraint reported, not failed.

  • ✨ A need type declares how many links it must receive: [needs.types.<t>.back_links.<l>] takes a count (issue #2375)

    schema = { minItems = 1 } on a back_links entry named after a link type l says that every need of the type is the target of at least one l link, its back links <l>_back (maxItems: of at most so many), so a coverage-*-back schema rule that only counts folds into the type’s declaration. The count is every link of l to the need, as minItems counts the outgoing ones (a link to a part of the need included); it is inherited, and narrowed, by the types inheriting from the type; it is checked by the schema validation once every link is final, a link_fail of the field <l>_back at the entry’s severity; a need from needs_external_needs is not counted, an imported need is. The entry takes a description, minItems and maxItems, and a severity; any other key is a needs.type_conflict, and so is an entry naming no link type (“did you mean” the link type it is close to). A links or fields entry named <l>_back is still refused, and now names the back_links entry. back_links is a key of a needs_types entry. This supersedes the proposal of issue #2323. See Links a type must receive.

  • ✨ A need type declares the shape of its ids: id_regex on a [needs.types.<t>] entry (issue #2373)

    The id of a need of the type matches the pattern, beside needs_id_regex and the id_regex of every type it inherits from, checked where and as needs_id_regex is (re.match, an authored or a generated id, never an imported or external need’s): a need whose id does not match is not created (needs.create_need, naming the pattern and the type that gives it). So an id-prefix-<type> schema rule folds into the type’s declaration when a wrong id should refuse the need; one that should only be reported stays a rule. A pattern that is not a regular expression is a needs.type_conflict warning, and is ignored. See The ids of a type.

  • ✨ create_need: an extension creates a need with its fields and links as two mappings, and gets the need back with its nodes (issue #2137)

    sphinx_needs.api.create_need(app, state, source, need_type, title, *, id, fields, links, content, ...) takes the need’s field values as fields (the core fields such as status and tags, and the project’s fields) and its links as links, kept apart from its own parameters, so any name a project gives a field can be used. It returns (need, nodes): the need as recorded, which an extension no longer has to look up or re-derive the id of, and the nodes to insert. Its location is a NeedItemSource (below), and only one: any other object, one with the NeedItemSourceProtocol interface alone included, is refused with a TypeError naming NeedItemSource.from_directive(self) and NeedItemSource.on_page(docname, lineno=...). A name in the wrong mapping, or one of its own arguments given in a mapping (title, content, …), is refused, naming where it belongs. This package’s need directives, list2need and needservice, sphinx-codelinks’ one-line needs and sphinx-test-reports’ needs are created through it; needimport, needs_external_needs and sphinx-codelinks’ multi-line needs through the same path, as records. add_need is deprecated in its favour (see Deprecations). See create_need().

  • ✨ Extensions that wrap or preset need directives can ask which option a need type’s directive takes for a name: sphinx_needs.api.resolve_need_option(app, need_type, name)

    It answers as the need directive matches an option it is given, against the same names – the directive’s own options (id, status, hide, …) and every field and link type the project declares (one another need type declares alone is matched too, and the directive then reports it as not declared for this type) – a name equal to one first, else one equal ignoring case, returned as declared ("owner" and "OWNER" give a field declared Owner), and None for no such option; a need type the project does not have is a ValueError. It is available once sphinx-needs has built the build’s schema, in its own env-before-read-docs handler: from a handler at a priority above 500, or any later event. Called earlier, it raises RuntimeError, also on an incremental build, where the previous build’s schema is still in the environment. So an extension no longer keeps its own copy of the directive’s options. See resolve_need_option().

  • ✨ NeedItemSource: one class for where a need comes from, public from sphinx_needs.api, with NeedItemSource.from_directive(self) as the source of a need an extension’s directive creates and NeedItemSource.on_page(docname, lineno=lineno) for a need at a line the caller gives (issue #2137)

    The source create_need() takes is one frozen class, NeedItemSource: the hops the need’s text came through, and the location facts the hops cannot give yet (lineno, lineno_content, parser_lineno, is_import). Every need sphinx-needs creates has one, and so does every need sphinx-codelinks and sphinx-test-reports create. In a directive, NeedItemSource.from_directive(self) records what a need directive records: the line the directive is written on (resolved through rst_prolog and includes), its parser line and content offset, and the file and page it is written in, after any hops given as first; it takes any docutils Directive, not only a SphinxDirective. NeedItemSource.on_page(docname, lineno=lineno) gives a need its page and the line the caller passes, the source add_need built: for a need at its directive’s parser line, as add_need took it (sphinx-codelinks’ needs sit there), or at a line the directive’s data names. The class’s name, from_directive and on_page are stable, and so is reading a source through NeedItemSourceProtocol; the general constructor and its keywords (hops, lineno, lineno_content, parser_lineno, is_import) are provisional, for sphinx-needs’ own producers and advanced use, as hops and the hop types, NeedSourceHop, NeedSourcePhysical and NeedSourceSemantic, now also importable from sphinx_needs.api, are, until needs.json carries them: through 9.x a minor release may add an optional field, a hop kind or a keyword, and a rename, a removal, or a change to an existing one’s meaning or type waits for 10.0, because published sibling extensions construct them (What is public). A need’s docname, lineno and the other location keys are unchanged, and so is NeedItemSourceProtocol, which is how a need’s source is read; the first build after upgrading reads every document again. See Migrating from add_need.

  • 👌 A needs_fields entry naming a core field a need computes (type_name, docname and the other core fields that take no declaration) is reported as ignored, with a needs.config warning, where it was ignored silently. Nothing read such an entry, so no output changes, but a build run with -W (warnings as errors) that has one now fails until the entry is removed

  • 👌 The needs.derive_scope warning at a needextend whose filter names a computed field says what computes it: “a derive rule” for a field a derive rule computes, “a dynamic function or variant” for a [[…]], <<…>> or <{…}>, and “a derive rule, a dynamic function or a variant” when the filter names fields of both, as ubCode words it (issue #2207)

    It said “a dynamic function or variant” for a derived field too, where the project wrote neither. The warning’s code and severity are unchanged.

  • 👌 -D needs_variant_data_file swaps the data file, never the table it is read from (issue #2378)

    The rule is now ub-project’s reading contract (section 6.8), shared by every tool that reads ubproject.toml, and sphinx-needs passes the value to it rather than removing keys from the toml itself. For a project that builds without warnings, nothing changes in the output (a project on the legacy location gains one -v line naming it, as it has without -D): the value replaces the data file of the location read, [variants] or [needs], without opening the toml’s own file, and that location’s inline table still applies; -D needs_variant_data_file= (no file) replaces it by none, so the location’s inline table is used alone. The location, the refusals and the warnings are now always those of the toml as written, so two projects that already warned or failed without -D now do so with it too: a [variants] declared by its data_file alone stays the location read, with the needs.variant_data_location warning for the [needs] keys beside it, where [needs] used to be read silently; and an empty or non-string data_file is refused. See Variant data: the [variants] table.

  • 👌 An unknown key in a field’s or a link type’s entry, and an unknown keyword in its schema, is reported and ignored (issue #2206)

    A key a needs_fields, needs_links, needs_extra_options or needs_extra_links entry does not have, such as a misspelt derive or target_types, was ignored in silence, so a field meant to be derived stayed authorable and a link type meant to be restricted was not. Each is now one needs.config warning, naming the entry, the key and the keys the entry has; the key is ignored and the entry kept. A severity in a needs_fields or needs_links entry is the one exception to the wording: its warning names the need type’s entry that takes it (see above). A name in a needs_fields entry, or an option in a needs_links entry, left from the list spelling, is accepted in silence where it repeats the entry’s name, as a migrated entry does, and reported where it gives another (it was always ignored: the entry is named by its key). A needs_extra_options entry is read for name, description, schema, derive and derive_by_type alone, as before, and its other keys, such as nullable, are now reported. A keyword the schema of such an entry does not have (enmu, minimum on a string, uniqueItems on a link type), at its top or in its items or contains, is one needs.config warning too, and dropped, the rest of the schema kept, where it stopped the build (Invalid schema: Additional properties are not allowed); so is one in the schema of a field an extension registers with add_field. The keys known are those of the configuration’s NeedFields, NeedField, NeedLinksConfig and LinkOptionsType types, whose NeedField now lists the keys a needs_extra_options entry is read for, and the keywords those of the schema types the schema is validated against.

  • 👌 A field or link type declared on need types alone whose name is close to a declared one is reported, “did you mean” (issue #2299)

    A fields or links entry of a needs_types entry naming nothing declared elsewhere declares a field (or link type) of the need types that declare it alone, so a misspelt name, asl meant to narrow asil, constrained nothing and was not reported. When the name is within difflib.get_close_matches(name, known, n=1, cutoff=0.8) of a core field an author sets, a registered field (a needs_fields entry, an extension’s, a service’s) or a global link type, it is now one needs.type_near_name warning, needs_types['req'].fields['asl'] declares a field of need types 'req' alone; did you mean 'asil'?; the field is declared all the same. A deliberate near name, such as a tag of one type beside tags, is reported too: suppress_warnings = ["needs.type_near_name"] silences these alone. See A misspelt field name.

Deprecations

  • ⚠️ add_need is deprecated, and is removed in 10.0: create_need replaces it (issue #2137)

    Each call of add_need() is one Python DeprecationWarning, at the line that calls it, naming create_need and Migrating from add_need; it creates the need as before. It is not a Sphinx warning, so a build run with -W (warnings as errors) is not failed by an extension that still calls it, such as sphinx-codelinks 2.0 and sphinx-test-reports 3.0. An extension whose own test suite turns warnings into errors (filterwarnings = error) does fail there, on its first call of add_need, until it moves to create_need. create_need takes the need’s location as one NeedItemSource (NeedItemSource.from_directive(self) in a directive), its fields and links as two mappings, and returns the need with its nodes; the migration section maps each of add_need’s arguments. generate_need, add_external_need and ingest_need_record are not deprecated.

  • ⚠️ A need_source that is not a NeedItemSource is deprecated on generate_need, add_external_need and ingest_need_record, and is refused from 10.0, as create_need refuses it now

    An object with the NeedItemSourceProtocol interface alone, given to one of them, is one Python DeprecationWarning at the line that calls it, naming NeedItemSource.from_directive(self) and NeedItemSource.on_page(docname, lineno=...); the need is created as before. Like add_need’s, it is not a Sphinx warning, so a -W build is not failed by it, and add_need gives no second warning for it. Only a NeedItemSource carries the hops a need’s origin is read from, the c.source facets among them: a source with the protocol alone gives a need none. Reading a need’s source through the protocol (need.source) is unchanged. See What is public.

  • ⚠️ The five source classes NeedItemSourceUnknown, NeedItemSourceDirective, NeedItemSourceService, NeedItemSourceExternal and NeedItemSourceImport are deprecated names of sphinx_needs.need_item, and are removed in 10.0: NeedItemSource replaces them

    Each is a function now, taking its class’s keywords and returning the NeedItemSource with the location keys that class gave, and reading the name (from sphinx_needs.need_item import NeedItemSourceUnknown) is a DeprecationWarning at that line. They were not documented API, and what they did beyond their keywords is gone: a source is a NeedItemSource, so isinstance, a match class pattern or a subclass naming an old name raises TypeError (a function is no class: test isinstance(source, NeedItemSource)), type(source) is never one of them, and an annotation NeedItemSourceUnknown | None evaluated at run time raises too; dataclasses.replace raises TypeError (build a new source) and dataclasses.asdict gives the one class’s fields; the attributes url (NeedItemSourceExternal), path (NeedItemSourceImport), external_url and is_external (NeedItemSourceUnknown) are gone (read source.dict_repr); dir(sphinx_needs.need_item) and, at run time, from sphinx_needs.need_item import * no longer include them (a type checker sees each as a deprecated function of its keywords); and no combination of keywords is refused: given hops, the hops decide docname, external_url, is_external (but NeedItemSourceUnknown(is_external=True) still puts an external hop first) and, without a lineno, the line, while a lineno given is the need’s, and an external_url without is_external is dropped.

Bug fixes

  • ‼️ A directive option matches a field, link type or core field ignoring case, in reStructuredText and MyST alike, and its value is stored under the declared name (option names and case)

    docutils lowercases every reStructuredText option name, so a field or link type declared with capitals (needs_fields = {"Owner": {}}, needs_links = {"Satisfies": {}}) could not be set from reStructuredText at all – :Owner: and :owner: were both Unknown option 'owner' and the value was lost – while MyST took :Owner: alone, and MyST’s :Status: was an unknown option where reStructuredText’s set status. Now any case of the name sets it, on a need directive, a needextend (+ and - keys too) and a needservice (whose service reads the declared name), and needs.json, filters and tables keep the declared spelling. An option written exactly as a name matches it first, so no value set before changes: only an option that was an unknown one now lands. Where MyST writes one name twice in two cases, that option, or else the first written, keeps its value and the other is ignored with a warning (needs.directive; needs.needextend on a needextend). Two names equal ignoring case are now a configuration error that stops the build: two fields, a field and a core field (Status), a field and a link type, two link types, a link type’s back links and another name (Tests_Back beside tests), or a name and an option a directive reads itself (Strict, needextend’s strict). Names spelt alike are handled as before. The options of list2need’s items, ((name="value")), are matched exactly, as before.

  • 🐛 A need a needimport or needservice creates records the line its directive is written on (changed output)

    rst_prolog, an .. include:: above the directive, and the include it is written in each shifted its lineno by the lines they insert, as they did for need directives before 8.4.0 (issue #1349): a needimport on line 14 of a page below an include was recorded at line 33. Filters, tables, needs.json and the warnings placed at a need’s line now give the directive’s line in the file it is written in, the included file’s inside an include. The warnings about the needs’ content and rendered templates do not move.

  • 🐛 A need in a sliced include records the line it is written on in the file, where it recorded its line in the slice (changed output) (issue #2428)

    docutils numbers an include’s slice (:start-line:, :start-after:) from the slice’s first line, so a need written on line 22 of a fragment included with :start-line: 3 had lineno 19 in filters, tables and needs.json, and its file hop had no line. sphinx-needs now recovers the slice’s start from the include’s options, on docutils 0.21 to 0.23, and takes the line it gives where the file holds the directive there: the lineno of a need directive’s need, a list2need item and a test need written in the slice (sphinx-test-reports) is the file’s line, and so is the file hop of those and of the needs a needimport or a needservice creates. The warnings placed at a need’s recorded line, such as a failed constraint or the “defined at” of a duplicate id, now name the file’s line too; docutils’ and Sphinx’s own messages about the same text, and the warnings a directive locates through docutils (most of a directive’s option errors), still name the slice’s line. Where the slice cannot be matched with the file – an include-read handler that rewrote it, a file decoded otherwise than with the project’s source_encoding, a :parser: include – and for a need in a table cell, in list2need item content, in content parsed in a declared markup, or generated by a test-report, the line stays the slice’s. :end-line: and :end-before: move nothing, except on docutils 0.22 and later where a form feed above the need had shifted it by a line, which is now the file’s line too. MyST includes are unchanged.

  • 🐛 A needs_external_needs source whose target_url renders an absolute URL (scheme://… or //…) links to that URL, where base_url/ was put in front of it (issue #2389)

    With target_url: "{{need['remote_url']}}", a base_url: "" linked every need to /https://github.com/…, and a base_url such as https://site to https://site/https://github.com/…; both now link to https://github.com/…, and the need’s external_url is that URL. Every other render, req:REQ_1 included, is still appended to base_url. Two configurations change. A base_url that is itself a URL-prefix service, such as https://proxy in front of an absolute target_url, is no longer put in front: put the prefix in the template instead, target_url: "https://proxy/{{need['remote_url']}}". And a template whose render starts with // because a leading field is empty ("/{{need['x']}}/{{need['id']}}" rendering //REQ_1) is now a scheme-relative URL, where it was base_url//REQ_1: fill the field, or write the template without the leading /.

  • 🐛 A field named like a parameter of add_need – state, app, need_type, full_title, need_source or allow_type_coercion – is an ordinary field in a need directive, list2need, needservice, needimport and needs_external_needs (issue #2392)

    The first need setting one ended the build with TypeError: add_need() got multiple values for keyword argument 'state', and a need setting allow_type_coercion lost the value without a word; an external needs.json record carrying app, need_source or allow_type_coercion ended the build the same way. A needimport or external record’s field named need_type was overwritten by the record’s type, and one named full_title dropped as the legacy key; both are read now. Every producer now creates its needs with the fields as a mapping. add_need itself still takes them as keyword arguments, so an extension calling it keeps the collision of its own parameters’ names; create_need has none. Two more names of the same kind: a field named like one of generate_need’s own keywords (needs_config, needs_schema, template_root) no longer stops add_need with the same TypeError, and a field the project declares under one of add_need’s deprecated keys (delete, hide_status, hide_tags, links_string) is a field through the producers, where add_need dropped it with a DeprecationWarning.

  • 🐛 An external need keeps a field named state the project declares (issue #2403)

    add_external_need dropped a record’s state as if it were add_need’s parser state, so the field was None on every external need. A state that names no field of the project is reported as an unknown key of the source and dropped, as before.

  • 🐛 A schema rule’s property on an array field may give contains without items ("tags": {"contains": {"const": "a"}}): the build stopped with a schema error, where the rule now applies, the field’s item type standing for items. A link type’s property is unchanged.

  • 🐛 A needs_types entry with a title and a prefix naming a need type an extension adds no longer stops the build with NeedsApiConfigException: testcase already exists as need type from the extension’s add_need_type: the entry narrows the type (issue #2371). add_need_type still refuses a directive another extension added, and a default type no entry of the project names.

  • 🐛 The needs_schema of a needs.json writes a link type’s literal default (changed output) (issue #2208)

    It wrote "default": [] for every link type but one derived by type alone, also for one with a literal default, such as [needs.links.rel] default = ["REQ_1"]: a reader of the schema took the wrong value for an absent rel. It now writes that default as a need holding it writes its links, sorted and deduplicated, with each link’s condition under needs_json_include_link_conditions (the default) and without it otherwise. A default a dynamic function or a variant computes, and a derived link type, still write []; a need type’s own default is not written. Under needs_json_remove_defaults a need holding the link type’s default now leaves it out, and a reader restores it from the file’s own schema, as ub-needs-exchange (needimport, needs_external_needs) does; a reader that does not restore defaults from the schema reads such a need as having no links of that type.

  • 🐛 A build that fails with needs_build_json, needs_build_json_per_id or needs_build_needumls set stops with its own error. Each of these writers ran after the failure as well and raised in turn, so a configuration error was reported as Handler <function build_needs_json ...> for event 'build-finished' threw an exception (exception: Needs schema has not been initialized yet.), with the real cause only in the chained traceback

  • 🐛 A need takes the name of its nearest enclosing domain object as its signature however the domain writes that name (changed output) (issue #2394)

    Only a name written as plain text was read, as the Python, reST and standard domains write it. The C, C++ and JavaScript domains usually wrap it in further nodes, so a need inside a c:function named cfunc had no signature, and one inside a cpp:function inside a py:class took the class’s name; both now take the function’s name, which filters and needs.json show. A need whose nearest enclosing object writes its name as plain text keeps its value, and a need inside a cpp:alias still has none. An empty name counts as no name, where an empty desc_name with no content failed the build.

  • 🐛 An incremental build re-writes every page showing a need that changed: a page whose needtable, needflow or other view lists it, whose :need: role names it, whose needs link to it or are linked from it, or whose need computes a value from it, kept its old values until a full build, and so did the needs a needextend changed or no longer changes (issue #2376, issue #346)

    The needs of every document re-read are compared, as read, with what that document gave before; on a change, the pages showing it are re-written, never re-read. An edit that changes no need, such as prose below the needs, re-writes nothing more, and one that only moves needs (lines added above them) re-writes the views and the pages whose roles name them, unless anything else in the project may read a line number. A dynamic function is read by its arguments, so copy of a need’s own field does not make its need depend on others (a back-link field does: other needs write it, as they decide has_dead_links and the other values computed when the needs are resolved); a value of any other shape, a variant say, is taken to read every need. A changed needextend with a filter re-writes every need-relevant page, as does every change in a project whose needs or extends link to needs they do not name before the needs are resolved, or with a needextend with a filter whose dynamic function reads needs it does not name, and so does every change of a need that a needextend with a filter links to or copies. A view without a sort, such as a needlist or a needflow, now lists the needs in document order on every build, where an incremental build listed those of the re-read documents last and a parallel one in the order its readers finished. Needs from needs_external_needs are not compared (issue #353). See Incremental builds.

  • 🔧 ENV_DATA_VERSION is 25: the first build after upgrading re-reads every document, which records the views and need roles each document holds and where each hidden need is (issue #2398), stores each need’s source as one class, with the hops above, computes again the selections and derived values of a filter using c.is_a, which 9.1.0 refused, computes the links a copy or collect on a link type, refused until now, computes, leaves the summary link types out of a needflow without :link_types:, records the file’s line for a need in a sliced include (issue #2428) and the directive’s line for a need a needimport or a needservice creates, and locates each need in one walk of the doctree

  • 🐛 A need with :hide: is located as a visible need in the same place is (changed output) (issue #2398)

    A hidden need that was the first child of its container – a .. only::, a .. note::, a parent need’s content, a py:function body – had empty sections, no signature and no parent need, and a hidden need following another need, hidden or not, took that need as its parent_need (so the other need listed it in parent_needs_back): the needs a needimport with :hide: imports were each the child of the one before. Both now get the sections, signature and parent_needs a visible need in the same place gets, which filters, tables, needflow diagrams and needs.json show. A visible need keeps its own location; its parent_needs_back now lists every hidden need inside it – it lacked a hidden first child, and any hidden need that followed another need inside it – and no longer lists the hidden needs that merely followed it. A hidden need after a title or a paragraph keeps its values. list2need places the children of a hidden item outside it, as before, so such a child is located there: its parent is the hidden item’s own parent need, or none at the top level, which can differ from the same list written without :hide:. An existing build directory is read again in full once.

Documentation

  • 📚 Reading the configuration through NeedsSphinxConfig is documented, and stable: an extension reads NeedsSphinxConfig(app.config).<name> for the configuration value needs_<name> as resolved, ubproject.toml included, and for types, layouts, functions and warnings what extensions and services add, as the 9.1.0 notes recommended for types and layouts. Reading only; variant_data_proxy is documented beside them, and the class’s other members are internal. See Reading the configuration.

  • 📚 Derived fields shows how to start a list roll-up one rung up (Starting a list roll-up one rung up): a copy of id over satisfies with select = "list" on the specification, then a collect on each rung below, and why a plain copy of the requirement’s own id cannot start it; and the same chain read upwards, which gives each need the tests that reach it (issue #2379)

Internal changes

  • 🔧 Each need is located by one walk of the doctree: its sections, signature and parent_needs are written from the semantic location recorded on its placement in need.source, which a second, older walk duplicated until now. Every value a doctree of Sphinx’s or docutils’ own gives is as before. Where an extension builds the doctree by hand, the one walk reads the need’s real place: a desc_signature outside any desc, or one the need is placed in, gives no signature, a desc_name holding an empty text node is no name, and a need whose target an extension dropped keeps its sections and takes its nearest enclosing need as its parent, rather than none or the need before it. The undocumented helpers get_sections_and_signature_and_needs and previous_sibling of sphinx_needs.directives.need are removed without a deprecation. An existing build directory is read again in full once.

  • 🔧 The var proxy over the variant data and the need types c.is_a reads are kept by sphinx-needs rather than on Sphinx’s configuration, which holds the declared options alone (issue #1840, issue #2402): app.config.needs_variant_data_proxy, undocumented since 8.2.0, is removed without a deprecation, and is read as NeedsSphinxConfig(app.config).variant_data_proxy

  • 🔧 The benchmark workflow measures sphinx-needs rather than the runner: a build time is the fastest of several fresh builds with no PlantUML diagram rendered (about three quarters of the old documentation figure was Java), the peak memory of the documentation build is tracked, and a regression is judged against the median of recent results on the same CPU model instead of the single result before it, which failed about one push in ten in 2026-10 on runners of different speeds

  • 🧪 A test fails when the shape of the data sphinx-needs stores in the environment changes without a bump of ENV_DATA_VERSION, and when the version is bumped without re-pinning that shape (issue #2420). It builds a project with every producer of needs, collects every class of sphinx-needs the pickled environment and doctrees hold, with the TypedDict classes their annotations name, and compares their fields with the pinned ones

9.1.0

Released:

22.10.2026

Full Changelog:

sphinx-needs-v9.0.0…sphinx-needs-v9.1.0

Fields and link types declared per need type are the heart of this release. A needs_types entry may inherits another and declare fields and links of its own, each with its description, schema, default, predicates and derive rule; a field or link type may be declared on the need types that have it alone, under one rule, “one name, one shape”; needs_types may be a table keyed by directive; a link type’s target_types says which need types its links may point to; a derived union of link types replaces copy = true, and the join role and links_from_match link needs whose field values match. A dynamic function of your own can declare what it reads and is then computed in order, like a built-in one, and every read of a value not yet computed is reported where it was silent. A filter string in the portable filter language is evaluated without Python’s eval, five to six times faster, with a conformance corpus that defines the language and a needs_debug_filters record naming the tier that answered each filter; every tier reads a filter for its truth, and a filter that is a constant is refused instead of selecting every need or none. A needs.json is read through the new ub-needs-exchange library and may carry a format_version, and a file written without its defaults restores them from its own schema. The package ships py.typed. Two changes are breaking, each with its migration under Breaking changes below: the built-in GitHub services are registered only when needs_services names them, and app.config.needs_types and needs_layouts no longer hold the types and layouts that extensions add. The documentation gains a page mapping Sphinx-Needs, Sphinx-CodeLinks and Sphinx-Test-Reports across the V-model’s five steps.

Improvements

  • ✨ A function of your own can declare what it reads, and is then computed in order, like a built-in function (issue #2354, PR #2366)

    @sphinx_needs.api.reads(own="test_option", every="target_option") names the parameters whose argument is a field the function reads on its own need or on every need, and add_dynamic_function(app, func, reads=reads(...)) declares a function you do not own. Such a call is computed after what it declares and before what reads it, where a function of your own is computed after every built-in function of its step: a links_from_filter, a links or union derive rule, or any other built-in function reading the links it computes holds them. A read of its own field is a needs.derive_cycle and a read of a later step is not run (needs.derive_scope). A name that is not a parameter of the function is one needs.config warning when it is registered, and a call whose declared argument is not a field name written out (a need.<field>, a number) is computed last, with one needs.config warning per function. A field the function reads by a name written in its code cannot be declared yet. A functools.wraps wrapper carries the declaration; sphinx-test-reports’ tr_link declares its reads. A function that declares nothing is computed as before. See Declaring what a function reads.

  • 👌 A read of a value the pass has not computed yet is reported as it happens, where several were silent (issue #2354, PR #2366)

    A built-in function or derive rule whose filter or where reads a value your own function (one that declares nothing) or a call whose filter cannot be read computes – the filter of links_from_filter, links_from_content, links_from_match, copy, calc_sum and check_linked_values, the where of a links or content_links rule – read it empty and said nothing, as did your own function reading a value computed after it (by another of your functions, a call whose filter cannot be read, a union computed after them, or a later step). Each is now one needs.derive_scope per reader and cause, naming the needs read: your own function once for all its calls computing a field, a built-in call or rule once for every need it computes the field on. A function that declares its reads is reported for every read of a value computed in its own step that it does not declare. No value changes: the reader still computes what it read. Only the reads that touched such a value are reported, so a filter whose and stops before it is not; a whole-need read such as dict(need) reads every field. A built-in function’s filter is watched only in a step with a call computed after the built-in functions, and your own functions’ calls as they run, so a project without functions of its own and without a filter that cannot be read runs as before; a project that declares nothing computes the values it did. See Reads that cannot be ordered.

    Upgrading: a project whose built-in functions or rules read what its own functions compute, or what a call whose filter cannot be read computes, may see new needs.derive_scope warnings where its values were silently wrong, and a build with -W fails on them. Declare such a function’s reads (Declaring what a function reads) to have it computed in order and its readers hold its values; for tr_link, upgrade sphinx-test-reports to its release that declares them. A reader then holds every value it selects, which can make a build slower and, for a links rule selecting many needs, report needs.derive_dense. suppress_warnings = ["needs.derive_scope"] silences the new warnings meanwhile, with every other scope finding.

  • ⚡️ A filter string in the portable filter language is evaluated without Python’s eval, five to six times faster, for the whole language; a conformance corpus defines it and pins its answers (issue #2346, PR #2350)

    A filter string that the index path does not answer is compiled once and evaluated need by need without eval when it is written in the portable filter language, which now holds x is None / x is not None; len(x), x.lower() and x.upper() as operands, on either side of a comparison, of in, of search() and alone; x.startswith('...') / x.endswith('...'), after any of those (id.lower().startswith('req')); a field against a field in every comparison (variant == current_variant); c.this_doc(); a negative number; True / False; and a var. chain alone. What eval costs is its context, a copy of every field of the need per evaluation, so the forms that used to reach it are five to six times faster now (over 14 000 needs, len(tags) > 0: 29 ms to 5 ms), and a form the fast path already took costs what it cost. Its answers are eval’s, an error included, but for the three smaller cases Filter string performance lists. A string newly in the language whose value is not a boolean – len(tags) alone, title.lower(), True and owner, a var. chain alone holding a string – selects the needs it is true for, where it was refused with Filter did not evaluate to a boolean and selected nothing; eval now reads every filter for its truth too (below). A string the language does not hold – a field in a field, a list beside ==, a subscript, a comprehension, arithmetic, another call – is evaluated by eval as before. Of the strings this repository’s documentation and tests wrote, eleven of the sixteen that reached eval no longer do. tests/fixtures/filter_conformance.toml defines the language and pins every rule’s answers, so the three tiers are held to the same results; see Filter string performance.

  • 👌 needs_debug_filters says which tier answered each filter: every record of debug_filters.jsonl holds tier, "index", "fast", "eval" or "refused" (a constant, below), and for "eval" fallback_reason, the construct that kept the string out of the portable filter language (subscript, call:any, compare:name-in-name, …), or filter-code / filter-func for a directive’s filter code (issue #2346, PR #2350)

  • 👌 A filter string selects the needs its value is true for on every tier, and a filter that is a constant is reported instead of selecting every need or none (issue #1773, issue #2355, PR #2364)

    A filter string selects the needs its value is true for, whatever the value’s type and whichever tier answers it: eval refused a value that is not a boolean (Filter did not evaluate to a boolean) where the index path and the portable filter language read its truth, so tags and [t for t in tags] answered differently. A filter that is a constant alone – a literal such as 'x', -5, 10.5 or None, a display such as [1] or {}, the trailing-comma typo status == 'open',, a generator expression, which is true whatever it would yield, an f-string with no placeholder, parenthesised or not, after any leading spaces and tabs – says nothing about a need. The views, need_count, the content lines of needpie and needbar, needextend, needs_warnings, needs_builder_filter, the filter() of needuml and copy(filter=...) refuse it before any tier runs, with one needs.filter warning, and select nothing, so :filter: 'x' no longer selects every need without a word; needimport, a predicate of needs_fields, links_from_filter and links_from_match refuse it with the warning they give a filter that fails, where the two functions linked nothing silently. Anywhere else a constant fails as a filter that cannot be evaluated fails there. True and False alone still select every need and none. A content line or cell that is a number such as 10.5 or -5 still counts zero with a needs.filter warning; one that is a string such as 'x' counted every need and now counts zero with that warning. needs_debug_filters records a constant’s tier as "refused".

  • ✨ A derived union of link types: a link type deriving union holds the links of the link types it names (issue #2279, PR #2343, PR #2353)

    derive = { kind = "union", fields = ["links", "blocks", "tests"] } on a needs_links entry (or [needs.links.<l>], a need type’s links entry, derive_by_type) gives each need the links of links, blocks and tests, in that order, each link once by its target, part and condition – parts and conditions carried as written – with back links of its own (<l>_back). Its members are link types the need has, derived ones and other unions included (computed first); a field, a <l>_back, parent_needs, a name declared nowhere, no member, one named twice, and a union naming itself or two naming each other are each one needs.derive_invalid, the union holding no links. It is computed after every needextend, so a link a needextend adds to a member is in it, closed to authors, left out of fingerprints and not computed on imported or external needs, as every derived link type. Dead links and link conditions are its members’ where its rule computed it: a union reports neither, a dead link of a member that allows dead links makes no dead link forbidden (and is drawn as allowed), and an allow_dead_links on a link type all of whose rules are unions is refused (beside a union that cannot be read, for a member or on a cycle, which is no union, it is kept; beside one cycling on some need types only, still a union on the others, it is refused, as the cycle’s finding says); on an imported need, which keeps its file’s union, it is checked as any link type. needs.derive_dense does not count its list. A member filled by one of the project’s own functions (needs_functions), or by a call whose filter cannot be read (a links_from_filter whose filter names needs), is computed before the union: those run after the built-in functions, in need-id order, and the union right after the last such member (a union of that union after that). Those computed after the union read it complete, those before it empty – such a call whose filter names the union is one needs.derive_scope, as is a copy reading it, when it runs, and the project’s own functions, a read through needs and one of current_need by a key that is not written out, as they run (above) – and a built-in function or rule of that step reading such a union cannot wait for it, and is one needs.derive_scope (a links rule on every need computing it). It is what copy = true gave, declared (see Deprecations); see A union of link types for how to read it in place of links. The derive conformance corpus pins it (union-*), as does the field-declaration corpus for a union declared on need types.

  • ✨ A link type’s target_types lists the need types its links may point to (issue #2300, PR #2319, PR #2342)

    target_types = ["req"] on a needs_links entry (or a needs_extra_links one, or [needs.links.<l>]) accepts a link to a req, or to a need of any type inheriting from req, and reports every other link, once per distinct link, at the need it is set in, as needs.link_target_type; the link is kept. A need type’s links entry may narrow it for its needs and the types inheriting from it (within the types it inherits, the subtypes of a listed type included; anything else is a needs.type_widening), and each root of a link type declared on need types alone gives its own. It is checked once every link is final, whether or not the schema validation runs, and unlike a filter or a schema rule’s const it follows inherits. Dead links are left to the dead-link warning, a part link is checked by its need’s type, the links of a need from needs_external_needs are reported as needs.external_link_target_type. While a link type copies into links (copy), links is part written, part copied, so a target_types on links is refused, one needs.config warning per declaration, and ignored until copy is replaced. The link type’s schema count (minItems, maxItems) is checked apart, by the schema validation: it counts every link, a refused or dead one included. A derived link type takes none in this release. The names that are no need type are one needs.config warning per declaration, and ignored; a target_types naming none keeps the target types of the declaration before it. The field-declaration conformance corpus pins it (link-target-types-*), with two new shared codes, link_target_type and external_link_target_type.

  • 👌 A needservice naming a service that is not registered is one needs.load_service_need warning, checked before the directive’s options: for a built-in GitHub service that is not configured it says so and gives the configuration to add (see Breaking changes), and with no service registered at all it says could not be found: no service is registered where it listed none (PR #2321)

  • ✨ add_need_layout() adds a need layout from an extension, beside needs_layouts, as add_need_type adds a need type (issue #2265, PR #2307)

  • 🏷️ sphinx-needs ships a py.typed marker (PEP 561) and the Typing :: Typed classifier, so a type checker (mypy, pyright, ty) reads its annotations instead of treating the package as untyped. A project that type-checks code calling sphinx-needs’ API may see new diagnostics where those calls disagree with the annotations (PR #2241).

  • ✨ The join role of a derive rule, reserved in 9.0.0, and its inline spelling, the dynamic function links_from_match (issue #2224, PR #2228)

    join = { field = "case_name", equals = "test_case" } on a links or copy rule makes its candidates the needs whose case_name equals one of the need’s own test_case values: both are text fields, a string split on , and stripped, or an array of strings, compared value by value. Each need that matches is a candidate once, in need-id order; the need itself only with include_self = true; needs only, never their parts. links links them (where narrows them, and links requires where or join), and copy reads them as over a link type, select included. The needs are indexed by the field once for the link fields and once for the other fields (and once more for the rules computed last), shared by every rule and call on it. [[links_from_match("case_name", "test_case")]] links the same needs from one need; the nearest spelling of sphinx-test-reports’ tr_link(test_option, target_option) is links_from_match(target_option, test_option, include_self=True) – the arguments swapped, and it differs where tr_link links once per matching value, follows the project’s order, compares the candidate whole and fails when the need’s own value is an array or number. A rule that cannot be read is reported as needs.derive_invalid, as every rule is; three refusals of an existing rule changed their words with it (links “requires the role ‘where’ or ‘join’”, and copy’s from / over / join and select texts).

  • 👌 A link type that computes more links than needs_derive_max_links_per_need (default 100) per need of the project is reported once, as the warning needs.derive_dense (issue #2202, PR #2258)

    The links a links or content_links rule computes are counted, or, on a link type without one, those its links_from_filter, links_from_content and links_from_match calls compute; written links, those a needextend adds and back links are not, and the needs of the project are every need but need parts. It counts rather than times, so every build of a project warns alike, and the warning names the links, the needs computing them, the longest list, and what to do instead (What a rule costs). It is on by default: a build with -W and such a rule fails until the warning is silenced with suppress_warnings = ["needs.derive_dense"], or the threshold is raised or set to 0 (or less), which never warns.

  • ♻️ FieldsSchema.for_type and FieldsSchema.add_type_overlay, the first slice of per-type fields (discussion #1646): a need type may declare a field anew, and need creation, needextend’s per-need allow_extend, dynamic and derived values and the field validation read a need’s fields as its type declares them; nothing changes for a project – the configuration surface follows (PR #2266)

  • ♻️ The fields schema has two tiers: the union answers a field’s shape and for_type its full declaration, the schema freezes once it is first read (the first need, or the first validation), and a per-type declaration is a narrowing (needs_schema.narrowing_problems); the second slice of per-type fields (discussion #1646) – nothing changes for a project; the configuration surface follows; an extension that changes the schema after the schema is first read now gets a TypeError, and FieldsSchema’s getters are typed as shapes (read a full declaration through for_type) (PR #2275)

  • ✨ needs_types can be a dictionary from directive name to the other items of a type, beside the list, in conf.py and as [needs.types.<directive>] tables in a needs_from_toml file; both shapes keep the order the types are given in. The value is validated when the configuration is read, and what cannot be used is a needs.config warning instead of a traceback or silence: an entry that is not a dictionary, names no directive, or lacks a string title or prefix is ignored (a missing title used to end the build with a KeyError), but for one naming a default type with neither title nor prefix, which is that type, narrowed: it takes the title, prefix, color and style it leaves out, and a needs_types none of whose entries gives a title or a prefix keeps the default types, each narrowed by its entry (an entry naming no default type declares nothing); a color or style that is not a string, and an unknown key, are ignored and the type kept – the unknown key an old project most likely still carries is content, which sphinx-needs 1.0 read and PR #610 stopped reading; a value of neither shape stops the build with an error. A directive declared twice in the list is now its last entry on every path – a need of list2need took the first entry’s prefix – and is listed once in the legends and in needreport, and, when it was the first type, a needservice datum without a type takes the type that now comes first; the duplicate is reported, where Sphinx used to warn that the directive was already registered (issue #2262, PR #2276, PR #2353)

  • ✨ A need type declares its fields: an entry of needs_types may carry fields and links, each a dictionary from a field or link type to the type’s declaration of it (description, schema, nullable, default, predicates; a link type is not nullable), and inherits, one parent whose declarations the type starts from (Fields per need type); a default type declares its own in an entry naming it with neither title nor prefix, which keeps the other default types ([needs.types.req.fields.x] alone). A declaration narrows the one before it – the field’s own, then each ancestor’s – and what cannot be used is reported and ignored as a whole, the build going on: needs.type_inherits for an inherits naming no need type or on a cycle (every type on it), needs.type_conflict for a declaration naming no field of its table or setting what the field does not take (a default of a derived field among them), and needs.type_widening, one warning per reason, for a declaration that widens. A needextend deleting a field now empties it as the need’s type declares it (None where nullable on that type, else the empty value of its type). The per-type declarations of issue #2269, after the schema’s two tiers (PR #2275) and the needs_types table (PR #2276) (discussion #1646; PR #2278, PR #2353)

  • ✨ A field may be declared on the need types that have it alone: a fields entry of needs_types naming no field needs_fields, an extension or a service declares, and no core field or link type, declares a field of the types that declare it – in their own entries or an ancestor’s, an empty entry included – absent on every other type (Fields per need type). Every type that declares it agrees on its type and items’ type, which the first need type without an ancestor declaring it that gives a schema type sets; such a declaration of another type is a needs.type_conflict warning, and does not declare the field (a child of a declaring type still declares it, through its parent). On a need of another type the field holds None, a value set for it in a need is ignored as a needs.undeclared_for_type warning naming the need, and a need imported or external drops it with the same warning (silently when it holds None anyway, as a needs.json writes it on every need); the needs.json describes it as Declared by need types ..., naming the declarations without a declaring ancestor that are not refused. A derive in a need type’s fields or links entry is the field’s (or link type’s) derive_by_type entry for the type and the types inheriting from it, read and checked with the others (a rule that cannot be read is reported for each type that reads it); beside a derive_by_type entry for the same type it is a needs.config warning, and the derive_by_type entry used for that type (the types inheriting from it still read the entry’s rule). A field declared on need types alone is derived on every type that declares it, or on none, and a links entry naming no link type declares a link type of the types that declare it, its labels, styles, copy and dead links set by its first root ([] on the needs of every other type; issue #2285). A needextend refused on the needs of a type is one needs.needextend warning for each need type, naming its needs, instead of one for each need. The fields schema is frozen once built, before any document is read: an extension that changes it from an env-before-read-docs handler now gets a TypeError. A per-type minItems on a link type or tags needs no default: the empty value of a field’s type kept from its global declaration ([], "", 0, 0.0, false) is no default for a per-type narrowing (issue #2277). The per-type fields of issue #2269 (discussion #1646; PR #2281, PR #2284, PR #2292)

  • 👌 A derived field cannot be set on a need: need[name] = value for a field with a derive rule raises KeyError, where it used to set a value the rule then overwrote (needs-before-post-processing) or kept (needs-before-sealing, a filter function, a dynamic function writing another need’s field). An extension, a filter function or a dynamic function writing a derived field now meets the refusal: from an event or a filter function the build fails, with the field named (a filter function at doctree-resolved, whatever needs_allow_unsafe_filters says); from a dynamic function the call is reported, for example Error while resolving dynamic values for field 'plain', of need 'R_001': Error while executing function 'meddle': "Cannot set derived field 'copied' in NeedItem: its value is computed by its derive rule." [needs.dynamic_function], and the field the call was computing does not get its value (PR #2289)

Breaking changes

  • ‼️ The built-in GitHub services github-issues, github-prs and github-commits are registered only when needs_services names them

    They were registered in every build, so every project carried their twelve fields (url, user, avatar, service, created_at, updated_at, closed_at, query, specific, max_amount, max_content_lines, id_prefix), null on every need of its needs.json, their three need types issue, pr and commit in every legend and needreport, and the github layout, whether or not it used GitHub. Now a built-in is registered only when needs_services names it with a mapping of options – {} will do – in conf.py or as a [needs.services.<name>] table of the needs_from_toml file. A configured service brings the twelve fields, the github layout and its own need type alone (github-issues brings issue); a project that names none has none of them. What to do:

    • A needservice naming a built-in service now needs its entry; without it the directive creates nothing and warns, for example Service 'github-issues' is a built-in service that is not configured, so it is not registered: name it in needs_services to use it, ... [needs.load_service_need]:

      needs_services = {"github-issues": {}}
      
      [needs.services.github-issues]
      
    • A hand-written .. issue::, .. pr:: or .. commit:: (or a type that inherits one, or :layout: github) needs the service configured, or the type declared in needs_types (and a github entry in needs_layouts).

    • :url:, :user: and the other ten set on needs of your own types are now Unknown option warnings and dropped, and a filter, needs_warnings check or needtable :columns: naming one finds no such field: declare them in needs_fields (or configure a service).

    • The needs.json of a project that configures no service no longer carries the twelve keys, nor their needs_schema entries, nor the three types; a consumer indexing them reads them with a default. A needs.json written by an earlier version still imports (needimport, needs_external_needs) without a warning for its empty service keys: a project with no service drops the twelve keys silently where they are null or "", and reports one holding a value as an unknown key, as before. Needs that a GitHub service made (of the issue, pr or commit type, with the github layout) need that service configured, or their type declared (and, for needimport, a github layout); without it each is refused (needs.import_need / needs.load_external_need), and a needimport’ed need of a declared type with the layout github stops the build, as any unknown layout does (needs_external_needs drops the layout). Since 9.4.0 an unknown layout is a needs.layout_unknown warning instead, and the default layout is used in its place (issue #2324).

    • A built-in named in needs_services only by an extension’s config-inited handler above priority 12 (or at 12, connected after sphinx-needs) is no longer registered: the built-in services are decided by sphinx-needs’ own handler at priority 12. Name it in conf.py, the needs_from_toml file, or a handler at priority 11 or below; a needservice naming it says so.

    • An incremental build after a built-in service is configured or removed re-reads every document, as one after a change to needs_types does, also where the project declares the service’s type itself; the first incremental build after upgrading re-reads every document once.

    • A service of your own built on GithubService, such as the GitHub Enterprise example, gets no need type and no layout from its class: configure the built-in service it imitates too (as that example does), or declare the type in needs_types. Its Service need could not be created: Unknown need type 'issue'. warning now says so, naming the built-in to configure.

    An extension reading get_need_types() finds issue, pr and commit only for the configured services, listed from sphinx-needs’ own config-inited handler at priority 12 on, so from a handler above 12 (PR #2321).

  • ‼️ app.config.needs_types and app.config.needs_layouts no longer hold the need types and layouts added by extensions or by the configured GitHub services, and the types and layouts sphinx-needs reads cannot be changed through NeedsSphinxConfig (issue #2265, PR #2307)

    The two values hold what the project configures – needs_layouts also sphinx-needs’ own layouts and the compiled needs_card_layouts, as before – so Sphinx compares the same values on both sides of an incremental build. A type added with add_need_type(), the configured GitHub services’ issue, pr and commit, and their github layout are kept in sphinx-needs’ own registry instead.

    An extension that looks a need’s type up in app.config.needs_types (or a layout in app.config.needs_layouts) no longer finds the added and the GitHub services’ ones there, and nothing warns about it. Read them through NeedsSphinxConfig, which returns every type and layout on this version and on every one from 2.0 (where the GitHub services’ types are in it once sphinx-needs’ own env-before-read-docs handler has run):

    from sphinx_needs.config import NeedsSphinxConfig
    
    need_types = {t["directive"]: t for t in NeedsSphinxConfig(app.config).types}
    layouts = NeedsSphinxConfig(app.config).layouts
    

    get_need_types() gives the directive names alone. The two NeedsSphinxConfig reads are read-only: a change through them, or assigning either attribute, raises NeedsApiConfigException, where it used to change the configuration value. Add a type with add_need_type, and a layout with the new add_need_layout(), from an extension’s config-inited handler.

    add_need_type cannot carry an inherits, fields or links: an extension whose type needs one appends the whole entry to app.config.needs_types from a config-inited handler at a priority above 12 and below 500 – after sphinx-needs has resolved the configured types to their list, and before it registers their directives. Such an entry is part of the configuration, as a project’s own is.

    The configured GitHub services’ types are read from sphinx-needs’ own config-inited handler at priority 12 on, so a handler at a priority above 12 now sees each configured one of issue, pr and commit too, after the types added by then; they used to appear only from env-before-read-docs.

Deprecations

  • ⚠️ copy = true on a link type is deprecated, and is removed in 10.0: a link type deriving the union of links and the copying link types replaces it (issue #2279, PR #2343, PR #2353)

    The links are still copied into links. Each declaration writing copy = true – a needs_links or needs_extra_links entry, a [needs.links.<l>] table, a need type’s entry of a link type need types alone declare – is one needs.deprecated warning naming it and the replacement; none for copy = false, and none where the key is already refused (beside a derive rule, in a need type’s entry of a link type declared outright). A union differs from the copies in three ways: a link a needextend adds to a member is in it, a need from needimport or needs_external_needs keeps the union its needs.json carries rather than copying, and a dead link is reported once, at the member. One case keeps copy until 10.0, with the warning (suppress_warnings = ["needs.deprecated"] silences it, and every other deprecation): a project relying on check_linked_values, calc_sum with links_only or the need_outgoing and need_incoming roles written in a need, which read only links. Where links is derived the copy copies nothing, and the warning says to remove it. The documentation’s own configuration no longer sets copy.

  • ♻️ needimport and needs_external_needs read a needs.json through the new ub-needs-exchange library, a new dependency of sphinx-needs (ub-needs-exchange>=1.1.0,<2); nothing they read or report changes, but for one addition: a top-level format_version is now read

    ub-needs-exchange is the record of the needs.json format: its reader, which 9.0.0 shipped as sphinx_needs.exchange, moved there with that one addition, beside a contract document and a conformance corpus that ubCode is to vendor, so that every tool reads the file the same way. sphinx_needs.exchange is kept through 9.x as a deprecated alias of ub_needs_exchange: importing it gives a DeprecationWarning, and it is removed in 10.0. The addition: a needs.json may carry a top-level format_version – nothing writes one yet. Absent or 1, the file is read as before; one that names a later format – an integer above 1, or a pre-release such as "2a1" – refuses that source, in one warning saying which format the file is of, and so does any other value.

Bug fixes

  • 🐛 A filter in the portable filter language that fails on a need is reported once and the need left out, as in eval, whatever the error: an error of the kind a failed filter raises, from a value’s own method, ended the build there (issue #2360, PR #2364)

  • 🐛 The filter fast path answers as eval does where it did not: a list or a tuple of literals after in compares a list field item by item (tags not in ['a'] raised there and was true in eval), and a name no field defines that is a Python builtin is the builtin (filter != 'x' was refused there as undefined, and is true in eval) (issue #2346, PR #2350)

  • 🐛 The console message of a schema finding names the need the rule selected, under which schema_violations.json files it. A finding of a network or network_back rule that failed on a linked need named that linked need: a rule selecting the tests, with T_001 > verifies > S_001 as its need path, reported Need 'S_001' has schema violations, as if the spec broke it. It now reads Need 'T_001' has schema violations; the Need path line still gives the chain, and the finding’s code, severity and schema_violations.json do not change (issue #2297, PR #2340)

  • 🐛 The needs_schema of a needs.json writes a core field as the project declares it, as it writes an extra field: a needs_fields entry narrowing status to a non-nullable field with the default "open" is written "type": "string", "default": "open", where it was written with the built-in ["string", "null"] and null, and a default given to a core field in needs_fields or needs_global_options is written as its default. The file’s content changes only for such projects, and its format does not change. Under needs_json_remove_defaults a value equal to that default is now left out, and a reader restores it from the file, as needimport does. Its other constraints, such as an enum, are still not written, as for an extra field, see issue #2316 (issue #2263, PR #2318)

  • 🐛 A field’s default or predicates set both in its needs_fields entry and in the deprecated needs_global_options is taken from needs_fields, and the needs_global_options value is reported as ignored, in one needs.config warning per field naming both values. The legacy value replaced the needs_fields one silently, so every need that did not set the field held it. A field needs_fields declares without the key still takes the needs_global_options value, a core field narrowed in needs_fields follows the same rule, and a need type’s own declaration still wins over both (issue #2264, PR #2318)

  • 🐛 A link type’s default or predicates set both in its needs_links (or deprecated needs_extra_links) entry and in the deprecated needs_global_options is taken from that entry, and the needs_global_options value is reported as ignored, in one needs.config warning per link type naming both values, as for a field. The legacy value replaced the entry’s silently, so every need that did not set the link type linked to the legacy targets. A link type declared without the key still takes the needs_global_options value, and a need type’s own declaration still wins over both (issue #2317, PR #2328)

  • 🐛 An incremental build after a change to needs_types re-reads every document, as one after a change to needs_fields does. The option only rebuilt the HTML, so the needs of the documents that were not re-read kept what the previous entries gave them: a derive rule added to or removed from a type entry, a field or link type it declares, its default, an inherits, or the type’s title and prefix. A field whose rule was removed held None where a fresh build held its authored value. The complete list of need types is compared with the one the documents were read with, so a change to a type added with add_need_type(), which the option does not hold, re-reads every document too. An unchanged list re-reads nothing more, and the first incremental build after upgrading re-reads every document once (issue #2287)

  • 🐛 A layout’s {{field}} placeholder (Layouts) no longer stops the build with TypeError: replace() argument 2 must be str when the need’s value is unset or not a string. A value is written as its text, a list as its values joined with ", " (as meta shows them), and when the field is unset or empty – as on every need of a type that does not declare a field declared on need types alone – the layout function’s element is left out, as image("field:...") leaves out its image, rather than built from an empty value (_images/.png) (issue #2303)

  • 🐛 A needtable’s sort no longer stops the build when some needs leave the field unset, as every need of a type that does not declare a field declared on need types alone does: None beside a number or a string raised TypeError. An unset value now comes first, whatever the field’s type, as an empty string already did; values of different types are ordered booleans, numbers, then text, so they never meet in a comparison, and needs with equal values are ordered by id (they kept the needs’ own order, which could differ between a fresh and an incremental build). A sort key that is not a field of the needs is a needs.filter warning, the rows left in the filter’s order, rather than a KeyError. The sort_by option of the filter directives crashed the same way beside a number (it compared an unset value, and 0, as "") and now orders by the same rule, comparing text as it is. A table sorted by a list field may change order: a list is now compared as its values joined with ", " (by :sort: without regard to case), where it was compared value by value, with regard to case (issue #2253)

  • 🐛 A needextend no longer stops the HTML build with NotImplementedError: ... departing unknown node type: Needextend in a project with no needs, or with needs_include_needs set to False: its node is now removed on those paths too. In a project with no needs it matches nothing and says so, as it does in one with needs (issue #2296)

  • 🐛 An incremental build no longer reports The configuration has changed (… options: 'needs_layouts', 'needs_types') – one of the two, or both – on every build after the first (Sphinx 8.1 and later print the line; Sphinx 7.4 and 8.0 compare only the options that rebuild the environment, so they did not report it). The GitHub services’ need types (issue, pr, commit) and their github layout were appended to needs_types and needs_layouts when the services were registered, after Sphinx had compared the configuration with the one pickled by the previous build. They, and every need type added with add_need_type(), are now kept in sphinx-needs’ own registry and read beside the configured ones, in the same order as before: the configured types, then the added ones, then the configured GitHub services’ ones, which give way to a type or layout of their name, configured or added at any time (see Breaking changes for what this changes for an extension). A change to a layout added with add_need_layout is not a configuration change: as for any change to an extension’s code, build with -E to see it; a change to a type added with add_need_type re-reads every document, as one to needs_types does. After upgrading, the line is still reported until a build re-reads a document, as the environment Sphinx loads was pickled with the old values: edit any page, or build once with -E (issue #2265, PR #2307)

  • 🐛 Configuring your own issue or pr need type – or adding one with add_need_type from another extension – no longer stops the configured GitHub services from adding their other need types: a configured issue dropped pr and commit, and a configured pr dropped commit. Each of the three now gives way on its own (PR #2307)

  • 🐛 A built-in GitHub service named in needs_services with a value that is not a mapping of options – -D needs_services.github-issues=1 sets the string '1' – no longer ends the build with AttributeError: 'str' object has no attribute 'get': it is a needs.config warning, and the service is not registered (PR #2321)

  • 🐛 Under needs_json_remove_defaults, a value equal to its field’s default but of another JSON type (1.0 against a default of 1, [1.0] against [1]) is now written, so a reader gets it back as written. The writer compared with Python’s ==, so a number field authored 1 (held as 1.0) with an integer default of 1 was left out and read back as 1. Nothing else is written that was left out before (PR #2306)

  • 🐛 A fields entry of a need type named as a link type’s back links (links_back, parent_needs_back, or rel_back beside a rel link type) is refused, one needs.type_conflict warning, as a links entry of that name already was, and a links entry of that name now says so too (“which is a link type’s back links”). It used to declare a field the computed back links replaced on every need, its authored value lost and its schema checked against the back links of every need, those of the types that do not declare it included; beside a needs_extra_links link type the build stopped instead (issue #2301, PR #2305)

  • 🐛 One rule for a link type whose back links, <name>_back, have the name of a field or of another link type, applied when the schema is built (issue #2293, PR #2305)

    Between global declarations, a name declared outright wins: the link type is refused, one needs.config warning naming both and where the field comes from, and does not exist (no directive option, no back links, no needs.json entry), while the field or link type of that name keeps its values in needs.json, in filters and in the validation alike. A link type that is itself refused claims no name: of the link types x, x_back and x_back_back, x_back is refused and x kept, its back links named x_back. A feature that names a refused link type (a needgantt’s :starts_with_links:, a network rule of the schema) stops the build, as it does for a link type that was never declared. Through needs_links, an extension’s add_field, a service’s field, or a second link type, the back links used to overwrite the field silently (or the link type x_back hid the back links of x); through needs_extra_links, the build stopped with “Same name for automatically created link and field”. links and parent_needs, which every project has, never yield: a field or link type named links_back or parent_needs_back is ignored instead, one needs.config warning.

  • 🐛 The needs.config finding for a needs_global_options value with unknown keys lists them sorted, so its text is the same on every run. The keys came from a set, whose order follows the hash seed, so the message changed from run to run and could not be pinned by a test; it now reads as the import and external-need unknown-key findings do (issue #2288)

  • 🐛 With needs_debug_measurement on, a measured callable that has no __name__ or whose source cannot be read is measured rather than failing. A functools.partial named by :filter-func: ended the build with AttributeError, one registered with add_dynamic_function failed its call with a warning and lost the field’s value, and a function whose file is gone raised OSError. A partial is now recorded as partial(<name>), a callable instance by its type’s name, with no file or line where inspect cannot give one. debug.START_TIME and EXECUTE_TIME_MEASUREMENTS are annotated, so ty now checks the measuring wrapper, and two # ty: ignore comments go (issue #1835)

  • 🐛 need, need_outgoing and need_incoming – and so a need’s links and backlinks rows – and needtable’s id and link columns no longer end the build on a need that has no document and is not external (one added through the API with docname=None); they show its text without a link (issue #2244)

  • 🐛 A need with no document and no external url – one added through the API with docname=None – no longer ends the build with an UnboundLocalError when a needflow or needuml draws it; it is drawn without a link. A need the builder can make no URL for is drawn without one too, where the PlantUML source used to carry an empty [[]] that PlantUML refuses as a syntax error, and needuml’s ref() then gives its label as plain text

  • 🐛 Listing sphinx_test_reports before sphinx_needs in extensions no longer warns that the directives testfile, testsuite and testcase are already registered: a need type registers its directive once, whether add_need_type or sphinx-needs’ own configuration step comes first. A directive of another kind under a need type’s name is handled as before, with Sphinx’s warning (issue #2271, PR #2276)

  • 🐛 A filter id == None selects nothing wherever it is used. On a view already narrowed – a needtable or needlist with :status:, :tags: or :types:, or a filter such as type == "spec" and id == None – it selected every need of the view, as its fast path matched None against the empty part id each need carries; an id is a string, so a constant of any other type now matches no need and no part, as the same filter evaluated in Python does (issue #1835)

  • 🐛 A filter status in [...] whose list holds None selects the needs without a status too, as status == None already did and as the same filter evaluated in Python does: its fast path kept only the strings of the list, so status in ["open", None] selected the open needs alone and status in [None] none at all (issue #1835)

Documentation

  • 📚 The need_count example counting the needs whose title is longer than ten characters is written in the portable filter language, and counts them (issue #2359, PR #2364)

    It wrote a raw string, search(r"[\w\s]{10,}", title), which the portable language has not, and the role removed its backslashes, so the pattern it ran was [ws]{10,} and the example counted no need. It now writes each backslash twice for the role and twice for the string literal, and the note under it says so: in a role a backslash of a pattern is written four times, or avoided with a character class.

  • 📚 A need type’s own entry is documented as the place for most rules about its needs, beside schema rules for the rest (PR #2295)

    The schema validation page gains Per-type configuration or schema rules?: what a type’s fields, links and inherits can declare, what still takes a schema rule, and how each is reported – a constraint keyword by the schema validation, the need kept; a field required on the type when the need is created, the need not created. The new how-to Modeling need types walks through fields, status values, tags, links and defaults per type, moving needs_global_options predicates into a type’s entry, and filters over a field some types lack. Both examples are projects in the test suite, which checks the warnings the pages quote.

    needs_links lists its schema key, the Tutorial points to needs_fields schemas instead of the deprecated needs_statuses and needs_tags, and the schema page’s link counts are corrected: maxItems is a maximum, and a schema rule reports a need with no links only through required, as a local minItems alone does not

  • 📚 This documentation’s own configuration declares its need types as [needs.types.<directive>] tables, and its hours, amount, value and unit fields on the need types that use them, a live example of Fields per need type that its build checks (PR #2302)

  • 📚 The need-type pages are split into a walkthrough and a reference, with Mermaid diagrams (PR #2309)

    Modeling need types gains a “How it works” section before its recipes: the mental model, and two diagrams on its example project – where the fields of each type’s needs come from (a field narrowed by a type and inherited by the type inheriting from it, and fields one type declares alone), and how far a field or link type declared on need types alone reaches: the type declaring it and the types inheriting from it. Fields per need type stays the reference, every rule kept, and points to the walkthrough instead of repeating its worked example. Processing order gains a diagram of the whole path of a need’s values, from what it sets, its defaults and copied links when it is created, through needextend, the link fields, the back links and every other field, to the checks and the schema validation. The Tutorial gains a short step on a need type that inherits another. The documentation’s docs extra gains sphinxcontrib-mermaid

  • 📚 Derived fields have a page of their own, Derived fields, under Delayed field evaluation (PR #2344)

    The “Derived fields” section of needs_fields moves there, reordered for a reader, every label with its text, and the kinds, the roles, what a derived field holds, how a rule is computed and detecting a changed need gain labels of their own; the built-in calls each kind spells (Rules and inline calls) move with it. The docstrings of links_from_content, links_from_filter and links_from_match name their declared forms and say that a link type they fill may be a member of a union, which the derive conformance corpus now pins for an inline links_from_content (union-over-links-from-content; from the review of PR #2343). Said once now, and linked from the other places: need-id order, the nearest declared form of tr_link, the default values of a field and a link type (Default values), and how to register a function (Registration, whose add_dynamic_function example now runs as written). The derived-fields page tells the three meanings of copy apart, and the [variants] note says that ubCode reads the table from 0.37.0

Internal changes

  • 🏷️ ty’s possibly-unresolved-reference, disjoint-cast and missing-type-argument rules are on: the bug above is what the first found, and the rest of its findings are rewritten so the checker can follow them

  • 🏷️ list2need parses each list item into a typed record (a TypedDict), and _get_title takes its content as lines (Iterable[str]), as both callers pass it; fifteen # ty: ignore comments go (issue #1835)

  • 🏷️ The needs, needumls and schema builders’ do-nothing overrides of get_target_uri, prepare_writing and write_doc_serialized take Sphinx’s own parameter names (and prepare_writing an abstract Set, as Sphinx 8.1 and later declare it), and the needumls files written beside another builder’s output join their directory onto the builder’s outdir as a path rather than a string; ten # ty: ignore comments go (issue #1835)

  • 🏷️ The needextract, needtable, needbar, needpie, needlist, needsequence and needgantt nodes declare their attributes’ TypedDict (as the needflow nodes already did), and each node handler narrows the node it is handed, so the checker follows a directive’s options from the directive to its handler. needextract’s layout and style are str | None, as an absent option leaves them; build_need_repr takes any element. Fourteen # ty: ignore comments go (issue #1835)

  • 🏷️ The filter and needbar attributes declare what the directives store: an absent option is None (filter and sort_by of every filtering directive, needbar’s axis titles, label rotations, text_color, and its xlabels, ylabels and colors, split once into lists), and a directive’s content is a StringList (filter_code, needbar’s content). filter_needs_and_parts returns items of the kind it is given, a filter code’s namespace is typed as the user’s, NeedsView.filter_statuses and its parts twin take any iterable of statuses, None among them, and the id, type, status and is_external fast paths of a filter pass only a constant their index can hold, with the same results but the id == None fix above. Nineteen # ty: ignore comments go (issue #1835)

  • 🏷️ A FieldSchema constructed with predicate defaults no longer raises TypeError: its value check read isinstance(v, A) | B. No build reached it, as predicates are attached after construction. That fix, and two in filter_common.py and views.py, remove three # ty: ignore comments (issue #1835)

  • 🏷️ NeedsList declares the needs.json it holds as a TypedDict, the envelope and each version (every key of a version optional, as a needs_file of an older shape can leave any of them out), rather than letting the checker infer it from the first literal; the written file is unchanged. Eleven # ty: ignore comments go (issue #1835)

  • 🏷️ A needextend append that joins a computed value with another value of the same field or link type reads the computed value as the FieldFunctionArray or LinksFunctionArray it is, and FieldFunctionArray declares one tuple whose items are computed parts, text or numbers, rather than one tuple per item type, which no join could be proved to keep. The values a build gives are unchanged. Eight # ty: ignore comments go, seven in needextend.py and one in needs_schema.py (issue #1835)

  • 🏷️ Every function in the shipped code is annotated, and ruff’s ANN rules keep it so across the workspace; sphinx_needs.setup now declares its types, and the internal profile decorator preserves the signature of what it wraps

  • 🧪 A conformance corpus for fields per need type, tests/fixtures/field_declaration_conformance.toml: 38 cases, one project each, the rules of the section as cases, with the values their needs hold and the findings they give; this repository is its repository of record and ubCode is to vendor it. Its runner and the derived-field corpus’s share their corpus-independent half, sphinx_needs_testkit.conformance (issue #2269, PR #2291)

  • 🔧 ENV_DATA_VERSION is 13: the first build after upgrading re-reads every document, so a join rule that 9.0.0 refused, and a links_from_match it did not know, are shown on the pages whose sources did not change too (PR #2228), and every stored need carries the names of its derived fields (PR #2289)

9.0.0

Released:

14.10.2026

Full Changelog:

8.5.0…sphinx-needs-v9.0.0

This release is about computed values. A field or link type can be derived by a rule in its configuration, per need type with derive_by_type (PR #2178, PR #2191, PR #2204, PR #2205), and every dynamic function, variant and rule is computed in dependency order (PR #2134). It is a major release because computed values, needextend filters (PR #2127) and the needs.json readers (PR #2189) can change need data in certain corner cases – a value that reads another computed value, a needextend filter that relied on an earlier needextend’s change, an external source’s lowercase id_prefix, or a record whose id differs from its key – and their new warnings can turn a -W build red until the cause is fixed or suppressed; Python 3.11 is the minimum (PR #1844), and [[…]] in need content and the need_func role are gone (PR #1919). Also new: [variants] in ubproject.toml (PR #1996), choose / when / otherwise (PR #2020), :extend_priority: (PR #2083) and content parsed in its declared markup (PR #2135).

Improvements

  • ✨ New choose, when and otherwise directives include one of several branches of content, chosen by variant data (PR #2020)

    A choose runs its when tests in order, and the first when whose condition is true is included; an otherwise, the optional default, comes last; when no test holds and there is no otherwise, nothing is rendered. The other branches are never parsed, so the needs inside them are never created:

    .. choose::
    
       .. when:: var.arch == "arm"
    
          ARM content.
    
       .. when:: var.arch == "x86"
    
          x86 content.
    
       .. otherwise::
    
          Content for every other architecture.
    

    Conditions are exactly those of the if directive, evaluated by the same code, and the conditions after the branch that is taken are not evaluated. A choose may contain only when and otherwise directives and comments, and nothing outside a branch is ever parsed. Every mistake warns once under the new needs.choose type and skips the whole choose: content outside a branch (refused before the body is parsed, so nothing in it runs), a branch inside another directive or supplied through an include, a branch written with one colon, no branch at all, a when without a condition, an otherwise with one, a misplaced or second otherwise, an argument on choose, variant data that is not configured, and a condition that cannot be evaluated — so a mistake that makes a condition unevaluable, such as a misspelt key or a syntax error, never renders a later branch or the otherwise in its place. Works in reStructuredText and in MyST Markdown. The undocumented warning if gives for a condition whose result is not a bool is now listed in its documentation.

  • ✨ Dynamic functions and variants are computed in dependency order, and a value that cannot be computed is reported (changed output) (issue #2064, PR #2080, PR #2081, PR #2134, PR #2136, PR #2143)

    A [[…]], <<…>> or <{…}> is now computed after every value it reads, so a chain of copy calls, a calc_sum over computed summands, a check_linked_values over computed values and a variant condition naming a computed field give the chained value in every build, whatever the document names, the documents an incremental build re-read, -j, the order of the options in a directive, or the order the fields are declared in. The link fields are computed first, then the back links are built, then every other field, so [[copy("links_back")]] reads the need’s back links, in need-id order, and a calc_sum with links_only reads the links a [[…]] computes. Your own functions run after the built-in ones of the same step. Link conditions are checked once every value is computed, against the complete back links. The new Processing order section documents the whole order, from the needextend directives to the constraints.

    A value that reads itself, directly or through other computed values, is not computed and is reported as needs.derive_cycle (Cycles): a link or array field keeps the items written in it, any other field is left empty; this includes :hours: [[calc_sum("hours")]], whose sum includes its own need, and a variant whose condition reads the field it sets. A read that cannot be ordered is reported as needs.derive_scope (Reads that cannot be ordered): a link field’s [[…]] or <<…>> reading a computed field that is not a link field, a back link or a dead-link flag (a check_linked_values or links_only sum whose need computes its links too reads the field on every need, as the needs those links name are known only once the links are computed), and a need.<field> argument that selects what its call reads while the field is computed in the same step, neither of which is run (the field keeps what a cycle member keeps); a needextend filter naming a computed field; and a built-in function reading a field your own function computes. ubCode’s phase 1 computes the same values and reports the same findings, but for three kinds of difference. Registered in ubCode’s divergence register: a boolean result in an integer field, an unparsable variant condition, and the dead-link flags has_dead_links and has_forbidden_dead_links, which are not in ubCode’s vocabulary (a condition naming one is reported there). Removed on ubCode’s side by its own phase 1: a copy of an empty back link list ([] here), and an authored array field that is not computed (on a cycle, or whose result the field cannot hold), which keeps its written items here. Not evaluated by ubCode’s phase 1: the filter arguments of the built-in functions, which it evaluates from its phase-2 release, but for a filter naming needs, or reading current_need by a key that is not written out, which ubCode reports instead. The notice warning needs.derive_unresolved of the unreleased PR #2080, which reported such reads, is gone, and a suppress_warnings entry naming it is a no-op.

    A need.<field> argument is accepted in field and link values, a needextend’s included (argument); a need that used one in its own field was not created, and a needextend value that used one was dropped with a needs.needextend warning. One that selects what its call reads fails the call when its field is unset or empty. A None result, such as a copy of an unset field or a failed check_linked_values, adds nothing to a field: alone in a nullable string or array field it leaves the field unset, where it was stored as the text "None", or as [None], which schema validation then refused.

  • ✨ A field or link type can be derived by a rule declared in its configuration (issue #2030, PR #2178, PR #2191, PR #2204, PR #2205)

    A derive table on its needs_fields or needs_links entry, in conf.py or the TOML file (or passed to add_field()), names a kind and the kind’s roles, and the rule computes the value for every need from the project’s sources; a derive_by_type table gives a rule per need type instead, overriding derive for the types it lists, and a need of a type without a rule holds the field’s default (else None, or the empty value of its type), the field closed on every type (Rules per need type). The kinds are copy (a lookup: the need’s own field, a named need’s, or over a link type), sum, count, min, max, any, all and collect (roll-ups over a link type or its back links, narrowed by a where filter), max / min closed over a link type (transitive), hash (computed after every other field) and fingerprint on a field; links (every need passing a filter) and content_links (the needs a need’s content references) on a link type. A rule is computed with the [[…]] of its step, in dependency order, and its findings are those of a call (needs.derive_cycle, needs.derive_scope, needs.dynamic_function), with needs.derive_unique for a copy with select = "unique" that finds several values. The built-in functions are their per-need spellings (Rules and inline calls). A derived field is closed to authors: a value written for it in a need, or set by a needextend, is ignored and reported as needs.derive_authored, and it takes no default. A rule is checked when the configuration is read: one that cannot be read is one needs.derive_invalid warning, naming the kind and the role, and the field holds its empty value; a default or predicates beside a rule is reported the same way, and ignored, as is a link type’s copy = true into a derived links, or on a derived link type. The empty value a derived field holds is not checked against the field’s schema, as None is not; a computed value the schema refuses is reported as needs.dynamic_function, and the field holds its empty value. The schema in needs.json marks a derived field or link type "readOnly": true, and a need created by needimport keeps the derived values it carries. A rule on a core field, or on the parent_needs link type, is not available in this release, and is reported. A fingerprint digests the whole need – its id, type, title, status, tags, content and every field and link type the project declares that is not derived, links among them, each where it differs from its default, a link’s condition dropped – so that a link condition naming it (:links: REQ_1[fp == "…"]) reports needs.link_condition_failed once REQ_1 changes; its one role, exclude, leaves names out (Derived fields). No later release changes which names a fingerprint includes, when a name enters, or how the text is written: a fingerprint written down stays current until the need, or the configuration of the fields it reads, changes. ubCode reads the same configuration, and computes the same values and findings, from its phase-2 release.

  • ✨ New dynamic function links_from_filter, which links to every need that passes a filter string (PR #1984, PR #2191)

    :links: [[links_from_filter("type == 'req' and status == 'open'")]] links a need to every open requirement, in need-id order. The need that contains the call, and its own parts, are left out unless include_self=True; parts are tested only with include_parts=True. No match is no link, and no warning; an empty filter is an error. A need the filter cannot be evaluated on, such as hours > 1 on a need without hours, is not linked, without a warning, as for the links kind. It is the per-need spelling of the links kind of a derived link type.

  • ✨ needextend gains :extend_priority: (default 500, lower applied first) (issue #1658, issue #2064, PR #2083)

    The needextend directives are applied sorted by extend_priority, then by document name and line, so a project that never sets the option keeps its order, and where two set the same option the higher priority is applied last and wins. The priority is set on each needextend; there is no project-wide setting for it.

  • ✨ generate_need_id() returns the id add_need() assigns to a need that is given none (issue #2084, PR #2111)

    An extension that creates needs can now find out, before it calls add_need, whether that id is already taken – a second definition of the same generated id – without importing the private _make_hashed_id. add_need derives the id with the same code, so the two cannot drift: it takes the same arguments, content as a str or a StringList, and an unknown need type raises the same invalid_type exception.

  • ✨ add_need() takes a MarkupContent as content, and the new ingest_need_record() creates a need from a needs.json-style record (issue #1885, PR #2135)

    A need’s content can be parsed as reStructuredText or MyST Markdown whatever the page’s parser, with its warnings at the source file and line it came from (Content written in another markup); this is what the multi-line needs in source comments of sphinx-codelinks (issue #1885, to follow) build on. needimport now creates each of its needs through ingest_need_record. Nothing changes for existing callers. The content is not yet restricted: file-reading directives, raw, relative image paths and nested need directives in it are not refused.

  • ✨ needimport can parse each imported need’s content in the markup its doctype names: needs_import_parse_by_doctype, and the directive’s :parse_by_doctype: option (issue #1898, PR #2153)

    Markdown exported from a MyST page then renders as Markdown in a reStructuredText page, and reStructuredText as reStructuredText in a MyST page, where both were parsed in the importing page’s markup, and still are by default: the option is off in 9.x, and turning it on by default is a question for a later major, after feedback. A doctype the project cannot parse falls back to the page’s markup with one needs.import_doctype warning per directive per doctype; a need rendered through a template is parsed in the page’s markup.

  • ✨ An interactive needtable is Sphinx-Needs’ own script, needstable.js, instead of the vendored DataTables, and loads only on the pages that hold one (PR #1920)

    A table with the default :style: datatables still sorts, searches, pages, and switches columns off, in place: every row and cell Sphinx-Needs rendered stays the same element, so :style_row: classes and the links inside cells survive sorting and searching. Two new options set its paging: needs_table_page_size (default 10) and needs_table_page_sizes (default [10, 25, 50, 0], where 0 means all rows); a table can override the first with its own page_size. Removed: the Excel and PDF export buttons and the column reordering of 8.5.0’s DataTables; a table exports through Copy and CSV only (a CSV file opens in a spreadsheet, and a browser prints). The script and its own stylesheet are added only to the pages with an interactive table, so search.html, genindex.html and every page without one load neither; the small common needstable.css that styles every needtable is still on every page, as in 8.5.0.

  • ✨ The variant data can be declared in the [variants] table of the needs_from_toml file, which other tools reading the same file share (PR #1996, PR #1998)

    [variants] data and data_file (or [<prefix>.variants] under needs_from_toml_table) are read through ub-project, the shared reader of ubproject.toml, which becomes a dependency (ub-project>=1.1.0,<2). The legacy [needs] variant_data and variant_data_file keys keep working; when both locations are set, [variants] wins, whole (Variant data: the [variants] table). Two new warning types, each of which fails a -W build until it is fixed or suppressed: needs.variant_data_location, once per ignored [needs] key when both locations are set, and needs.variants_unknown_key, for any other key in [variants]. A mistake in the variant data, whether declared in the TOML file or set in conf.py, is now reported in ub-project’s words.

  • 👌 The common CSS files are registered in a sorted, deterministic order, so the HTML and the CSS cascade no longer vary between otherwise identical builds (issue #1913, PR #1914)

  • ⬆️ jsonschema-rs is allowed up to 0.58 (>=0.37.1,<0.59; 8.5.0 capped it below 0.53) (changed output) (PR #1851, PR #1980)

    An invalid regex pattern in a schema now names its location in the error (On instance["properties"]["id"]["pattern"]:) rather than On instance:.

Breaking changes

  • ‼️ Python 3.10 is no longer supported: the minimum is 3.11 (PR #1844)

    requires-python is now >=3.11; 8.5.0 accepted 3.10.

  • ⬆️ docutils 0.21 or newer is now required (PR #1977)

    8.5.0 declared none, so it accepted whatever Sphinx did, which is 0.20 for Sphinx 7.4 through 9.0. Sphinx-Needs imports docutils directly, and 0.21 is the oldest series it is type-checked and tested against. The requirement has no upper bound: Sphinx caps docutils per series itself.

  • ‼️ [[…]] in a need’s content is plain text, and the need_func role is removed (PR #1919)

    Both were deprecated in 4.0.0, with the ndf role as their replacement. A [[…]] in a need’s content is no longer executed: it renders as written, as in any other Sphinx document. A document that still writes :need_func: gets docutils’ own Unknown interpreted text role "need_func" error. Write :ndf:`copy("id")` instead (see Dynamic functions). [[…]] in a need’s options – :status:, :tags:, :links:, extra fields, the needs_global_options defaults – is unchanged.

  • ‼️ Computed values are computed in dependency order (changed output) (issue #2064, PR #2134)

    Where a [[…]], <<…>> or <{…}> read a value another one computes, its result depended on the order the needs were read in, and was often the unresolved None (stored as the text "None" in a string field), an empty value, or a summand silently dropped. It is now the chained value, in every build, so a project that relied on the old value gets another one: a chain gives its last value; a sum includes its computed summands; a variant condition sees the computed fields of its need, whatever their declaration order; [[copy("links_back")]] reads the back links instead of []; your own functions run after the built-in ones, so they see computed values; and a need that used a need.<field> argument is created. A cycle and a read that cannot be ordered are new warnings, so a -W build with one fails: a cycle (needs.derive_cycle), including a calc_sum over every need written into the summed field itself and a variant whose condition reads the field it sets, is not computed; a link field’s call reading a later value (needs.derive_scope) is not run; such a field, and a field whose call fails or returns a result the field cannot hold (needs.dynamic_function, as before), keeps the items written in it if it is a link or array field, and loses the computed ones, and any other such field is left empty. A needextend filter naming a computed field (needs.derive_scope), which never matched the computed value anyway, reads the value from before it is computed. The warnings of the pass come in the order the values are computed (the link fields first; each value after those it reads, otherwise by need id and field), not in document order. To keep such a build green while you fix them, add "needs.derive_cycle" and "needs.derive_scope" to suppress_warnings.

  • ‼️ needextend filters are evaluated against the needs as written (changed output) (issue #1658, issue #2064, PR #2083, PR #2127)

    Every needextend filter is evaluated against the needs as written, before any needextend is applied (Filters see the needs as written); it used to see the changes of the needextend directives applied before it. So no needextend changes which needs another one’s filter matches, whatever their priorities and the names of their files.

    A project whose filter relies on a change made by an earlier needextend (a filter on status == "closed" after the needextend that closes the needs it means) now modifies the needs written with that value instead, and no warning says so. To keep what such a filter modified, name those needs by ID, or write the condition on the values as written.

    A filter is evaluated once in each document it is written in, so a needs.filter warning it gives there is reported once, at the first needextend applied that carries it. The notice warning needs.needextend_match_order of the unreleased PR #2083 is gone, and a suppress_warnings entry naming it is a no-op.

  • ‼️ needimport and needs_external_needs read a needs.json alike (changed output) (issue #2003, issue #1414, PR #2189)

    The two readers now read the file, and create each need, through one path, so a project that read a needs.json one way through one of them can notice:

    • an external source’s id_prefix is added as written: it is no longer upper-cased, so the ids of a lowercase prefix change (ext_ gives ext_REQ_1, not EXT_REQ_1), and every reference to them has to follow;

    • needs_id_regex is no longer applied to imported needs (it never was to external ones): the regex is for the ids this project authors, not for the ids it reads – an imported or external need’s id is the data of the project that wrote it, and an id_prefix may not match any pattern of this project;

    • a record without a title is refused by needimport (needs.import_need), as it already was for external needs; a content that is not a string is refused for external needs (needs.load_external_need), as it already was on import;

    • a need’s id is the key of its record in the version’s needs object, not the record’s id field. A record whose id field differs from its key is imported under the key and reported (needs.needimport / needs.external_needs); the id field used to win, silently. A record whose key is empty is refused by both readers, where the key used to be ignored and the record imported under its id field (an external source whose id field was empty too created a need with an empty id, or with the bare, upper-cased id_prefix);

    • when two external sources define the same id, the first source listed keeps it and the second is refused with a needs.load_external_need warning (the first among the records that were added: a first source whose record is refused leaves the id to the next). This used to depend on the sources’ base_url: with different values the second was already refused (the first won), but with the same base_url the second source silently deleted and replaced the first (the last won);

    • a need of this project with the id of an external need replaces the external need, with a needs.create_need warning, where it used to be refused and not rendered;

    • a needs.json that cannot be obtained or read – missing, a failed download, not valid JSON, without the version asked for, or without versions or needs – is one warning and adds no need, where the build used to abort (or, for an external source with missing or empty versions, stayed silent; a missing needimport file was already a warning);

    • with an id_prefix, a link field or an id written in the content that names a need of the file gets the prefix even when :ids: or :filter: leaves that need out of the import. It used to be prefixed only when the target was imported, so such a reference could resolve to a need of the importing project, or to the same id imported unprefixed by another needimport. It is now rewritten to the prefixed id, which exists only if that need is imported with the same prefix; otherwise a link field or a :need: role naming it is a dead link, reported as needs.link_outgoing or needs.link_ref (a plain-text id is rewritten and nothing resolves it) – not as a reader warning, so suppress_warnings has to name those. A reference to an id the file does not contain is still left unprefixed and may resolve in the importing project: the file’s ids are its namespace, and the prefix is the only way to say so;

    • an external source’s target_url template sees the need with the file’s schema defaults merged, its id the key, and a legacy description as content.

    The new warnings ( needs.needimport and the new needs.external_needs ) fail a -W build that used to abort or stay silent; to keep such a build green while you fix the file, add "needs.needimport" or "needs.external_needs" to suppress_warnings. A reference the prefix rewrites to a need that is not imported is reported as needs.link_outgoing (a link field) or needs.link_ref (a :need: role in the content), not as a reader warning, so suppressing the two reader codes does not keep such a build green: suppress_warnings has to name those two as well.

Internal changes

  • 🔧 The repository is a uv workspace, and Sphinx-Needs lives in packages/sphinx-needs (PR #1839, PR #1846)

    The published package is unchanged; two things that name the repository change. An install from git of a commit after the move needs the subdirectory – pip install "sphinx-needs @ git+https://github.com/useblocks/sphinx-needs@<ref>#subdirectory=packages/sphinx-needs" – because the repository root is not a package. And release tags are sphinx-needs-v<version>, the shape every package in the repository shares; the bare <version> tag is still pushed beside it, so git+…@<version> pins and the documentation’s stable version keep working.

  • 🔧 The sdist no longer ships tests/ or performance/ (PR #1905)

    The suite loads its fixtures from a workspace member that is never published, so a shipped suite could not run; docs/ is still included. Run the suite from a repository snapshot.

Bug fixes

  • 🐛 needimport and needs_external_needs read needs.json through one reader and one record path (issue #2003, issue #1414, issue #2158, issue #2165, issue #1472, PR #2189)

    Both readers take the file’s envelope, the version and the need records from one reader, and create each need through one record path, which keeps the ten fields each reader reads differently (how an imported need is rendered; where an external need was) as the one stated difference. A file no need can be read from is one warning, at the directive for needimport and as needs.external_needs for an external source, and the build goes on. The key of each record is its id, so a record with a missing or non-string id is read under its key instead of crashing the build, and an id that differs from the key is warned about. A record whose parts is not a mapping is refused with a warning instead of crashing the build. A file written without its defaults and without the schema to restore them is warned about. A record whose key is empty is refused. With an id_prefix, a link or a reference in the content to a need of the file is prefixed also when :ids: or :filter: leaves that need out, a link given as a string is prefixed too (unless it holds a dynamic function or a variant, which is left as written), a null link no longer crashes the build, and an id inside a longer word of the content is no longer rewritten. An :ids: naming an id the file does not have is warned about, and a :filter: that fails is warned about once per directive rather than once per need. An external need left from a previous build is replaced on an incremental build (or removed, when the source now refuses its record), a need of this project that holds an external need’s id is reported with a needs.create_need warning on every build, and a duplicate across this build’s sources is warned about. A download that fails, also with an HTTP error status, is reported with its reason; needimport reads a file:// URL as a URL, and a local file it misses is read on the next incremental build once it exists. An external source’s target_url template sees the need with its schema defaults merged, its id the key, and a legacy description as content.

  • 🐛 check_linked_values and calc_sum with links_only read the need of a link to a need part, and skip a link to no need (changed output) (issue #2173, PR #2177, PR #2194)

    A link may name a need part (:links: REQ_1.a), and both functions looked such a link up by its whole text, which names no need: the call failed with a needs.dynamic_function warning and the field was left empty. A part link now reads its need’s fields, as the back links already count it on that need, so two parts of one need read that need twice, as a need linked twice is read. A link whose text has a dot is read as <need>.<part>, as every other reader of a link reads it, so one naming a part the need does not have reads the need, and one whose text before the dot names no need is a link to no need. A link to no need is now skipped, as the derived-field kinds skip it; it failed the call, a second report of the dead link, which is reported as before, and the field was left empty. ubCode reads a part link the same way, and skips a link to no need as it does from its phase-2 release.

  • 🐛 A needs_fields entry named after a link type (links, parent_needs, or one of needs_links or needs_extra_links) is reported and ignored, instead of stopping the build (“Field ‘tests’ already exists”, or “Same name for link and field”) (PR #2194)

    It is a needs.config warning; a parent_needs entry carrying a derive rule is reported as a rule on a core field, needs.derive_invalid. The link type works as before.

  • 🐛 An integer a dynamic function or a variant gives is a float in a number field (changed output) (PR #2194)

    :hours: [[copy("points")]], points being an integer field, stored 3 in the number field hours, where an authored 3 is 3.0: needs.json wrote 3, and a hash rule over the field read [3]; so did <{ var.n }> with n an integer in the variant data. A value computed into a field takes the field’s type, as a derived field’s does and as ubCode stores it: a float in a number field (and in an array of numbers), an integer in an integer field. A float returned into an integer field is still reported, and a boolean is not a number.

  • 🐛 copy with upper=True or lower=True changes the case of each item of a list (changed output) (PR #1984, PR #2194)

    The whole list used to be converted to its printed form first, so :tags: [[copy("tags", "SRC_1", upper=True)]] on a need tagged alpha, beta gave one tag, ['ALPHA', 'BETA'], brackets and quotes included. It now gives the two tags ALPHA and BETA. A value that is not a list is unaffected.

  • 🐛 c.this_doc() works in the filter of copy (changed output) (PR #1984, PR #2194)

    The filter was evaluated without the document of the need, so c.this_doc() ended in a this_doc can not be used in this context warning, nothing passed the filter, and copy read the current need instead.

  • 🐛 ndf shows a link a dynamic function returns as its need id (changed output) (PR #1984, PR #2194)

    A function returning links, such as links_from_content, was shown as NeedLink(id='REQ_1', part=None, condition=None); it is now REQ_1, or REQ_1.p1 for a part.

  • 🐛 The filter of calc_sum can name needs (changed output) (issue #1452, PR #1453, PR #2194)

    The filter was evaluated without the list of all needs, although a Filter string documents it, so a filter such as any(id in s["links"] for s in needs if s["type"] == "story") ended in a name 'needs' is not defined warning for every need, and the value was summed as if there were no filter. Such a filter is evaluated after the other built-in functions; a flag declared on each need, and a filter naming it, is the portable and faster spelling (Derived fields).

  • 🐛 Link ids that sort alike are listed in one order in every build (changed output) (PR #2193)

    needs.json and the HTML list a need’s links and back links in natural order (REQ_2 < REQ_9 < REQ_10, letters case-folded), and ids that order alike in it, such as R_02, R_2 and r_2, came in the order of the build’s set of links, which could change from one build to the next. They now follow the id itself, compared character by character: R_02, R_2, r_2, and links to one target under several conditions follow the link with its condition (R_2, then R_2[status == 'closed'], then R_2[status == 'open']). A hash rule writes ids with one natural key in the same order, and a target under several conditions once, as it drops the conditions. ubCode sorts them the same way from its phase-2 release.

  • 🐛 A change to needs_fields or needs_links (and the deprecated needs_extra_options, needs_extra_links and needs_global_options) re-reads every document (PR #2192)

    The needs of the documents an incremental build did not re-read kept what they were created with: a default or predicates added to a field (or to needs_global_options) was not applied to them, and a field made derived kept its authored value there. A changed field or link configuration now re-reads every document.

  • 🐛 needextend’s :+field: on a nullable field the need never set sets the field, instead of crashing the build (issue #2038, PR #2102)

    A field of needs_fields is nullable unless it says otherwise, so a need that does not set it holds no value. Appending a value to such an unset array field ended the build with Value after * must be an iterable, not NoneType, and appending a dynamic function to an unset array or string field ended it with Cannot append non-string/array value; appending a value to an unset string field already set it. Appending to an unset field now sets it to the appended value in every case, as :+tags: does on a need without tags. The two events an extension can connect to around the needextend directives, needs-before-post-processing and needs-before-sealing, are now documented in the Python API.

  • 🐛 An if condition whose result has no truth value is reported, instead of ending the build (changed output) (issue #2025, PR #2029)

    Taking the truth value of a result runs the result’s own __bool__, which may raise, as it may for a value of needs_variant_data of a user-defined type. That ended the build with a traceback, after the warning for a result that is not a bool. It is now the one directive expression failed warning of the if or when, and the condition cannot be evaluated: the body is skipped, and a when skips its whole choose, as for any other condition that fails. A result whose truth value can be taken but whose repr raises, which ended the build too, is now reported with a placeholder in the warning for a result that is not a bool, and its truth value is used.

  • 🐛 An if warning in an included file names that file by its absolute path (changed output) (issue #2027, PR #2029)

    It named the file as docutils records it, relative to the working directory (docs/inc.txt for a build run from the project’s parent directory), where a when in the same file names it absolutely, as Sphinx names the file of a node’s location.

  • 🐛 calc_sum and copy(filter=) read needs in need-id order (changed output) (issue #2064, PR #2078)

    A whole-project calc_sum adds the needs’ values in ascending need-id order, and copy with a filter copies from the match with the lowest id, comparing ids as strings (REQ_10 comes before REQ_9). Both used to read the needs in the order they reached the build environment, so the last digits of a sum of non-integer values, and which need copy(filter=…) copied from, depended on which documents the last build re-read and on -j; they no longer do, and for a sum of literal values over every need, the total is the one ubCode computes. A calc_sum with links_only keeps adding in the order the links are written. The error for a calc_sum outside a need now names calc_sum.

  • 🐛 A functions key under [needs] in the TOML file is ignored with a warning instead of crashing the build (changed output) (issue #2064, PR #2079)

    needs_functions holds Python callables, which a needs_from_toml file cannot hold, and the key ended the build with 'str' object has no attribute '__name__', whether it was an array, a string or a table. It is now one needs.config warning and the key is ignored, whatever its value: an empty functions = [] is reported as well, and no longer clears the needs_functions of conf.py. The same crash came from conf.py for a needs_functions entry that is not callable, which is now skipped with a needs.config warning instead.

  • 🐛 A needs_functions value that is not a list, and an entry without a __name__, are reported with a warning instead of crashing the build (changed output) (issue #2073, PR #2112)

    needs_functions = None, or a bare function where a list of functions belongs, ended the build with TypeError: ... is not iterable, and an entry without a __name__, such as a functools.partial or an instance with __call__, ended it with an AttributeError, because a dynamic function is registered, and called, by its name. A value that is not a list or tuple is now one needs.config warning naming its type, and nothing is registered from it; a string, which was read one character at a time with a warning for each, is reported the same way. A set of functions, or another iterable of functions that is neither a list nor a tuple (a frozenset, a generator), used to register them beside Sphinx’s own type warning, and is now ignored with the same needs.config warning. An entry without a __name__ is skipped with a needs.config warning, and the rest of the list is still registered. Such a callable is registered with add_dynamic_function() and its name argument, which now raises NeedsApiConfigException asking for that name when it is not given, instead of an AttributeError.

  • 🐛 Under -j N, a need id defined in two documents renders its card once, on the document that kept the need (changed output) (issue #2087, PR #2106)

    Serially, the second definition is refused with a needs.create_need warning. In a parallel build, two documents read by different processes each created the need; the merge kept one and warned needs.duplicate_id about the other, but the other document’s page still rendered a card: the kept need’s title and fields over the dropped directive’s content. A needextract of the id could copy the dropped directive’s content as well. A need’s card is now rendered only on the document the need is recorded on, in every builder, and needextract copies the kept need’s content.

  • 🐛 On Sphinx 7.4 with show_warning_types = True the [needs.*] type of a warning is shown once, not twice (issue #2091, PR #2108)

    Before Sphinx 8, Sphinx-Needs appends the type to its warnings itself, as Sphinx 8 does by default; it also did so when show_warning_types had Sphinx 7.4 append it, so the line ended in [needs.link_outgoing] [needs.link_outgoing]. It is now appended only where Sphinx does not append it.

  • 🐛 A service whose class cannot be registered is skipped with a warning instead of crashing the build (changed output) (issue #2067, PR #2113)

    A needs_services entry with both class and class_init is registered from them, and a class that is not callable or has no options ended the build with 'str' object has no attribute 'options' – which every class set in a needs_from_toml file did, since that file can only give it a string. A class_init that is not a mapping ended it the same way. Such a service is now one needs.config warning, naming the key and what is wrong with its value, and is not registered; the build goes on. A service whose class is callable with options and whose class_init is a mapping registers as before, whether or not the class derives from BaseService, and a table that holds a service’s options only is read as before, without a warning.

  • 🐛 A needservice naming a service that is not registered is a warning instead of a traceback (changed output) (issue #2101, PR #2113)

    It ended the build with a raw NeedsServiceException traceback, which, deriving from BaseException, escaped Sphinx’s own error handler, so no log file was written either. It is now one needs.load_service_need warning located at the directive, with the same text, which names the service and the registered ones; the directive adds nothing and the build goes on. This is also the path of a service skipped for its configuration, above. NeedsServiceException now derives from Exception.

  • 🐛 A needextend option whose dynamic or variant function cannot be parsed is a warning instead of crashing the build (changed output) (issue #2109, PR #2116)

    A value such as :status: [[copy(need.id)]] ended the build with an uncaught FunctionParsingException, because a need.<attr> argument is not admitted where the directive parses its options; any other dynamic function that cannot be parsed, and a variant function that cannot be parsed (VariantParsingException), ended it the same way. Each is now one needs.needextend warning at the directive, naming the option and the parse error, and that option is skipped while the directive’s other options still apply, as for a value that cannot be converted. Whether a need.<attr> argument should be admitted in a needextend value is a separate question, unchanged here.

  • 🐛 needimport imports a need without tags under :tags:, and reports a need whose content is not a string instead of crashing the build (changed output) (issue #2132, issue #2147, PR #2163)

    A :tags: option ended the build with KeyError: 'tags' on a needs.json record that has no tags key, as a hand-written file or another producer may omit it, and with a TypeError on one whose tags is null, a string or another value that is not a list. The option’s tags are now added to the record’s own for a missing, null, list or string tags: a missing or null tags gets the option’s tags, a list is extended, and a string, an empty one included, is extended with the option’s tags and converted as add_need converts a string tags without the option (with :allow_type_coercion: false the record’s string is refused as it is without the option); any other value is refused by add_need as a tags value that is invalid. A record whose content – or, when that is empty, the legacy description – is not a string, such as 5 or null, ended the build with an AttributeError, whether or not its content was parsed by its doctype; one whose type is a list or an object ended it with a TypeError. Each is now the needs.import_need warning naming the need and the key (content must be a string, not int), and the need is skipped; a record whose type is another value that is not a string, such as 5 or null, is reported with the same text instead of Unknown need type 5.. A record with no content key, or an empty one, still imports with empty content.

  • 🐛 needgantt rounds a completion given as a float to a whole percentage (PR #1870)

    PlantUML’s gantt grammar takes an integer percentage, and PlantUML 1.2026.8 rejects a statement such as is 90.0% completed, losing the whole chart; a completion field typed number is how such a float arrives.

8.5.0

Released:

03.09.2026

Full Changelog:

v8.4.0…v8.5.0

This release is about charts, and about the tooling behind the project. needpie and needbar gain a scope — the same :filter:, :status:, :tags: and :types: options a view directive takes — and accept the cypher option a chart authored for ubCode carries, so one document builds in both tools. Schema validation errors now name the keyword that failed and report a $ref at its definition, which changes their text. The bug fixes continue the previous release’s theme: a needuml, needarch or needextract input that used to end the build with a traceback, and a malformed needs_warnings filter, are now located warnings — and, for a project that builds with -W, can turn a green build red until the reported mistake is fixed or suppressed. Under the hood the development toolchain moves to a committed uv.lock, poe tasks and ty; none of that touches the published package.

Improvements

  • ✨ needpie and needbar now accept the :filter:, :status:, :tags: and :types: options, as the scope a chart is counted over (PR #1831)

    The four options were rejected on both chart directives with an unknown option error. They now select the needs and parts a chart counts over, once for the whole chart: every content line or grid cell is counted as its own result restricted to that scope, a static value such as 10 is left alone, and a chart that carries none of the four counts over the whole project exactly as it did before.

    A scope holds what the same four options select on a view directive such as needlist, so a chart and a list written with the same options select the same needs. On needpie a :filter-func: is handed the needs of the scope, as the same view an unscoped chart hands it, so a scope restricts what such a function counts from, not what it returns. The view gains one public method for that, NeedsAndPartsListView.filter_id_complete, which selects exactly the given needs and parts by id_complete.

    Neither directive gains an empty state it did not have: a pie of only filter lines whose scope selects nothing shows its :filter_warning: text, exactly as it does for filters that match nothing, while a bar chart, which has no such text, draws all zeros.

    This is also the Sphinx-Needs half of a chart authored for ubCode: the cypher query ubCode reads as a chart’s scope is ignored by a Sphinx build, so writing the same scope with these options beside the query makes both tools count over the same needs. See common filters and common filters.

  • 👌 Schema validation errors now name the failing keyword, and report $ref targets at their definition (changed output) (PR #1819)

    The jsonschema-rs requirement moves from ~=0.37.1 to >=0.37.1,<0.53.0, which brings a rewritten error renderer with it. Which schemas validate, which needs are reported, and the warning subtypes (sn_schema_violation.*) are all unchanged — only the message text is different.

    The failing keyword is now named, and the instance path is given relative to the sub-schema that failed rather than from the root:

    - Failed validating in schema
    + Failed validating "pattern" in schema["properties"]["efforts"]
    - On instance["properties"]["efforts"]:
    + On instance:
    

    A $ref is reported where it is defined, instead of through the reference:

    - Failed validating "const" in schema["properties"]["contains"]["$ref"]["properties"]["type"]
    + Failed validating "const" in schema["$defs"]["LinkItemSchemaType"]["properties"]["type"]
    

    And the names listed by Unevaluated properties are not allowed (...) are no longer sorted alphabetically. The set of names reported is unchanged, and the order is stable.

    If you match on this text — in a test, a log filter, or a suppress_warnings entry keyed to a message body rather than to a subtype — it will need updating.

  • ✨ The cypher directive option is now accepted on needpie and needbar for ubCode compatibility (PR #1818)

    The two chart directives join needlist, needtable and needflow in accepting this option and then ignoring it, so that a document authored for ubCode also builds with Sphinx-Needs, instead of failing with an unknown option error. The option never reaches a node, the rendered output, or the needs.json file.

    On needpie the no-op is visible in the chart, though, which it is not on the three view directives: ubCode reads the query as the scope each content line is counted over, whereas Sphinx-Needs ignores it, so the same chart can show different numbers in the two tools.

    On needbar the option is accepted so that a document already carrying it builds in both. See ubCode compatibility for the exact per-directive list.

Internal changes

  • 🔧 mypy is replaced by ty for type checking (PR #1830)

    The typing dependency group is the pinned floor environment — the oldest supported Sphinx and Docutils series, the stubs, and ty itself — installed into .venvs/typing, and uv run poe typecheck checks against it, as do the prek hook and CI. Nothing about the published package changes: the group is development-only metadata, like the rest of [dependency-groups].

  • 🔧 The development extras test, test-parallel and benchmark become dependency groups, tox is replaced by poe, and CI installs every job from uv.lock (PR #1823)

    The three extras installed only the tools this project is developed with, so this does not affect users of the package; pip install sphinx-needs[test] (or [test-parallel], or [benchmark]) no longer resolves, because dependency groups are not published metadata. A contributor gets them with uv sync, and every task — the test suite against each supported Sphinx series, the type checker, the documentation builds — is listed by uv run poe, as Contributing describes.

    The plotting, docs and the other theme-* extras are unchanged. theme-furo now requires furo 2025.12.19 or newer, the first release of that theme that supports Sphinx 9. Every earlier release caps Sphinx below 9.0, so a documentation build with the furo theme could not use the Sphinx this package already supports.

Bug fixes

  • 🐛 A needs_warnings filter that is neither a string nor a callable is now reported, instead of ending the build (changed output) (PR #1830)

    The guard for such a value called the warning logger without its subtype and location arguments, so it raised TypeError at the end of the build rather than logging anything. The entry is now reported as a needs.config warning and skipped, and the remaining warning checks still run.

  • 🐛 Eight needuml and needarch inputs that were ignored, or that ended the build, are now reported (changed output) (PR #1800)

    Three of them ended the whole build with a Python traceback and a “report this to the developers” banner, none of them naming the document it came from:

    • An :extra: value containing a second colon — a URL, a time, a namespaced identifier — raised ValueError: too many values to unpack. A pair is now split on its first colon only, with both halves stripped, so such values are usable; a segment carrying no colon at all is reported and skipped, and an empty one (from a trailing comma) is skipped in silence, as an empty :config: segment always has been.

    • uml(id, key=...) naming an arch key the need does not carry raised a bare KeyError, because the guard subscripted arch before testing for the key. The message the code already held, naming both the key and the need, is now the one raised.

    • import() given an option holding a plain string consumed it one character at a time, looking each character up as a need id and reporting the first character as an unknown id. Such a value is now refused by name, and a list of ids is imported as it always was. Note the one shape this ends: under a needs_id_regex permitting single-character ids, a string of concatenated ids used to import them one by one, and now errors. An option that is defined but unset still imports nothing, silently.

    The whitespace strip is the one change to what a working document renders. It only affects an :extra: written with spaces around a pair, which the documented example never had: :extra: a:1, b:2 stored the key " b", unreachable from a template, so {{ b }} rendered empty and now renders 2; and :extra: name: X stored " X" and rendered a leading space, which it no longer does. Both are what the author wrote the pair to mean.

    The rest were silent, and are unchanged in what they render:

    • Without sphinxcontrib.plantuml installed, every diagram in the project was replaced by an error node on the page and nothing at all was logged.

    • A :config: name that needs_flow_configs does not define was dropped. The names it does define are still applied.

    • A non-numeric :scale: fell back to 100, which it still does.

    • ref() given both option and text, or neither, was accepted without a word: its own validation read (option and text) and (not option and not text) and so could never hold. What is rendered is unchanged — option still wins over text, and a call with neither still renders a link with no label.

    • import() ignored an option name the need does not carry.

    The two template-function warnings above are emitted once per distinct message for the whole build, so the same call on the same need in a second document is not reported again.

    If you build with -W, the general rule applies here as it does elsewhere in this release series: a mistake that used to be silent — or to crash — is now a warning, and a warning fails a -W build. A project can start failing where it passed even though nothing about it changed, most easily by not having sphinxcontrib.plantuml installed, which now reports one warning per needuml. Silence them with suppress_warnings = ["needs.needuml"]; the :scale: one keeps the existing needs.diagram_scale subtype shared with the other diagrams, so covering both takes suppress_warnings = ["needs.needuml", "needs.diagram_scale"]. A third subtype, needs.uml, already existed and is unchanged: it covers only the needs_uml_process_max_time warning.

    Finally, the needumls builder no longer truncates the .puml files an earlier run saved. The generated content is filled in while a document is written, after the environment has been pickled, so a build that re-read nothing held an empty value for every needuml and wrote it over the good file — reproducible with two consecutive sphinx-build -b needumls runs, the second leaving zero bytes behind. A needuml with no generated content is now skipped instead, which also means a build over an already up-to-date .doctrees writes nothing rather than emptying everything; use a fresh output folder or -E to regenerate. A needuml is still not re-rendered when a need it references changes in another document; that needs dependency tracking and is not addressed here.

  • 🐛 Six needextract inputs that ended the build are now reported instead (changed output) (PR #1795)

    Each of these ended the whole build with a Python traceback and a “please report this to the developers” banner, three of them from the directive’s own option surface:

    • an argument that looks like a need ID but names no need,

    • an argument and :filter: together — the combination the documentation warns about,

    • needs_include_needs = False with any needextract in the project, which gave no diagnostic at all,

    • a needtable in the content of an extracted need,

    • a needextract in the content of an extracted need,

    • a footnote reference in the content of an extracted need.

    The first three were one defect: the name holding a needextract’s filter result was assigned inside the loop over a document’s nodes and read once after it, so any node taking an early exit left it unbound. All three are now reported (or, under needs_include_needs = False, silently dropped, exactly as every other view directive drops itself) and the rest of the build stands.

    The other three come from when a need’s content is copied. It is snapshotted while the need’s directive runs, before any of its document’s transforms, and spliced into the extract’s document after all of that document’s transforms — so it sees neither document’s pipeline, and a handful of transforms are replayed over it by hand. One of those replays, env.resolve_references(), ends by emitting doctree-resolved, with the detached container holding the copy standing in for a document: every listener of the event ran a second time on a node that is not a document, this extension’s own listeners included. Sphinx’s post-transforms are now applied directly instead, so the event is emitted once per document and always with a document — a guarantee a third-party listener gets too.

    What a copy cannot render is now dropped from it and named, rather than reaching a processor or the writer that cannot cope:

    • needbar, needextract, needpie, needtable and needuml — and so needarch, which is needuml restricted to a need’s content — in the content of an extracted need are omitted from the copy, each reported at the needextract site.

    • A footnote reference in it is rendered as the marker its author wrote, without the trailing _, and reported. The footnote’s own text stays where it is, so nothing disappears from the page.

    Everything else a copy carries is unchanged, byte for byte: rich markup, code blocks, images, substitutions, nested needs, figures under numfig, and needs extracted in their own document or defined later in the build. In particular the reference contract is untouched — a :ref: or :need: inside extracted content still resolves to the page the need is written on, and so does the extract card’s own ID chip.

8.4.0

Released:

27.08.2026

Full Changelog:

v8.3.1…v8.4.0

This release is about the view directives, and about a build that no longer stops at the first bad value. needflow gains a portable vocabulary — a :direction: that means the same thing on both engines, named legend configurations, and a :show_link_names: that says what each connection is labelled with — alongside a long list of fixes to both of its emitters. needs_card_layouts describes a need’s card as a small dictionary instead of a hand-written layout string, list2need builds its needs directly and so works in Markdown documents and records the line each need was written on, and every view can cap what it shows with max_items. Running through the rest is one theme: configuration mistakes and render failures that used to end the build with a traceback are now located warnings, which leaves the rest of the build in place — and, for a project that builds with -W, can turn a green build red until the reported mistake is fixed or suppressed.

Improvements

  • ✨ list2need works in Markdown documents, and records the line each need was written on (issue #1349, PR #1790)

    The directive used to render every item into a need directive through a template and hand the result back to the parser. That step is gone: the items are built directly, and a nested item is placed inside its parent. The syntax and its parsing are untouched — the same list structure, the same (ID) capture, the same :delimiter: split, the same ((option="value")) region, the same validation — so a list that built before builds the same needs, with the same IDs, apart from the one class of item named under Breaking changes below.

    What the step cost, and is therefore fixed:

    • A list written as a {list2need} fence in a MyST Markdown document produced no needs at all, only an error naming a myst-parser internal. It now creates its needs, like any other directive.

    • Handing generated text back to the parser advanced its line counter for the rest of the file, so every need from the directive onwards — the items themselves, and any ordinary need directive written below them — was recorded at a line further down the file than it was written, by an amount that grew with each list in the document. Every lineno in needs.json is now the line the need was written on, inside an eval-rst block in a Markdown document too.

    • An item written () with options, such as * ()A title ((status="open")), lost them: they became body text. They are now set.

    Four inputs that used to be errors are now defined, none of which a document that built cleanly can contain:

    • ((id="MY-ID")) names the need. The template wrote both the derived ID and this one as two :id: lines of the same generated need, which docutils refused with duplicate option "id", so the item was dropped. The ID is applied before :links-down: is built, so the links of the other items agree with it. An empty ((id="")) is refused with a diagnostic instead.

    • An inline option naming the same link field as :links-down: — ((links="X")) under :links-down: links — used to produce one corrupt link value and an unknown outgoing link warning. The two sets of links are now merged.

    • An item carrying ((title_from_content="true")) reads it as a need directive does.

    • A child of a ((hide="true")) item is rendered at the level above it, rather than being placed inside a need that is taken out of the document.

    The content of a parent need no longer holds the generated reStructuredText of its children — nesting is a property of the document, not of the parent’s text — so needs.json, and a filter reading content, see the item’s own text only.

  • 👌 needs_variant_data is resolved while the configuration is being initialised (issue #1783, PR #1787)

    The needs_variant_data_file is loaded, and the inline needs_variant_data merged on top of it, during config-inited instead of when document reading starts. What is merged, and which value wins — inline over file, sphinx-build -D over needs_from_toml — is unchanged, as are the errors reported for a file that is missing or does not contain valid variant data. Only the point in the build at which the work happens has moved. The full-rebuild fix this also brings is described under Bug fixes below.

    A file that cannot be used now fails the build during configuration, before any document is read, rather than once reading has begun.

    An extension that handles config-inited after Sphinx-Needs can now read the merged map, which matters because configuration deciding which documents exist at all — such as exclude_patterns — can only be changed while that event is running.

    In return, an extension that writes needs_variant_data from its own config-inited handler no longer has the file merged into what it wrote, and no longer has it validated: resolution has already happened by then, so the value is taken as it stands. It is used consistently — the variant role and var.* filter expressions always read the same map — but if you write the configuration this way and rely on the merge or the validation, set needs_variant_data in conf.py, in needs_from_toml, or with sphinx-build -D instead.

  • ✨ New needflow :direction: option and needs_flow_direction configuration (PR #1782)

    A diagram says which way it flows as an intent — down (the default), up, right or left — and each engine spells that in its own language, so the same document renders the same way on either engine. The tokens TB, TD, BT, LR and RL are accepted as aliases, so a habit picked up from Graphviz or Mermaid does not have to be unlearned.

    .. needflow::
       :direction: right
    

    PlantUML has no bottom-up or right-to-left layout, so up is drawn down and left is drawn right, with one needs.needflow warning per project; Graphviz draws all four. A diagram is never refused for asking: a plainer diagram is better than a failed build.

    An explicit :direction: also wins over a layout that the :config: it is written beside happens to set, on both engines, and the disagreement is reported. A diagram that does not use the option keeps byte-identical diagram source.

  • ✨ needflow :show_legend: takes the name of a legend configuration (PR #1782)

    Written bare it draws exactly the legend it always drew, so no existing diagram changes — including the long-standing difference that plantuml lists every configured need type while graphviz lists only the ones it drew. Written with a value it names an entry of the new needs_flow_legends:

    needs_flow_legends = {
        "beside": {"parts": ["types", "links"], "placement": "external"},
    }
    

    A legend with placement = "external" is rendered as a document table beside the diagram, so it looks the same on both engines, its text is selectable and searchable, and it can describe link types — which no in-diagram legend ever could. It lists only what the diagram actually drew. parts is an ordered list, and the order is contract: ["links", "types"] puts the link table first and keeps it there.

    The new needs_flow_show_legend says which legend a diagram gets when it asks for one without naming it — never whether: asking stays with the directive. Resolution is a chain — the option’s name, then the project default, then the engine’s own legend — and a name that is not defined warns and hands on to the next step, so a typo in one diagram does not cost the project the legend it configured.

    A needs_flow_legends entry that cannot be used is reported as a needs.config warning and skipped, rather than failing the build.

  • ✨ New needs_card_layouts configuration, for describing layouts declaratively (PR #1765)

    A card specification states what a need should show — header, meta, footer, side and collapse — as a small dictionary, instead of as hand-written layout strings. Specifications are compiled into needs_layouts entries during configuration, so a card works wherever a layout name is accepted, and can inherit from another card or from a built-in layout via extends:

    needs_card_layouts = {
        "product": {
            "extends": "clean",
            "meta": {"include": ["status", "tags"]},
            "footer": ["id", "type"],
            "collapse": "closed",
        }
    }
    

    needs_layouts is unchanged and remains supported for layouts the card vocabulary cannot express. A specification that cannot be compiled, or whose name is already taken by an existing layout, is reported as a new needs.card_layout warning and skipped, leaving the rest of the build untouched. See Card layouts for the full vocabulary and its documented limits.

  • ✨ needs_card_layouts elements gain an object form (PR #1766)

    Every element string is now shorthand for an object with a type key — "image:diagram" is spelled {"type": "image", "field": "diagram"} — and the two spellings mix freely in one list. An object without options compiles to exactly the same layout as its string shorthand; the strings stay valid and remain the documented default. The object form exists to carry options: height and width on image elements, and label on field elements, replacing the field name in the rendered name: value pair:

    needs_card_layouts = {
        "illustrated": {
            "footer": [
                "id",
                {"type": "field", "field": "owner", "label": "Owned by"},
            ],
            "side": {
                "elements": [{"type": "image", "field": "picture", "height": "40px"}]
            },
        }
    }
    

    Option values are grammar-bound; an option on the wrong type, an unknown key, or a value outside its grammar is reported as a needs.card_layout warning and the card is skipped, like any other invalid specification. See the object form for the option table and grammars.

  • ✨ The cypher, width and height directive options are now accepted for ubCode compatibility (PR #1760)

    needlist, needtable, needflow and needsequence accept these ubCode-only options and then ignore them, so that a document authored for ubCode also builds with Sphinx-Needs, instead of failing with an unknown option error. Nothing about the build changes: the options never reach a node, the rendered output, or the needs.json file. See ubCode compatibility for the exact per-directive list.

  • ✨ The max_items option on needlist, needtable, needflow and needsequence now limits how many items a view shows (PR #1761)

    The limit is applied after filtering and sorting, so a view keeps the first items it would otherwise have rendered; on needsequence it counts messages rather than needs. :max_items: 0 means no limit, and a view without the option falls back to the new needs_views_max_items configuration, which defaults to 0 — so nothing is limited until you ask for it, and existing projects render exactly as before. A view that was truncated says so, instead of silently dropping needs: it adds a notice to the page and emits a needs.max_items warning, which a project that caps deliberately can silence with suppress_warnings = ["needs.max_items"].

    Previously the option was accepted and ignored for ubCode compatibility, which was only ever in an unreleased state, so no released behaviour changes. The stored environment version is bumped for the new directive option, so the first build after upgrading re-reads every document.

  • 👌 needs_string_links is validated when it is loaded, and no longer fails the build (PR #1767)

    A configuration entry used to be looked at only while a need was being rendered, and then indexed into blindly. A missing key, a regular expression that does not compile, a template that does not parse, or an entry that is not a dictionary each aborted the whole build with an uncaught exception naming neither the entry nor a file — and did so even when no need used the field the entry names.

    Every entry is now validated once, during configuration. A problem is reported as a new needs.string_link warning naming the entry, and only that entry is skipped, so a configuration that used to fail the build now builds and renders everything else. The same warning also covers the cases that previously passed in silence — an unknown key inside an entry, an options entry naming a field that is registered nowhere, an empty options — none of which skips the entry.

    If you build with -W, take this as the general rule: a configuration mistake that used to be silent — or to crash — is now a warning, and a warning fails a -W build. So a project whose needs_string_links contains anything questionable can start failing where it passed, even though nothing about it changed. The same goes for the list-field fix below, which reaches render-time failures that the meta area used to swallow. Silence the configuration warnings with suppress_warnings = ["needs.string_link"]; render-time failures keep the existing needs.layout subtype, so covering both takes suppress_warnings = ["needs.string_link", "needs.layout"].

    Two spellings of options are now skipped with a warning, and both used to render links, so if your links have disappeared this is the paragraph to read. A bare string was accepted before, but with two contradictory meanings: the ,/; splitting silently did not happen, while the per-field test degraded into a substring match, so options = "myfield" also applied to a field named my. A mapping ({"myfield": True}) worked by accident, through iteration over its keys. Write either as a list. A list, tuple, set or frozenset of names is accepted, as is an already-compiled re.Pattern for regex (a bytes pattern is not, as it could never match a field value).

  • 👌 needflow :debug: shows the generated diagram source as a code block under the plantuml engine too (changed output)

    The plantuml engine emitted raw HTML, an unnumbered and unstyled <pre> block, where the graphviz engine emitted a literal block, so the same option gave the source line numbers and the theme’s code styling on one engine only. Both now emit a literal block. The plantuml source is shown unhighlighted, because Pygments has no PlantUML lexer.

    This is a deliberate change to the rendered page rather than a fix: a project that styles or scrapes the debug block sees the new markup.

Deprecations

  • 🔧 The undocumented needtable :style_col: option is deprecated — it was declared but never read, so it has never had any effect. A document that sets it still builds and now gets a deprecated warning; the line can simply be deleted.

Breaking changes

  • ‼️ A list2need item written () gets the same generated ID as one written without brackets (PR #1790)

    Writing an empty bracketed group used to suppress the ID of the generated need, which sent it down the need directives’ own ID generator — a different one, which reads needs_id_from_title where list2need’s does not, and hashes the content when the title is empty. One list could therefore carry two kinds of generated ID at once, chosen by two characters of punctuation. The directive now derives every ID itself.

    Under the default configuration the two generators agreed for an item whose title carries no options, so almost every project sees no change. A project that sets needs_id_from_title, writes () on an item with no title, or writes () on an item that also carries an ((option="value")) area, gets a different ID for those items, and any :need: reference to the old ID has to be updated. Give such an item an explicit ID — * (MY-ID)A title — if its ID has to stay as it was.

    The third case is the widest of the three, because it needs no configuration: the ID list2need derives is the hash of the title before the option area is removed from it, which is the ID an item without the () has always been given, while the second generator hashed the title after it. So * ()A title ((status="open")) moves from R_328F3 to R_0FF10 — the ID * A title ((status="open")) already had.

  • ‼️ needflow :show_link_names: takes an optional value, and now wins over needs_flow_show_links (PR #1782)

    The option chooses what each connection is labelled with: none, outgoing, incoming or type. Written bare it still means outgoing, which is what the flag has always drawn, so no existing document changes; the other three values are new.

    needs_flow_show_links takes the same four values, and True/False keep meaning outgoing/none. Any other non-string value is read for its truth, because that is what a value declared a boolean for years actually did — 1 still draws labels.

    A string that is not one of the four values now warns and falls back to none, where it used to be truthy and draw labels. That is the one input whose behaviour changes. If you build with -W, note that the warning fails the build; silence it with suppress_warnings = ["needs.config"] or, better, write one of the four values.

    The option now overrides the configuration instead of being combined with it. A project that turned labels on previously left no way of drawing a single unlabelled diagram; :show_link_names: none is that way.

    Enumerated needs_flow_* configuration values — needs_flow_show_links, needs_flow_direction and needs_flow_engine — are now matched without regard to case or surrounding whitespace, exactly as the matching directive options always have been. A project whose value only differed in capitalisation stops warning and starts being honoured.

Internal changes

These changes do not affect user-facing behaviour:

  • ♻️ needflow’s two engines now share one graph-model pass, with no change to the generated diagram source

Bug fixes

  • 🐛 An invalid predicates expression warns instead of ending the build (PR #1791)

    A predicates match expression on a needs_fields or needs_links default that cannot be evaluated — one naming section_name or content, say, neither of which a predicate has access to — used to raise out of the need’s creation and end the whole build with a traceback and a “please report this to the developers” banner. No need was created, no other warning in the project was ever reported, and nothing said which document the expression had failed on.

    Such an expression is now reported as a needs.config warning, located at a need it was evaluated against and naming the field, the expression and the underlying error, and is then skipped: the remaining predicates are still evaluated, and if none of them matches then the plain default applies, exactly as it does for a predicate that simply did not match. A statically malformed predicates value — the wrong number of items in a pair, say — has always been reported this way; only the expression itself was left to end the build.

    The warning is deduplicated on its full message, so a single configuration mistake – such as the name typo above, which fails identically for every need – is reported once rather than once per need. An expression that fails only for some needs, or for different reasons on different needs, is reported once per distinct error.

  • 🐛 A need records the line it is actually written on (changed output) (issue #1349, PR #1789)

    rst_prolog, .. include:: and list2need each put text into the document being parsed, and each one used to shift the lineno recorded for every need after it by the length of that text. The shifts compound, so in a document with a prolog and a couple of includes the recorded line was routinely past the end of the file. The line is now resolved back to the one the directive stands on — the same line the directive’s own warnings have always reported.

    No warning location regresses. The only warning locations that move are the ones this corrects — sites that report at a need’s stored line now name the true one. Everything anchored through the directive’s own location helper, including the content a pre_template or post_template renders, is byte-identical to before.

    One thing is deliberately unchanged: lineno_content is still the parser’s own counter, because that is what it is used as. (The needs list2need generates recorded their position inside the generated block when this entry was written; PR #1790 builds them directly, so they now record the line of their own list item.)

  • 🐛 Fix needs_variant_data_file triggering full rebuilds (issue #1783, PR #1787)

    The merged variant data was written back onto the configuration after Sphinx’s config-inited checkpoint, so the pickled configuration held the merged map while the next build compared it against the unmerged one — a difference Sphinx read as a changed env value, re-reading every document on every incremental build. The merge now happens before that checkpoint, so an unchanged file is recognised as unchanged and nothing is re-read.

    Editing the file’s contents is now what triggers the rebuild, because the merged map is part of the configuration being compared. The variant role previously advised a clean build (sphinx-build -E) to pick such an edit up; that advice is gone, along with the need for it.

    Projects that set needs_variant_data inline only were never affected and are unchanged.

  • 🐛 needs_string_links no longer makes a field value disappear when its template fails

    A template that fails at render time — an unknown filter, say — logged a warning and then returned nothing at all, and the value vanished from the page rather than merely losing its link. It now falls back to the plain text, which is what a non-matching regular expression has always done, and the warning says which need it came from.

  • 🐛 needs_string_links renders separators between items only (changed output) (PR #1718)

    In a need’s meta area, the separator condition counted the characters of the value instead of its items, so every item got a trailing ; — and a single-character value got no separator at all. N items now produce N-1 separators, exactly as needtable cells have always done. Fields not named in any options are unaffected. The one-line fix landed in PR #1718; this release also pins the rule with regression tests on both surfaces.

  • 🐛 needs_string_links applies to list fields in the meta area (changed output)

    A field holding a list (tags, or any array field) was linked element by element in a needtable but rendered as plain text in the need itself. Both surfaces now link the elements, so the same field no longer renders differently depending on where you look at it. Empty elements are left alone on both surfaces, rather than linked to the bare url.

    One consequence is worth calling out for -W builds: a template that fails at render time on a list field is now reported (as a needs.layout warning, the subtype every render-time failure uses), where the meta area previously failed silently. A project whose list-field template is broken and which has no needtable rendering that field emitted no warning at all before.

  • 🐛 needs_string_links drops items that are empty once stripped, so AB-1, , AB-2 is two items rather than three with an empty one in the middle.

  • 🐛 needflow no longer fails the build when a need type has no color (or an empty one) and the diagram shows a legend (issue #1664).

    color is optional in needs_types, but both engines read it unguarded while building the legend, so :show_legend: ended the build with KeyError: 'color'. Such a type keeps its legend row, with an empty color swatch; a type whose color is set to an empty string no longer emits an empty swatch value either.

  • 🐛 needflow needs whose ids differ only in punctuation are no longer drawn as a single node by the plantuml engine.

    PlantUML entity names cannot contain punctuation, so ids such as R-1 and R=1 both became R_1 and silently collapsed into one node, taking their edges with them. Entity names are now assigned per diagram, so that they stay unique; the names shown by :debug: therefore change for such ids. needuml entity names are unchanged.

  • 🐛 needflow :border_color: accepts a value written with a leading #.

    #00FF00 previously reached graphviz as ##00FF00 and PlantUML as line:#00FF00, which PlantUML rejects outright. Both engines now normalise the value and add the prefix their own syntax needs. Relatedly, a variant expression that matches nothing now means “no border color” under graphviz, instead of the literal color #None.

  • 🐛 needflow :highlight: filters that consult needs now also work for a need with parts or child needs.

    The graphviz engine draws such a need as a subgraph, and that path evaluated the filter without the needs list, so the same expression could behave differently – or fail the build – depending on whether a need happened to have children.

  • 🐛 A graphviz needflow image without an :alt: option now gets alt="needflow graphviz diagram".

    The intended default was unreachable, so every such image was published with an empty alt attribute. Writing :alt: with no value still gives an empty alt, for a diagram that is purely decorative. The stored environment version is bumped, because the option is recorded differently when it is not given, so the first build after upgrading re-reads every document.

  • 🐛 The needflow warning for an unknown :config: name now names needs_flow_configs, which was misspelled as need_flows_configs.

  • 🐛 The needflow warning for an unknown :link_types: value now carries the source location of the directive under the graphviz engine, as it already did under plantuml.

  • 🐛 A wrapped needflow graphviz label no longer breaks an HTML entity in two.

    A need title is wrapped to the label width and escaped for graphviz’s HTML-like labels, but the escaping ran first, so the wrapper counted the characters of an entity and could break inside one: a title holding a quote wrapped to &quo<br/>t;, which graphviz refuses to render, ending the build with not well-formed (invalid token). Wrapping now happens first, which also makes the wrap width count what the reader sees rather than what the escaper wrote.

  • 🐛 A needs_graphviz_styles element type holding something other than a mapping of attributes is now reported and ignored.

    Such a value travelled unchecked into the emitter, where 'str' object has no attribute 'items' ended the whole build with a traceback instead of a message. It is now reported as a needs.needflow warning naming the config, and the diagram is drawn without the offending style.

  • 🐛 An unknown needs_flow_engine value is now reported, and the default engine draws the diagram.

    The value was checked with a bare assert, which ends the build with a traceback rather than a message — and which python -O strips altogether, leaving the unknown name to fail somewhere further downstream. It is now a needs.config warning, said once for the project.

  • 🐛 needflow naming several graphviz :config: styles no longer leaks the merged style into the diagrams after it.

    The merge took the first style’s attributes by reference and then updated that same dictionary with the second style’s, rewriting the configured (and built-in) styles in place: every later diagram naming the first style inherited the second one’s attributes, for the rest of the build. A page therefore rendered differently depending on which diagrams came before it.

  • 🐛 c.this_doc() now works in needpie, needbar and the need_count role (issue #1449)

    These evaluate their filters themselves, and did not pass on the document the directive or role was written in, so c.this_doc() ended in a this_doc can not be used in this context warning and counted nothing. They now resolve it against their own document, as needtable, needlist and the other directives whose :filter: runs through process_filters already did.

  • 🐛 c.this_doc() now also works in needsequence :filter:, needflow :highlight: and needgantt :milestone_filter:

    These three options are evaluated with filter_single_need, which raises on an invalid filter, and none of the four call sites caught it — so c.this_doc() here ended the build with this_doc can not be used in this context rather than merely warning. Each now resolves the filter against the document its own directive is written in, continuing the coverage that the entry above began.

    Filters configured in conf.py, such as needs_constraints and needs_warnings, remain uncovered: they belong to the project rather than to any document, so there is no origin document to resolve c.this_doc() against.

  • 🐛 needpie and needbar images are now byte-identical between builds of unchanged sources.

    Matplotlib writes the wall clock time into every SVG and PDF it produces, and — with no hash salt configured — derives an SVG’s internal element ids from a random uuid4, so two builds of the same chart never agreed byte for byte. The date is now left out of both formats, and the ids are salted with the chart’s own file name, which is already derived from the directive’s target id. This covers every image the directives write: SVG for the HTML builders, PDF for the LaTeX builder, and PNG, which already carried no timestamp. Nothing about the rendered chart changes.

  • 🐛 needbar no longer fails the build when :ylabels: FROM_DATA is given on its own.

    The default xlabels — 1, 2, … one per column — were derived before the ylabels column had been taken out of the content, so there was always one too many of them and the build ended with length of xlabels: N+1 is not equal with sum of columns: N. Grids that give both label options, or only :xlabels: FROM_DATA, are unaffected.

  • 🐛 A needpie with a title now uses it as the image’s alt text, as needbar already did.

    Until now every pie was published with the alt docutils falls back to — the image’s own file URI — which tells a screen reader nothing. A pie without a title keeps that fallback.

  • 🐛 A needpie whose values are all zero no longer writes an unreferenced image file.

    Such a pie is replaced by the “No needs passed the filters” paragraph, but the chart had already been rendered into _images/, where it then stayed, referenced by nothing.

  • 🐛 needreport reports a template it cannot render, instead of ending the build

    A template with a Jinja syntax error — or one that merely applies a filter to a variable that does not exist, which is what the stale example in these docs did — raised out of the directive and took the whole build down with it. That is the failure mode PR #1105 set out to remove, and the missing-file case has warned rather than aborted ever since; the render case now does too, as a needs.needreport warning naming the template and repeating the engine’s own explanation. The directive then contributes nothing to the page, exactly as it already did for a template that is missing.

    Two smaller diagnostics come with it. A needs_render_context entry that takes over one of the reserved context names — types, links, options or usage — is now reported; which value wins is deliberately unchanged, since these have been silently overridable for years, and only report_directive is meant to be set this way. The collision is a property of the configuration rather than of any one directive, so it is reported once per build. And when needs_report_template holds a path that is absolute in the POSIX sense, the “could not load” warning explains why it names a path nobody wrote down: the value is always resolved relative to the source directory, so such a path is appended to it rather than read from where it points. A Windows drive-letter path is not relative, so it is used as it stands.

    One consequence is worth calling out for -W builds: a project that overrides one of those four reserved names renders exactly as it did before, but now emits a warning where it emitted none, so a green build turns red until the entry is removed or the warning is suppressed.

  • 🐛 needreport renders without an extension providing dropdown (issue #899)

    Each section of the default template is wrapped in a dropdown directive, which neither Sphinx nor Sphinx-Needs provides. A project without an extension supplying one got a docutils error per section — at line numbers belonging to the template rather than to the document, so pointing at innocent lines — and, because Sphinx strips system_message nodes, the report then vanished from the page altogether: an empty section, four errors on the console, and a build that still exited 0 unless -W was in use.

    When nothing provides dropdown, the report is now rendered with admonition instead, and one needs.needreport warning names both remedies. Projects that do load such an extension are unaffected: the directive is looked up in the registry, so a provider is used exactly as before and nothing is warned about. Nor is an explicit choice ever second-guessed — needs_render_context = {"report_directive": "dropdown"} is honoured as written, provider or not.

    The substitution is decided on the rendered report and adopted only when it changes it, so a project with a template of its own gains neither the substitution nor the warning unless it was actually rendering a dropdown. A template that never produces one — because it writes its own directive, or shadows report_directive with a {% set %} — is left exactly as it is, and so is one with .. dropdown:: hardcoded in it, which re-rendering cannot reach. If the substituted render fails where the default one succeeded, the default is kept and nothing is reported.

    The decision is a textual scan of the rendered report, so a template that merely shows .. dropdown:: as example markup while producing it through report_directive is treated as though it used it.

  • 🐛 needgantt draws each task once, in its type color (changed output) (PR #1778)

    Tasks are declared as [<title>] as [<id>], which binds every later [...] reference to the id, but the completion and color lines addressed tasks by their title. PlantUML does not reject an unbound reference — it silently declares a second, zero length task of that name — so every need carrying a type color or a completion value was drawn twice, which, since needs_types entries carry a color by default, is every need in almost every chart. The color and the completion landed on the phantom bar, too, leaving the real one in PlantUML’s default grey: a three need chart rendered as six bars, three of them grey and full length, three of them zero length and correctly colored. Both lines now address the task by its id, so a chart of N needs draws N bars, colored and shaded as configured.

  • 🐛 start_date names the month it was given, and a December date no longer ends the build (changed output) (PR #1778)

    The date was reformatted through a month name table indexed with the 1-based month number, so the chart started one month later than asked for — 2020-03-25 became the 25th of April 2020 — and any December date raised IndexError: list index out of range, aborting the build. The generated statement is now the ISO date, which PlantUML also accepts (Project starts 2020-03-25) and which renders the identical chart, and which cannot mis-suffix a date either: 2020-01-01 used to be written the 01th of February 2020.

Documentation

  • 📚 needgantt no longer claims that task elements are linked to their related need when PlantUML’s output format is svg (PR #1778)

    No such link has ever been generated; the only link a chart produces is its caption, which points at the generated image file.

  • 📚 The needpie and needbar pages are corrected against what the two directives actually do.

    Both claimed that several image files are written per chart, where exactly one is, and both called a literal content value a “float/int”, where only a non-negative integer is read as one. The pages now also say what an invalid value really does — a label, :explode: or grid-shape mismatch, an unknown color and an unknown style all end the build — and that the rotation options take non-negative integers, that a filter containing a comma needs a custom :separator:, and that :colors: shorter than the data is extended with the default colors rather than repeated. needpie gains the missing :filter_warning: section and states that content and :filter-func: are alternatives; needbar states that it takes no filter options at all.

  • 📚 needs_string_links documents the behaviour it always had: the ,/; splitting and its lack of an escape, that the first entry naming a field wins with no fallthrough, that the pattern is searched rather than anchored, that needs_render_context shadows same-named capture groups, and that the templates are rendered with MiniJinja rather than Jinja2.

  • 📚 The needreport and needs_report_template pages are corrected against what the directive actually does.

    The “default template” the configuration page printed had drifted so far from the packaged one that copying it — the customisation route both pages recommend — ends the build, because it reads two context variables, fields and json_exclude_fields, that have never existed. The page now includes the packaged template from the source tree, so the two cannot diverge again, and the context is described as it is: the key is options, report_directive is listed, and every number in usage is called out as permanently 0 — real counts come from the need_count role that the template emits, and those count need parts and needs_external_needs alike.

    The :template: option, until now documented nowhere, gains a section of its own and the three-level precedence it takes part in is written down. needs_report_template is described as resolved relative to the source directory rather than “must be an absolute path”; the dropdown prerequisite and the report_directive escape hatch now also appear on the configuration page; and an .rst template kept inside the source directory is noted as being built as a document of its own, with the exclude_patterns entry that avoids it.

  • 📚 The list2need page is corrected against what the directive actually does (PR #1788)

    A new Need IDs section replaces the claim that an ID is captured by “the same mechanism as need_part / np”. It is not: the bracketed group is searched for anywhere in the line, runs greedily from the first ( to the last ), and accepts a far wider character class — so a title carrying a second parenthetical, as in (REQ-1) The system (as defined) shall work, yields an ID that needs_id_regex then refuses, and a title with a parenthetical but no leading ID has it taken as the ID and deleted from the title. The section also writes down the generated-ID formula — the need type’s prefix followed by the SHA1 of the title, cut to needs_id_length — and the consequence that follows from the document not being part of the hash input: the same title at the same level in two documents produces the same ID, and the second need is dropped with a duplicate-ID warning.

    The list-structure rules are stated rather than left to be discovered: the indentation must be a multiple of two spaces and one level is always exactly two, tabs are expanded before the directive sees them and so cannot be used, and a continuation line that starts in the first column loses its first word. The Set meta-data section replaces “the position of the option-string inside the line is not important” with what the regular expression does — only the first ((...)) region is read, it runs greedily from the first (( to the last )), so text between two regions is deleted, and an unquoted value such as ((status=open)) is dropped in silence.

    The “List with need-ids” example built a need titled (FEATURE, because the default . delimiter splits (FEATURE.3) before the ID is read; it now uses an ID without a dot, and says why.

  • 📚 docs/ubproject.toml, the ubCode configuration of this documentation, is brought up to date with current ubCode releases

    It now mirrors the parts of conf.py that ubCode also understands (the |br| substitution, the :pr: / :issue: roles and the intersphinx projects), and drops five extend_directives entries for directives that ubCode now supports natively. Sphinx is unaffected: needs_from_toml reads only the [needs] table, which is unchanged.

8.3.1

Released:

11.08.2026

Full Changelog:

v8.3.0…v8.3.1

This is a patch release with a PlantUML bug fix and a documentation restructuring.

Bug fixes

  • 🐛 Generated PlantUML diagrams (needuml, needarch, needflow, needsequence, needgantt) now derive PlantUML’s working directory from the physical path of the source document instead of its logical docname (issue #1749).

    Relative !include paths therefore also resolve for documents whose source file does not live under srcdir — e.g. documents contributed by sphinx-mounts — which previously failed with a misleading WARNING: plantuml command '...' cannot be run. Ordinary documents keep the exact working directory they had before.

Documentation

  • 📚 The documentation now uses the shared sphinx-syntax-example syntax-example directive, in place of the bespoke need-example directive that was defined in docs/conf.py. Consequently, the docs extra now requires Python >= 3.11.

8.3.0

Released:

08.07.2026

Full Changelog:

v8.2.0…v8.3.0

Improvements

  • ✨ needs_role_need_template is now rendered with Jinja instead of Python’s str.format (issue #1697, PR #1698)

    Jinja filters and control structures such as {% if %} are now supported, and the additional variables id_complete, id_parent, id_part, is_need and is_part are available (also via a need object, e.g. {{ need.type }}). The inline role variant :need:`[[...]] <ID>` is likewise rendered as Jinja.

    Deprecated since version 8.3.0: The old str.format syntax ({field} placeholders) is deprecated. Templates using it are still rendered with str.format and emit a needs.deprecated warning; migrate {field} to {{ field }} (e.g. "{title} ({id})" → "{{ title }} ({{ id }})"). Support for the old syntax will be removed in a future release.

8.2.0

Released:

01.07.2026

Full Changelog:

v8.1.1…v8.2.0

This release is all about building one documentation source for many product variants. If you maintain docs that differ by architecture, build flavour, feature flags or customer edition, the new variant-data tooling lets you describe those parameters once and let Sphinx-Needs do the branching — in filters, in need fields, in prose, and in whole sections. The other headline is network_back schema validation, which finally lets you express link-coverage rules from the side of the relationship where they actually make sense.

Variant data: describe your build once, reuse it everywhere

The centrepiece of 8.2.0 is needs_variant_data — a structured, namespaced replacement for the old flat needs_filter_data. You define your variant parameters as ordinary (nestable) data and read them back through a clean var namespace:

# conf.py
needs_variant_data = {
    "cpu": "arm",
    "debug": True,
    "build": {"optimization": 2, "features": ["feature_a", "feature_b"]},
}

Once configured, the same var data is available in four complementary ways, so you can pick the right tool for each spot in your docs:

  • In filters — var.build.debug reads far more naturally than the old bracket syntax, and nested data avoids clashing with your need field names:

    .. needtable::
       :filter: var.cpu == "arm" and var.build.debug == True
    
  • In need field values — inject a variant value straight into a field with the new <{ … }> syntax (for any field flagged parse_variants):

    .. req:: Example
       :id: VD_001
       :arch: <{ var.cpu }>
    
  • In prose — the new variant role drops a resolved value straight into your text, rendering the configured cpu value as arm.

  • In whole blocks — the new if directive includes or excludes entire sections (needs and all) at parse time, based on a var expression:

    .. if:: var.cpu == "arm"
    
       This section — and every need inside it — is only built for ARM.
    

Variant data can also be loaded from JSON via needs_variant_data_file and swapped per build with sphinx-build -D needs_variant_data_file=..., making it easy to generate variant-specific outputs from a single source tree (PR #1715, PR #1716, PR #1721, PR #1737).

Improvements

  • ✨ Add a network_back schema-validation key, the sibling of network, that validates a need’s incoming links instead of its outgoing ones. This lets you state a rule from the target’s point of view — for example “every requirement must be covered by at least one test” — once, on the requirement, instead of repeating it on every test. It reuses the familiar items / contains / minContains / maxContains structure and can be freely mixed and nested with network (see Incoming link validation (network_back)) (PR #1731)

  • 👌 Allow link fields in needservice directive options, so needs created via a custom service can declare links to other needs (PR #1632). Thanks to @filipepcampos

  • 👌 Honor -D command-line overrides when loading needs from a TOML file, so per-build configuration works as expected (PR #1717)

  • 👌 Include the JSON location (path) in $ref resolution error messages, making schema-configuration mistakes much easier to track down (PR #1736)

  • 👌 Track JSON files imported via needimport as build dependencies, so editing an imported file triggers a rebuild (PR #1730). Thanks to @yhontyk

  • 🔧 Add a root context7.json configuration file so AI assistants using Context7 can discover the live Sphinx-Needs documentation and use the project-specific reference instead of stale training data (issue #1719)

Deprecations

  • ⚠️ Deprecate needs_filter_data in favour of the new, structured needs_variant_data. It keeps working for now but emits a warning; the flat data it provides is injected at the filter root and can collide with need field names, which the namespaced var data avoids (PR #1715)

Breaking changes

  • ‼️ Remove the discontinued Open-Needs service (PR #1732)

    The Open-Needs project is discontinued and open-needs.org no longer resolves, so the open-needs service has been removed. The sphinx_needs.services.open_needs.OpenNeedsService import and the params, prefix and url_postfix extra fields that the service registered are no longer available.

Bug fixes

  • 🐛 Fix needpie raising All wedge sizes are zero on matplotlib 3.11+ when a pie has no data (e.g. zero matching needs); an empty pie with its legend is now rendered instead (issue #1727)

  • 🐛 Sort need link and backlink lists in needs.json and HTML output using natural, case-insensitive ordering (e.g. REQ_2 < REQ_9 < REQ_10) and collapse duplicate entries, so build outputs are reproducible regardless of need load order (e.g. when using needs_external_needs) (issue #1371)

  • 🐛 Fix parent-child relationship of newly created nodes for needs. This fixes interoperability with Sphinx extensions that look up source lines, like sphinxcontrib-spelling (issue #1564). Thanks to @tim-nordell-nimbelink

8.1.1

Released:

20.05.2026

Full Changelog:

v8.1.0…v8.1.1

This is a patch release with bug fixes and a minor performance improvement.

Performance

  • ⚡️ Add NeedItem.is_in_document() (PR #1709)

    Replace direct need["docname"] == docname comparisons with a method on NeedItem and NeedPartItem, encapsulating the document membership logic behind a single access point. Speeds up document purges on projects with many needs.

Bug fixes

  • 🐛 Fix needs_schema_definitions triggering full rebuilds (issue #1710, PR #1712). resolve_schemas_config mutated the schemas dict in place after Sphinx’s config-inited checkpoint, so the pickled config diverged from the config loaded on the next build — causing Sphinx to detect a spurious change and rebuild every document on every incremental run. The resolved schemas are now stored on the env via SphinxNeedsData accessors, leaving the config object byte-equal across builds.

  • 🐛 Fix Docker build by switching PlantUML source to GitHub releases (PR #1708). The Dockerfile hardcoded a Sourceforge mirror that became unreachable, breaking the Docker-Image workflow. The download URL now points at the official github.com/plantuml/plantuml/releases/latest/download/plantuml.jar endpoint.

8.1.0

Released:

20.05.2026

Full Changelog:

v8.0.0…v8.1.0

This release focuses on filter performance improvements and bug fixes.

Performance

  • ⚡️ Short-circuit simple filter expressions to avoid eval() overhead (PR #1677)

    Common filter patterns (e.g. id == "REQ_001", type == "spec") are now matched and evaluated directly without invoking Python’s eval(), significantly reducing filtering time for large need sets.

  • ⚡️ Add NeedItem.filter_context() to avoid costly {**need} unpacking (PR #1706)

    Filter evaluation no longer creates a full dictionary copy of each need on every filter call, reducing memory allocations and improving throughput.

  • ⚡️ Cache NeedLink filter string (PR #1705)

    Pre-compute and store the filter string on NeedLink construction, avoiding repeated string formatting on every access through NeedItem.__getitem__.

Bug fixes

  • 🐛 Fix needflow rendering very dark / black nodes when a need type has no color set in needs_types (issue #1664, PR #1702). Previously a hard-coded #000000 fallback was used as the fill color, which produced unreadable nodes — especially under browser dark mode. When no color is configured, no color is emitted and the diagram engine’s default node color is used.

    Note

    This is a minor behavior change for users with needs_types entries that omit the color key: diagrams (needflow, needuml, needgantt) that previously rendered such nodes as solid black will now render them with the diagram engine’s default node color (typically light). To preserve the old appearance, set "color": "#000000" explicitly on the affected needs_types entry.

  • 🐛 Fix :need: role in section headings by registering NeedRef node with Sphinx’s LaTeX builder (PR #1700).

8.0.0

Released:

19.03.2026

Full Changelog:

v7.0.0…v8.0.0

This release introduces conditional link assessment — the ability to attach Filter string conditions to links that are checked against the target need at build time. It also overhauls the internal link representation and fixes links_from_content to use the parsed doctree instead of fragile regex matching.

Breaking changes

  • ‼️ ENV_DATA_VERSION bumped to 4 (PR #1683)

    The internal format for storing link data in the Sphinx build environment has changed (links are now stored as structured NeedLink objects instead of plain strings). Incremental builds from a previous version will trigger a full rebuild automatically.

  • ‼️ need["links"] (and other link fields) now returns a fresh list[str] copy rather than a reference to the internal storage (PR #1670)

    Previously, code like need["links"].append("NEW_ID") would mutate the internal list. This now silently has no effect — the returned list is a projection from the internal NeedLink representation. This should only affect exotic use cases such as dynamic functions or custom extensions that mutate link lists via __getitem__ access. Use the NeedItem API (e.g. get_links(as_str=False)) for direct access to the internal NeedLink objects.

Internal changes

These changes do not affect user-facing behaviour but improve link handling internals:

  • ♻️ Introduce NeedLink structured internal representation for links (PR #1670)

  • ♻️ Store NeedLink instead of str in LinksLiteralValue and LinksFunctionArray (PR #1673)

  • 🔧 Use NeedLink directly in update_back_links function (PR #1672)

  • 🔧 Store NeedPartData.backlinks as NeedLink instead of str (PR #1679)

  • 🔧 Use get_links(as_str=False) in needextend to avoid round-trip serialization (PR #1678)

  • ♻️ Store NeedLink on NeedRef node at parse time instead of re-parsing later (PR #1682)

  • 🧪 Add tests for variants in links (PR #1669)

Bug fixes

  • 🐛 Fix linkcheck CI job warnings (PR #1667)

Documentation

  • 📚 Add sphinx-ai-index to Sphinx docs builder (PR #1671)

7.0.0

Released:

24.02.2026

Full Changelog:

v6.3.0…v7.0.0

This is a major release that consolidates field, link, and default configuration into a single, composable schema system — inspired by SysML2. See the extensible schema proposal for the full design rationale.

This release completes the first two phases of the proposal: migrating fields (needs_extra_options → needs_fields) and links (needs_extra_links → needs_links). The next potential phase is per-type schemas with type inheritance, allowing individual need types to specialize fields and links (see discussion comment for the implementation plan).

All deprecated configuration options continue to work in this release but emit warnings. We recommend migrating to the new options as soon as possible; deprecated options will be removed in a future major release.

API changes

  • ✨ Add add_field API; deprecate add_extra_option (PR #1641)

    Extensions that programmatically add fields should migrate from add_extra_option() to the new add_field(), which accepts the same schema, default, and predicate options as needs_fields.

  • 👌 Allow add_field API to set defaults/predicates (PR #1643)

Breaking changes

  • ‼️ needs_fields and add_field default to nullable with no default (PR #1645)

    When defining a field via needs_fields or add_field without an explicit schema, the field now defaults to nullable=True with no default value (i.e. null).

    Previously, fields without an explicit schema defaulted to nullable=False with a default of "" (empty string). This was a legacy of the untyped needs_extra_options era and caused confusion when users expected unset fields to be null rather than an empty string.

    The old needs_extra_options / add_extra_option APIs retain their legacy behaviour, so only users who have already migrated to needs_fields / add_field are affected.

    To restore the old behaviour explicitly:

    [needs.fields.my_field]
    nullable = false
    default = ""
    
  • ‼️ Need fields added by services default to nullable and null (PR #1644)

    Fields registered by built-in services (e.g. GitHub) now default to nullable with no default, matching the new needs_fields convention.

  • ⚠️ Separate reduced vs full need representation for schema validation (PR #1652)

    Schema validation now distinguishes between a reduced need representation (for type-specific local/network schemas, where default-valued and empty fields are stripped) and a full representation (for global field/link constraints).

    Previously, fields with default [] values (link fields, tags) were stripped before validation, silently bypassing constraints like minItems, contains, and minContains. These fields are now retained as [] in global constraint validation, so such constraints will now correctly trigger on needs that have empty link/tag lists.

  • ♻️ Replace jinja2 with minijinja for template rendering (PR #1659)

    The jinja2 dependency has been replaced by minijinja (minijinja-py), a lightweight, Rust-based Jinja2-compatible template engine. This provides faster template rendering and a smaller dependency footprint.

    Standard Jinja2 syntax is fully supported — most custom templates will work without changes. Notable differences:

    • None renders as "none" (lowercase) instead of "None". Use {% if field %}{{ field }}{% endif %} to guard against None output.

    • A few Jinja2-only filters are not available: wordcount, center, urlize, xmlattr, forceescape. See the minijinja documentation for alternatives.

Compatibility changes

  • ⬆️ Support Sphinx 9 and Docutils 0.22 (PR #1653)

    Sphinx-Needs now supports Sphinx 7.4 through 9.x and Docutils 0.22.

Bug fixes

  • 🐛 Fix needs.json read/write when no needs are present (PR #1661)

  • 🐛 Fix needextend data purging and deterministic ordering (PR #1657)

  • 🐛 Fix schema validation returning per-need errors (PR #1640)

Improvements

  • 👌 Default values of extra fields now checked against schema definitions (PR #1647)

  • 👌 Expose parse_dynamic_functions in field and link configuration (PR #1660)

  • 👌 Minor improvements for needs_fields inheritance (PR #1635)

  • ✨ Add uniqueItems to array schema validation (PR #1610)

Internal changes

These changes do not affect user-facing behaviour but improve the codebase:

  • ♻️ Migrate use of extra_links to Schema-Based Access (PR #1638)

  • 🔧 Refactor schema validation: separate select filtering from local validation (PR #1655)

  • 🔧 Simplify field/link validation (PR #1654)

  • 🔧 Simplify generate_needs function (PR #1651)

  • 🔧 Rename “option” to “field” internally (PR #1642)

  • 🔧 Refactor populate_field_type to use type-directed schema walking (PR #1639)

  • 🔧 Store full schema on FieldSchema (PR #1603)

  • 🔧 Add validate_extra_option_schema (PR #1602)

  • 🔧 Remove use of extra_options after config resolution (PR #1607)

  • 🔧 Move link schema to LinkSchema (PR #1617)

  • 🔧 Simplify import_prefix_link_edit (PR #1615)

  • 🔧 Add AGENTS.md (PR #1621)

  • 🧪 Add tests for create_inherited_field (PR #1636)

Documentation fixes

  • 📚 Fix typo in sort of needtable documentation (PR #1619)

  • 📚 Fix small grammatical error in need.rst (PR #1637)

  • 📚 Fix typo in documentation for GitHub service example (PR #1634)

6.3.0

Released:

15.12.2025

Full Changelog:

v6.2.0…v6.3.0

  • ⬆️ Support Python 3.14 (PR #1598)

  • ♻️ Remove typeguard dependency (PR #1597)

  • 👌 Relative paths from toml configuration (PR #1589)

    Ensure that file paths originating from a needs_from_toml file are relative to that file, rather than the conf.py file

  • ✨ Add new needs_links configuration (dict-based) as replacement for needs_extra_links (list-based)

    The new needs_links configuration uses a dictionary mapping link name to configuration, removing the redundant option key required in needs_extra_links. Also adds support for a description field for link types. The old needs_extra_links configuration is now deprecated but remains supported for backward compatibility.

  • ✨ Expose parse_dynamic_functions in field and link configuration

    Add per-field/link parse_dynamic_functions option to needs_fields, needs_links, and the add_field / add_extra_option API functions. Also add a new needs_parse_dynamic_functions global config option (default True) that sets the default for all extra fields and links when not explicitly set per-field/link. This provides a migration path to eventually disable dynamic function parsing by default in a future major release.

6.2.0

Released:

28.11.2025

Full Changelog:

v6.1.1…v6.2.0

This release introduces performance improvements for schema validation, to make it ~3 times faster (PR #1581, PR #1582, PR #1583, PR #1584).

This includes a change in dependencies, from jsonschema to jsonschema-rs for the core validation engine.

6.1.1

Released:

25.11.2025

Full Changelog:

v6.1.0…v6.1.1

This release focuses on schema validation improvements and bug fixes.

  • ✨ Add needs_schema_validation_enabled configuration (PR #1574)

    New configuration option to disable schema validation entirely. This is set to True by default, for backward compatibility, and provides an opt-out mechanism when schema validation is not needed.

    See needs_schema_validation_enabled for more information.

  • ✨ Add allow_type_coercion configuration for external/import needs.json reads (PR #1573)

    New configuration option for needs_external_needs and the needimport directive that controls whether field values should be automatically coerced to expected types. For example, enables/disables parsing comma-separated strings like "a,b,c" into list types like ["a", "b", "c"]. Set to True by default for backward compatibility. Setting to False may improve performance by skipping additional parsing.

    See needs_external_needs and needimport for more information.

  • 👌 Allow \. in schema regex patterns (PR #1568)

    The regex pattern \. is now allowed in schema validations.

  • 🐛 Fix schema network type injection (PR #1570)

    Fixed type injection mechanism that was failing for link types called contains or items. Constrained the injection to specific schema path structure locations.

  • 🐛 Fix needs.json schema for nullable fields (PR #1571)

    Nullable fields now correctly reflect that property in the needs.json schemas section.

6.1.0

Released:

31.10.2025

Full Changelog:

v6.0.1…v6.1.0

Main focus of this release is the improvement of the schema severity handling.

  • 👌 Improve schema severity handling (PR #1561)

    The PR removes the setting needs_schema_severity.

    All violations are printed to the console unless suppressed by suppress_warnings. To enable granular warning suppression, the following warning types were added:

    • info: sn_schema_info

    • warning: sn_schema_warning

    • violation: sn_schema_violation

    The severities info and warning are logged as logger.warning(). The severity violation is logged as logger.error() so they appear as a different color in the output.

    The schema_violations.json file contains all violations, irrespective of the severity. Any downstream tool can filter for the required severity levels.

    In schema_violations.json, child elements do not contain log_lvl and type anymore to avoid duplication.

  • 👌 Make incoming / outgoing keys optional in needs_extra_links (PR #1548)

    Defining a link is now possible with just needs_extra_links = [{"option": "links"}].

  • 🔧 Run new ubc action on docs (PR #1541)

    A new GitHub action to run ubc is now used to lint all RST sources in the CI. Next step is to create a pre-commit hook for local usage.

Minor documentation updates and internal improvements:

  • 📚 Co-locate dynamic and variant function docs (PR #1544)

  • 📚 Fix linkchecks (PR #1556)

  • 📚 Improve schema docs (PR #1554)

  • 📚 Enable link to full schema example (PR #1538)

  • ♻ Early resolution of schema_debug_path (PR #1563)

  • 🔧 Derive core FieldSchema from NeedsCoreFields (PR #1546)

  • 🧪 Add snapshot test for field schema (PR #1545)

6.0.1

Released:

02.10.2025

Full Changelog:

v6.0.0…v6.0.1

This release contains bug fixes for the 6.0.0 schema validation system and some minor improvements.

  • 👌 Add schema to add_extra_option PR #1527

    Added schema parameter to add_extra_option API to support typed fields in extensions that add extra options programmatically.

  • 🐛 Inject build_tags to variant filter strings PR #1531

    Introduced a new context variable build_tags into variant filter strings that contains all defined Sphinx build tags to be used as variant selector. The new variable can be used like this: 'tag1' in build_tags. This also avoids polluting the variable namespace with tags.

  • 🐛 Fix name error schema_path_contains PR #1530

    Fixed bug when using contains validation on empty link lists.

  • 🔧 Fix schema json missing exc message PR #1526

  • 🔧 Improve error for variant options PR #1524

    Better error messages when variant options are incorrectly set to link types.

  • 📚 Add release labels to changelog PR #1523

    Added stable release labels to changelog for better URL references.

6.0.0

Released:

28.09.2025

Full Changelog:

v5.1.0…v6.0.0

This release introduces strong typing for extra option fields to the Sphinx-Needs codebase. This affects needs read from RST sources (or others like .md), but also imported/exported needs of needs.json files.

The default type for extra options is still string, so existing configuration should work as before. Type errors are detected early once each need is fully resolved, i.e. after reading in the sources and evaluating needs_global_options (defaults), needextend, variants and Dynamic functions. Errors in the typing system lead to needs not being created.

The release also introduces a new Schema validation system that integrates into the strong typing. It is JSON schema compliant in large parts with custom extensions to support network validation.

The core of Sphinx-Needs had to be refactored in large parts to enable these changes. The following are the main user-facing changes:

  • ♻️ Allow for typed needs_extra_options fields PR #1516

    The needs_extra_options configuration option was extended to support schema information. The field schema.type globally sets the type for the field. Users can select between string, number (float), integer, boolean and array. For the array type another keyword schema.items.type defines the list items type.

    Examples in TOML configuration:

    [[needs.extra_options]]
    name = "priority"
    description = "Priority level, 1-5 where 1 is highest and 5 is lowest"
    schema.type = "integer"
    schema.minimum = 1
    schema.maximum = 5
    
    [[needs.extra_options]]
    name = "asil"
    description = "Automotive Safety Integrity Level"
    schema.type = "string"
    schema.enum = ["QM", "A", "B", "C", "D"]
    

    Key Changes:

    • Strong typing for needs_extra_options with JSON schema validation

    • Delayed resolution for dynamic functions, needextend, defaults, and variants

    • Automatic type coercion from string inputs (directive options) to proper types

    • Missing fields are set to None (null in JSON)

    • needs.json import/export with type validation and coercion; empty "" field values of existing needs.json files of type integer are coerced to 0, and for type number to 0.0 for backwards compatibility. Empty strings for boolean fields are coerced to True as this is often used as a flag.

    • Integration with schema validation system. The same fields for Supported data types and constraints can be set in the definition, so they are set globally for that field.

    The implementation strives to be as backwards compatible as possible. See below for details.

  • ✨ Schema validation PR #1467

    The PR adds a fast, declarative and versatile JSON schema based need validation. The schema is defined in the needs_schema_definitions configuration option or as JSON format passed via needs_schema_definitions_from_json.

    Key Features:

    • JSON Schema standard compliance using $defs and $ref for reusable sub-schemas

    • Fully typed implementation with runtime validation of schema definitions

    • Auto-injection of default string type when not specified

    • Select mechanism, comparable to database queries to select need nodes for validation.

    • Root validate key with local and network sub-sections for validation types. The split enables IDE extensions such as ubCode to validate-on-type for need-local changes and also run network validation once the index is fully built.

    • Debug mechanism using needs_schema_debug_active to check why validations pass or fail. 4 files are written per validation: original need, reduced need, applied schema and a result file with user and validation message. File naming pattern is <need_id>__<schema_path>__<validation_rule>.<json|txt>. Nested graph-validations are also dumped.

    • String regex pattern constraints with cross-engine compatibility

    • Semantic equivalence to JSON Schema spec for array items, minItems, maxItems, contains, minContains, and maxContains

    The new validation can replace needs_warnings, needs_constraints, needs_id_regex, needs_statuses, and needs_tags in the future.

    The implementation of the new strong typing and schema validation into ubCode is on the immediate roadmap.

  • 👌 Write schema violations into a JSON file PR #1503

    Schema validation violations are now exported to a JSON file (schema_violations.json) for external tooling integration and automated quality assurance workflows. This enables CI/CD systems and external analysis tools to programmatically process validation results.

  • Always generate schema violations.json report file PR #1511

These PRs were part of the internal changes:

  • 🧪 Move to snapshot testing for test_schema PR #1519

  • 🔧 Add VariantFunctionParsed dataclass PR #1515

  • 🔧 Add DynamicFunctionParsed dataclass PR #1514

  • ♻️ Auto-compute certain need fields PR #1496

  • ♻️ Set some core need fields to nullable PR #1488

  • 🔧 Split import item filtering to separate function PR #1484

  • ♻️ Lazily assess directive options PR #1482

  • 🧪 Improve test for need parts PR #1507

  • 👌 Improve need part processing PR #1469

  • 🔧 Centralise allowed variant core need fields PR #1424

  • ✨ Add is_import need field PR #1429

    New field to identify needs that were imported from external sources.

Breaking Changes

  • Variants have to be wrapped with << >>. This allows for a safer parsing strategy and support for usage in array elements.

  • The variant delimiter has changed to only allow ,. Formerly also ; was possible.

  • 🐛 Fix: disallow need variants for list type fields PR #1489

    Variants no longer supported in list-type fields due to parsing instability. This feature might be re-introduced in future. The new syntax << >> would make this much easier.

  • ‼️ remove parsing of deprecated needs_global_options format PR #1517

    Removes support for the deprecated legacy format of needs_global_options. The system now only accepts the dictionary format introduced in version 5.1.0. Projects using the old format will receive a warning that the configuration is not a dict and the parsing will be skipped entirely. Users must migrate to the new explicit format for global options to continue working.

  • ‼️ Improve needs default field application (via needs_global_options) PR #1478

    Previously defaults would be applied to any fields of a need with a “falsy” value, e.g. None, False, 0, "", []. This is an issue if the user wants to specifically set fields to these values, without them being overridden by defaults. Therefore, now defaults are only applied to fields with a missing or None value.

  • ‼️ Disallow add_extra_option overriding an internal field PR #1477

    Needs are stored in a flat dictionary as of now, so they cannot overlap.

  • ♻️ Store needs as NeedItem / NeedPartItem, rather than standard dict PR #1485

    Replaces standard dictionary storage with specialized NeedItem and NeedPartItem classes. This allows better encapsulation and control over data mutation.

    This is breaking for any users doing “non-API” modifications or additions to the needs data, i.e. directly adding dict items. It should not change interactions with standard APIs like add_need or filter strings.

    These PRs are also related:

    • ♻️ Improve storage of part data on NeedItem PR #1509

    • 🔧 Improve storage of content generation on NeedItem PR #1506

    • 🔧 Improve storage of constraint results on NeedItem PR #1504

    • 👌 Capture more information about modifications on NeedItem PR #1502

    • ♻️ split off source fields in NeedItem internal data PR #1491

    • ♻️ split NeedItem internal data into core, extras, links and backlinks PR #1490

  • ⬆️ Drop Python 3.9 PR #1468

  • ⬆️ Drop Sphinx<7.4, test against Python 3.13 PR #1447

Further improvements and fixes

  • 🔧 Improve plantuml check + add tests PR #1521

    PlantUML extension detection now uses app.extensions for better compatibility with dynamic registration. Thanks to @AlexanderLanin for the initial implementation.

  • ♻️ Warn for missing needimport files PR #1510

    Missing needimport files now emit warnings instead of throwing exceptions, making it possible to ignore the problem for specific use cases.

  • 🐛 Avoid leaking auth credentials for ext. need warnings PR #1512

  • ♻️ Exclude is_need / is_part from needs.json output PR #1505

    It doesn’t make sense to have these, since only needs are written, not parts. Also, these fields are “thrown away” when passing in external/import needs.json.

    These fields are only really used during processing, within filter contexts, when filtering across both needs and parts.

  • 👌 Reset directive option specs at start of build PR #1448

    Internal fix to reset directive options for consistent builds & testing.

  • 🐛 Warn on dynamic function with surrounding text PR #1426

    Added warning when dynamic functions are used for a list type with surrounding text as the surrounding text will be silently ignored.

  • Allow collapse and hide in needs_global_options PR #1456

  • 🔧 Allow template global_options PR #1454

  • 👌 Re-allow dynamic functions for layout field PR #1423

  • 🔧 Allow pre/post template global_options PR #1428

Minor documentation updates

  • 📚 Clarify c.this_doc() for needextend PR #1475

  • 📚 Fix needs_extra_links name PR #1501

  • 📚 Format configuration.rst PR #1473

  • 📚 Fix escape sequences PR #1470

Infrastructure

5.1.0

Released:

06.03.2025

Full Changelog:

v5.0.0…v5.1.0

The needs_global_options configuration option has been updated to a new format, to be more explicit and to allow for future improvements PR #1413. The old format is currently still supported, but will emit a warning. Additionally, checks are put in place to ensure that the keys used are from the allowed set (PR #1410).:

  • any needs_extra_options field

  • any needs_extra_links field

  • status

  • layout

  • style

  • tags

  • constraints

Old format
needs_global_options = {
   "field1": "a",
   "field2": ("a", 'status == "done"'),
   "field3": ("a", 'status == "done"', "b"),
   "field4": [
      ("a", 'status == "done"'),
      ("b", 'status == "ongoing"'),
      ("c", 'status == "other"', "d"),
   ],
}
New format
needs_global_options = {
   "field1": {"default": "a"},
   "field2": {"predicates": [('status == "done"', "a")]},
   "field3": {
      "predicates": [('status == "done"', "a")],
      "default": "b",
   },
   "field4": {
      "predicates": [
            ('status == "done"', "a"),
            ('status == "ongoing"', "b"),
            ('status == "other"', "c"),
      ],
      "default": "d",
   },
}

5.0.0

Released:

18.02.2025

Full Changelog:

v4.2.0…v5.0.0

This release includes a number of changes, to bring more clarity to the needs data structure and post-processing steps. In most cases it should not be breaking, but may be in some corner cases.

  • ✨ Add c.this_doc() check for use in directive :filter: option PR #1393 and PR #1405

    This allows for filtering of needs only in the same document as the directive itself, e.g.

    .. needextend:: c.this_doc() and status is None
       :status: open
    

    This works for all common filtered directives, see Filtering for needs on the current page

  • ♻️ Remove full_title need field and only trim generated titles PR #1407

    The existence of both title and full_title is confusing and unnecessary (in most cases these are equal), and so full_title is removed.

    Trimming (when needs_max_title_length is set) is now only applied to auto-generated titles, as per the documentation in needs_title_from_content

  • ♻️ Make needextend argument declarative PR #1391

    The argument for needextend can refer to either a single need ID or filter function. Currently, the format cannot be known until all needs have been processed, and it is resolved during post-processing. This is problematic for (a) user readability, (b) improving processing performance and issue feedback

    This PR slightly modifies the argument processing to allow for two “explicit” formats:

    • <ID>, if the argument is enclosed in <> it is always processed as a single ID

    • "filter string", if the argument is enclosed in "" it is always processed as a filter string

    See needextend for more information.

  • ♻️ Remove back link manipulation from needextend PR #1386

    Back links are computed at the end of the need post-processing, after needextend have been applied.

    Back links should always be in-sync with forward links, therefore it doesn’t make sense to modify back links in this way.

  • ♻️ Do not process dynamic functions on internal need fields PR #1387 and PR #1406

    For most “internal” need fields it does not make sense that these would be dynamic, and anyway this would fail since their values are not string types.

    Dynamic function processing is now skipped, for core fields that should not be altered by the user. The following fields are allowed to contain dynamic functions:

    • status

    • tags

    • style

    • constraints

    • all needs_extra_options

    • all needs_extra_links

    • all needs_global_options

  • ♻️ Remove delete from internal needs and needs.json PR #1347

    The :delete: option on a need directive deletes a need before creating/storing it, therefore it is impossible for it to be anything other than False. Storing the field on a need is misleading, because it suggests that the need will be deleted, which is not possible with the current sphinx-needs logic.

  • 👌 Add type warnings of extra options in external/import reads PR #1389

    Currently, the value of all extra options is expected to be a string; other types are not supported in various aspects of sphinx-needs (such as needextend, dynamic functions and filtering), and in-fact are already silently converted to strings during the reads.

    The warnings needs.mistyped_external_values and needs.mistyped_import_values are added for non-string values, for needs_external_needs and needimport sources respectively.

  • 🔧 Synchronize list splitting behaviour in need and needextend directives PR #1385

4.2.0

Released:

07.01.2025

Full Changelog:

v4.1.0…v4.2.0

  • ⬆️ Drop Python 3.8 and Sphinx 6

  • ✨ Add needs_import_keys configuration PR #1379

  • 👌 Allow filter-func in needpie to have multiple dots in the import path PR #1350

  • 🐛 Make external paths relative to confdir, not srcdir PR #1378

  • 🔧 Release needs data mutation lock at end of process PR #1359

  • 🔧 Add lineno to default output of needs.json PR #1346

4.1.0

Released:

28.10.2024

Full Changelog:

v4.0.0…v4.1.0

New

  • ✨ Add needs_from_toml configuration PR #1337

    Configuration can now be loaded from a TOML file, using the needs_from_toml configuration option. See needs_from_toml for more information.

  • ✨ Allow configuring description of extra options in needs_extra_options PR #1338

    The needs_extra_options configuration option now supports dict items with a name and description key, See needs_extra_options for more information.

Fixes

  • 🐛 Fix clickable links to needs in needflow, when using the graphviz engine PR #1339

  • 🐛 Allow sphinx-needs to run without sphinxcontrib.plantuml installed PR #1328

  • 🔧 Remove some internal fields from needs layout PR #1330

  • 🔧 Merge defaults into user-defined configuration earlier (to avoid sphinx warnings) PR #1341

4.0.0

Released:

09.10.2024

Full Changelog:

v3.0.0…v4.0.0

Breaking Changes

This commit contains a number of breaking changes:

Improvements to filtering at scale

For large projects, the filtering of needs in analytical directives such as needtable, needuml, etc, can be slow due to requiring an O(N) scan of all needs to determine which to include.

To address this, the storage of needs has been refactored to allow for pre-indexing of common need keys, such as id, status, tags, etc, after the read/collection phase. Filter strings such as id == "my_id" are then pre-processed to take advantage of these indexes and allow for O(1) filtering of needs, see the Filter string performance section for more information.

This change has required changes to the internal API and stricter control on the access to and modification of need data, which may affect custom extensions that modified needs data directly:

  • Access to internal data from the Sphinx env object has been made private

  • Needs data during the write phase is exposed with either the read-only NeedsView or NeedsAndPartsListView, depending on the context.

  • Access to needs data, during the write phase, can now be achieved via get_needs_view()

  • Access to mutable needs should generally be avoided outside of the formal means, but for back-compatibility the following Sphinx event callbacks are now available:

    • needs-before-post-processing: callbacks func(app, needs) are called just before the needs are post-processed (e.g. processing dynamic functions and back links)

    • needs-before-sealing: callbacks func(app, needs) just after post-processing, and before the needs are changed to read-only

Additionally, to identify any long running filters, the needs_uml_process_max_time, needs_filter_max_time and needs_debug_filters configuration options have been added.

Key changes were made in:

  • ♻️ Replace need dicts/lists with views (with fast filtering) in PR #1281

  • 🔧 split filter_needs func by needs type in PR #1276

  • 🔧 Make direct access to env attributes private in PR #1310

  • 👌 Move sorting to end of process_filters in PR #1257

  • 🔧 Improve process_filters function in PR #1256

  • 🔧 Improve internal API for needs access in PR #1255

  • 👌 Add needs_uml_process_max_time configuration in PR #1314

  • ♻️ Add needs_filter_max_time / needs_debug_filters, deprecate export_id in PR #1309

Improved warnings

sphinx-needs is designed to be durable and only except when absolutely necessary. Any non-fatal issues during the build are logged as Sphinx warnings. The warnings types have been improved and stabilised to provide more information and context, see Build Warnings for more information.

Additionally, the add_need() function will now only raise the singular exception InvalidNeedException for all need creation issues.

Key changes were made in:

  • 👌 Warn on unknown need keys in external/import sources in PR #1316

  • ♻️ Extract generate_need from add_need & consolidate warnings in PR #1318

Improved needs.json

A number of output need fields have been changed, to simplify the output. Key changes were made in:

  • 🔧 change type of need fields with bool | None to just bool in PR #1293

  • ♻️ Remove target_id core need field in PR #1315

  • ♻️ Output content in needs.json not description in PR #1312

  • 👌 Add creator key to needs.json in PR #1311

Replacement of [[...]] and need_func in need content

The parsing of the [[...]] dynamic function syntax in need content could cause confusion and unexpected behaviour. This has been deprecated in favour of the new, more explicit ndf role, which also deprecates the need_func role.

See PR #1269 and PR #1266 for more information.

Removed deprecation

The deprecated needfilter directive is now removed (PR #1308)

New and improved features

  • ✨ add tags option for list2need directive in PR #1296

  • ✨ Add ids option for needimport in PR #1292

  • 👌 Allow ref in needuml to handle need parts in PR #1222

  • 👌 Improve parsing of need option lists with dynamic functions in PR #1272

  • 👌 Improve warning for needextract incompatibility with external needs in PR #1325

  • 🔧 Set env_version for sphinx extension in PR #1313

Bug Fixes

  • 🐛 Fix removal of Needextend nodes in PR #1298

  • 🐛 Fix usage numbers in needreport in PR #1285

  • 🐛 Fix parent_need propagation from external/imported needs in PR #1286

  • 🐛 Fix need_part with multi-line content in PR #1284

  • 🐛 Fix dynamic functions in needextract need in PR #1273

  • 🐛 Disallow dynamic functions [[..]] in literal content in PR #1263

  • 🐛 fix parts defined in nested needs in PR #1265

  • 🐛 Handle malformed filter-func option value in PR #1254

  • 🐛 Pass needs to highlight filter of graphviz needflow in PR #1274

  • 🐛 Fix parts title for needflow with graphviz engine in PR #1280

  • 🐛 Fix need_count division by 0 in PR #1324

3.0.0

Released:

28.08.2024

Full Changelog:

v2.1.0…v3.0.0

This release includes a number of new features and improvements, as well as some bug fixes.

Updated dependencies

  • sphinx: >=5.0,<8 to >=6.0,<9

  • requests: ^2.25.1 to ^2.32

  • requests-file: ^1.5.1 to ^2.1

  • sphinx-data-viewer: ^0.1.1 to ^0.1.5

Documentation and CSS styling

The documentation theme has been completely updated, and a tutorial added.

To improve sphinx-needs compatibility across different Sphinx HTML themes, the CSS for needs etc has been modified substantially, and so, if you have custom CSS for your needs, you may need to update it.

See HTML Theme support for more information on how to setup CSS for different themes, and PR #1178, PR #1181, PR #1182 and PR #1184 for the changes.

needflow improvements

The use of Graphviz as the underlying engine for needflow diagrams, in addition to the default PlantUML, is now allowed via the global needs_flow_engine configuration option, or the per-diagram engine option.

The intention being to simplify and improve performance of graph builds, since plantuml has issues with JVM initialisation times and reliance on a third-party sphinx extension.

See needflow for more information, and PR #1235 for the changes.

additional improvements:

  • ✨ Allow setting an alt text for needflow images

  • ✨ Allow creating a needflow from a root_id in PR #1186

  • ✨ Add border_color option for needflow in PR #1194

needs.json improvements

A needs_schema is now included in the needs.json file (per version), which is a JSON schema for the data structure of a single need.

This includes defaults for each field, and can be used in combination with the needs_json_remove_defaults configuration option to remove these defaults from each individual need.

Together with the new automatic minifying of the needs.json file, this can reduce the file size by down to 1/8th of its previous size.

The needs_json_exclude_fields configuration option can also be used to modify the excluded need fields from the needs.json file, and backlinks are now included in the needs.json file by default.

See Format for more information, and PR #1230, PR #1232, PR #1233 for the changes.

Additionally, the content_node, content_id fields are removed from the internal need data structure (see PR #1241 and PR #1242).

Additional improvements

  • 👌 Capture filter processing times when using needs_debug_measurement=True in PR #1240

  • 👌 Allow style and color fields to be omitted for needs_types items and a default used in PR #1185

  • 👌 Allow collapse / delete / jinja_content directive options to be flags in PR #1188

  • 👌 Improve need-extend; allow dynamic functions in lists in PR #1076

  • 👌 Add collapse button to clean_xxx layouts in PR #1187

  • 🐛 fix warnings for duplicate needs in parallel builds in PR #1223

  • 🐛 Fix rendering of needextract needs and use warnings instead of exceptions in PR #1243 and PR #1249

2.1.0

Released:

08.05.2024

Full Changelog:

v2.0.0…v2.1.0

Improvements

  • 👌 Default to warning for missing needextend ID in PR #1066

  • 👌 Make needtable titles more permissive in PR #1102

  • 👌 Add filter_warning directive option, to replace default warning text in PR #1093

  • 👌 Improve and test github needservice directive in PR #1113

  • 👌 Improve warnings for invalid filters (add source location and subtype) in PR #1128

  • 👌 Exclude external needs from needs_id_regex check in PR #1108

  • 👌 Fail and emit warning on filters that do not return a boolean result in PR #964

  • 👌 Improve Need node creation and content parsing in PR #1168

  • 👌 Add loading message to permalink.html in PR #1081

  • 👌 Remove hard-coding of completion and duration need fields in PR #1127

Bug fixes

  • 🐛 Image layout function in PR #1135

  • 🐛 Centralise splitting of need ID in PR #1101

  • 🐛 Centralise need missing link reporting in PR #1104

Internal improvements

  • 🔧 Use future annotations in all modules in PR #1111

  • 🔧 Replace black/isort/pyupgrade/flake8 with ruff in PR #1080

  • 🔧 Add better typing for extra_links config variable in PR #1131

  • 🔧 Centralise need parts creation and strongly type needs in PR #1129

  • 🔧 Fix typing of need docname/lineno in PR #1134

  • 🔧 Type ExternalSource config dict in PR #1115

  • 🔧 Enforce type checking in needuml.py in PR #1116

  • 🔧 Enforce type checking in api/need.py in PR #1117

  • 🔧 Add better typing for global_options config variable in PR #1120

  • 🔧 Move dead link need fields to internals in PR #1119

  • 🔧 Remove usage of hide_status and hide_tags in PR #1130

  • 🔧 Remove hidden field from extra_options in PR #1124

  • 🔧 Remove constraints from extra_options in PR #1123

  • 🔧 Remove use of deprecated needs_extra_options as dict in PR #1126

2.0.0

Released:

13.11.2023

Full Changelog:

1.3.0…v2.0.0

This release is focussed on improving the internal code-base and its build time performance, as well as improved build warnings and other functionality improvements / fixes.

Changed

  • Add Sphinx 7 support and drop Python 3.7 (PR #1056). Sphinx 5, 6, 7 and Python 3.8 to 3.11 are now fully supported and tested.

  • The matplotlib dependency (for needbar and needpie plots) is now optional, and should be installed with sphinx-needs[plotting], see Installation (PR #1061)

  • The NeedsBuilder format name is changed to needs (PR #978)

New

Improved

Performance:

  • General performance improvement (up to 50%) and less memory consumption (~40%).

  • external_needs now uses cached templates to save generation time.

  • Improved performance for needextend with single needs.

  • Improved performance by memoizing the inline parse in build_need (PR #968)

  • Remove deepcopy of needs data (PR #1033)

  • Optimize needextend filter_needs usage (PR #1030)

  • Improve performance of needs builders by skipping document post-transforms (PR #1054)

Other:

  • Improve sphinx warnings (PR #975, PR #982) All warnings are now suffixed with [needs], and can be suppressed (see suppress_warnings)

  • Improve logging for static file copies (PR #992)

  • Improve removal of hidden need nodes (PR #1013)

  • Improve process_constraints function (PR #1015)

  • Allow needextend directive to use dynamic functions (PR #1052)

  • Remove some unnecessary keys from output needs.json (PR #1053)

Fixed

  • Fix gantt chart rendering (PR #984)

  • Fix execute_func (PR #994)

  • Fix adding sections to hidden needs (PR #995)

  • Fix NeedImport logic (PR #1006)

  • Fix creation of need title nodes (PR #1008)

  • Fix logic for process_needextend function (PR #1037)

  • Fix usage of reST syntax in prefix parameter of meta (PR #1046)

Internal

  • 🔧 Centralise access to sphinx-needs config to NeedsSphinxConfig (PR #998)

  • 🔧 Centralise sphinx env data access to SphinxNeedsData (PR #987)

  • 🔧 Consolidate needs data post-processing into post_process_needs_data function (PR #1039)

  • 🔧 Add strict type checking (PR #1000, PR #1002, PR #1042)

  • 🔧 Replace Directive with SphinxDirective (PR #986)

  • 🔧 Remove unwrap function (PR #1017)

  • 🔧 Add remove_node_from_tree utility function (PR #1063)

  • ♻️ Refactor needs post-processing function signatures (PR #1040)

  • 📚 Simplify Sphinx-Needs docs builds (PR #972)

  • 📚 Always use headless plantuml (PR #983)

  • 📚 Add intersphinx (PR #991)

  • 📚 Add outline of extension logic (PR #1012)

  • 📚 Fixed extra links example (PR #1016)

  • 🧪 Remove boilerplate from test build conf.py files (PR #989, PR #990)

  • 🧪 Add headless java to test builds (PR #988)

  • 🧪 Add snapshot testing (PR #1019, PR #1020, PR #1059)

  • 🧪 Make documentation builds fail on warnings (PR #1005)

  • 🧪 Add testing of JS scripts using Cypress integrated into PyTest (PR #1051)

  • 🧪 Add code coverage to CI testing (PR #1067)

1.3.0

Released: 16.08.2023

1.2.2

Released: 08.02.2023

  • Bugfix: Changed needed version of jsonschema-lib to be not so strict. (PR #871)

1.2.1

Released: 08.02.2023

1.2.0

Released: 24.01.2023

  • Bugfix: Allowing newer versions of jsonschema. (PR #848)

  • Improvement: Adds list2need directive, which allows to create simple needs from list. (issue #854)

1.1.1

Released: 21.12.2022

  • Bugfix: Removed outdated JS codes that handles the collapse button. (issue #840)

  • Improvement: Write autogenerated images into output folder (issue #413)

  • Improvement: Added vector output support to need figures. (issue #815).

  • Improvement: Introduce the jinja function ref for needuml. (issue #789)

  • Bugfix: Needflow fix bug in child need handling. (issue #785).

  • Bugfix: Needextract handles image and download directives correctly. (issue #818).

  • Bugfix: Needextract handles substitutions correctly. (issue #835).

1.1.0

Released: 22.11.2022

  • Bugfix: Expand/Collapse button does not work. (issue #795).

  • Bugfix: singlehtml and latex related builders are working again. (issue #796).

  • Bugfix: Needextend throws the same information 3 times as part of a single warning. (issue #747).

  • Improvement: Memory consumption and runtime improvements (issue #790).

  • Improvement: Obfuscate HTTP authentication credentials from log output. (issue #759)

  • Bugfix: needflow: nested needs on same level throws PlantUML error. (issue #799)

1.0.3

Released: 08.11.2022

  • Improvement: Fixed needextend error handling by adding a strict-mode option to it. (issue #747)

  • Improvement: Fixed issue with handling needs-variants by default. (issue #776)

  • Improvement: Performance fix needs processing. (issue #756)

  • Improvement: Performance fix for needflow. (issue #760)

  • Improvement: Fixed rendering issue with the debug layout. (issue #721)

  • Improvement: Added needs_show_link_id.

  • Improvement: Supported arguments as filter string for needextract. (issue #688)

  • Improvement: Added needs_render_context configuration option which enables you to use custom data as the context when rendering Jinja templates or strings. (issue #704)

  • Improvement: Supported target_url for needs_external_needs. (issue #701)

  • Bugfix: Fixed needuml key shown in need meta data by providing internal need option arch. (issue #687)

  • Improvement: Included child needs inside their parent need for needflow. (issue #714)

  • Improvement: Supported generate need ID from title with needs_id_from_title. (issue #692)

  • Improvement: Supported download needs.json for needimport. (issue #715)

  • Bugfix: Fixed import() be included in needarch. (issue #730)

  • Bugfix: Needuml: uml() call circle leads to an exception NeedArch Loop Example. (issue #731)

  • Improvement: needarch provide need() function to get “need data”. (issue #732)

  • Improvement: needuml - flow() shall return plantuml text without newline. (issue #737)

  • Bugfix: Needuml used but “sphinxcontrib.plantuml” not installed leads to exception (issue #742)

  • Improvement: better documentation of mixing orientation and coloring in needs_extra_links (issue #764)

  • Bugfix: Needarch: Fixed import() function to work with new implemented flow() (#737). (issue #752)

  • Bugfix: Needtable: generate id for nodes.table (issue #434)

  • Improvement: Updated pantuml in test folder to same version as in doc folder (issue #765)

1.0.2

Released: 22.09.2022

1.0.1

Released: 11.07.2022

  • Notice: Sphinx <5.0 is no longer supported.

  • Notice: Docutils <0.18.1 is no longer supported.

  • Improvement: Provides needuml for powerful, reusable Need objects.

  • Improvement: Provides needreport for documenting configuration used in a Sphinx-Needs project’s conf.py.

  • Improvement: Provides initial support for Sphinx-Needs IDE language features. (PR #584)

  • Improvement: Support snippet for auto directive completion for Sphinx-Needs IDE language features.

  • Improvement: Added show_top_sum to Needbar and make it possible to rotate the bar labels. (issue #516)

  • Improvement: Added needs_constraints option. Constraints can be set for individual needs and describe properties a need has to meet.

  • Improvement: Added customizable link text of Need. (#439)

  • Bugfix: Fixed lsp needs.json path check. (issue #603, issue #633)

  • Bugfix: Support embedded needs in embedded needs. (issue #486)

  • Bugfix: Correct references in needtables to be external or internal instead of always external.

  • Bugfix: Correct documentation and configuration in tags to list type.

  • Bugfix: Handle overlapping labels in needpie. (issue #498)

  • Bugfix: needimport uses source-folder for relative path calculation (instead of confdir).

0.7.9

Released: 10.05.2022

0.7.8

Released: 29.03.2022

  • Improvement: Provides line number info for needs node. (issue #499)

  • Bugfix: needpie causing a crash in some cases on newer matplotlib versions. (issue #513, issue #517)

  • Bugfix: needpie takes need-parts in account for filtering. (issue #514)

  • Bugfix: Empty and invalid need.json files throw user-friendly exceptions. (issue #441)

0.7.7

Released: 04.03.2022

  • Bugfix: need role supporting lower and upper IDs. (issue #508)

  • Bugfix: Correct image registration to support build via Sphinx API. (issue #505)

  • Bugfix: Correct css/js file registration on windows. (issue #455)

0.7.6

Released: 28.02.2022

0.7.5

Released: 21.01.2022

0.7.4

Released: 30.11.2021

0.7.3

Released: 08.11.2021

0.7.2

Released: 08.10.2021

0.7.1

Released: 21.07.2021

0.7.0

Released: 06.07.2021

0.6.3

Released: 18.06.2021

  • Improvement: Dead links (references to not found needs) are supported and configurable by allow_dead_links. (issue #116)

  • Improvement: Introducing need_func to execute Dynamic functions inline. (issue #133)

  • Improvement: Support for multiline_option in templates.

  • Bugfix: needflow: links for need-parts get correctly calculated. (issue #205)

  • Bugfix: CSS update for ReadTheDocsTheme to show tables correctly. (issue #263)

  • Bugfix: CSS fix for needtable style_row. (issue #195)

  • Bugfix: current_need var is accessible in all need-filters. (issue #169)

  • Bugfix: Sets defaults for color and style of need type configuration, if not set by user. (issue #151)

  • Bugfix: needtable shows horizontal scrollbar for tables using datatables style. (issue #271)

  • Bugfix: Using id_complete instead of id in filter code handling. (issue #156)

  • Bugfix: Dynamic Functions registration working for external extensions. (issue #288)

0.6.2

Released: 30.04.2021

  • Improvement: Parent needs of nested needs get collected and are available in filters. (issue #249)

  • Bugfix: Copying static files during sphinx build is working again. (issue #252)

  • Bugfix: Link function for layouts setting correct text. (issue #251)

0.6.1

Released: 23.04.2021

  • Support: Removes support for Sphinx version <3.0 (Sphinx 2.x may still work, but it gets not tested).

  • Improvement: Internal change to poetry, nox and github actions. (issue #216)

  • Bugfix: Need-service calls get mocked during tests, so that tests don’t need reachable external services any more.

  • Bugfix: No warning is thrown any more, if needservice can’t find a service config in conf.py (issue #168)

  • Bugfix: Needs nodes get ids set directly, to avoid empty ids given by sphinx or other extensions for need-nodes. (issue #193)

  • Bugfix: needimport supports extra options and extra fields. (issue #227)

  • Bugfix: Checking for ending / of given github api url. (issue #187)

  • Bugfix: Using correct indention for pre and post_template function of needs.

  • Bugfix: Certain log message don’t use python internal id any more. (issue #225)

  • Bugfix: JS-code for meta area collapse is working again. (issue #242)

0.6.0

0.5.6

  • Bugfix: Dynamic function registration via API supports new internal function handling (issue #147)

  • Bugfix: Deactivated linked gantt elements in needgantt, as PlantUML does not support them in its latest version (not beta).

0.5.5

0.5.4

0.5.3

0.5.2

  • Improvement: Sphinx-Needs configuration gets checked before build. (issue #118)

  • Improvement: meta_links_all layout function now supports an exclude parameter

  • Improvement: needflow’s connection line and arrow type can be configured.

  • Improvement: Configurations added for needflow. Use needs_flow_configs to define them and config for activation.

  • Improvement: needflow option debug added, which prints the generated PlantUML code after the flowchart.

  • Improvement: Supporting Need-Templates by providing need option template and configuration option needs_template_folder. (issue #119)

  • Bugfix: needs_global_options handles None values correctly. style can now be set.

  • Bugfix: needs_title_from_content takes \n and . as delimiter.

  • Bugfix: Setting css-attribute white-space: normal for all need-tables, which is set badly in some sphinx-themes. (Yes, I’m looking at you ReadTheDocs theme…)

  • Bugfix: meta_all layout function also outputs extra links and the no_links parameter now works as expected

  • Bugfix: Added need-type as css-class back on need. Css class name is needs_type_(need_type attribute). (issue #124)

  • Bugfix: Need access inside list comprehensions in Filter string is now working.

0.5.1

  • Improvement: Added needextract directive to mirror existing needs for special outputs. (issue #66)

  • Improvement: Added new styles discreet and discreet_border.

  • Bugfix: Some minor css fixes for new layout system.

0.5.0

  • Improvement: Introduction of needs Layouts & Styles.

  • Improvement: Added config options needs_layouts and needs_default_layout.

  • Improvement: Added needpie which draws pie-charts based on Filter string.

  • Improvement: Added config option needs_warnings. (issue #110)

  • Bugfix: Need css style name is now based on need-type and not on the longer, whitespace-containing type name. Example: need-test instead of not valid need-test case. (issue #108)

  • Bugfix: No more exception raise if copy value not set inside needs_extra_links.

  • Improvement: Better log message, if required id is missing. (issue #112)

  • Removed: Configuration option needs_collapse_details. This is now realized by Layouts.

  • Removed: Configuration option needs_hide_options. This is now realized by Layouts.

  • Removed: Need option need_hide_status. This is now realized by Layouts.

  • Removed: Need option need_hide_tags. This is now realized by Layouts.

WARNING: This version changes a lot the html output and therefore the needed css selectors. So if you are using custom css definitions you need to update them.

0.4.3

  • Improvement: Role need supports standard sphinx-ref syntax. Example: :need:`custom name <need_id>`

  • Improvement: Added needs_global_options to set values of global options only under custom circumstances.

  • Improvement: Added sorting to needtable. See sort for details.

  • Improvement: Added dynamic function links_from_content to calculated links to other needs automatically from need-content. (issue #98)

  • Improvement: Dynamic function copy supports uppercase and lowercase transformation.

  • Improvement: Dynamic function copy supports filter_string.

  • Bugfix: Fixed corrupted Dynamic functions handling for tags and other list options. (issue #100)

  • Bugfix: Double entries for same need in needtable fixed. (issue #93)

0.4.2

0.4.1

  • Improvement: Added style option to allow custom styles for needs.

  • Improvement: Added style_row option to allow custom styles for table rows and columns.

0.4.0

  • Improvement: Provides API for other sphinx-extensions. See Python API for documentation.

  • Improvement: Added Support page.

  • Bugfix: Fixed deprecation warnings to support upcoming Sphinx3.0 API.

0.3.15

  • Improvement: In filter operations, all needs can be accessed by using keyword needs.

  • Bugfix: Removed prefix from normal needs for needtable (issue #97)

0.3.14

0.3.13

  • Bugfix: Filters on needs with id_parent or id_complete do not raise an exception any more and filters gets executed correctly.

0.3.12

0.3.11

  • Improvement: Added config option needs_extra_links to define additional link types like blocks, tested by and more. Supports also style configuration and custom presentation names for links.

  • Improvement: Added export_id option for filter directives to export results of filters to needs.json.

  • Improvement: Added config option needs_flow_show_links and related needflow option show_link_names.

  • Improvement: Added config option needs_flow_link_types and related needflow option link_types.

  • Bugfix: Unicode handling for Python 2.7 fixed. (issue #86)

0.3.10

  • Bugfix: type was missing in output of builder needs (issue #79)

  • Bugfix: needs_functions parameter in conf.py created a sphinx error, if containing python methods. Internal workaround added, so that usage of own Dynamic functions stays the same as in prior versions (issue #78)

0.3.9

  • Bugfix: Grubby tag/link strings in needs, which define empty links/tags, produce a warning now.

  • Bugfix: Better logging of document location, if a filter string is not valid.

  • Bugfix: Replaced all print-statements with sphinx warnings.

0.3.8

0.3.7

  • Improvement: Filter string now supports the filtering of need_part / np.

  • Improvement: The ID of a need is now printed as link, which can easily be used for sharing. (issue #75)

  • Bugfix: Filter functionality in different directives are now using the same internal filter function.

  • Bugfix: Reused IDs for a need_part / np are now detected and a warning gets printed. (issue #74)

0.3.6

  • Improvement: Added needtable option show_parts.

  • Improvement: Added configuration option needs_part_prefix.

  • Improvement: Added docname to output file of builder needs

  • Bugfix: Added missing needs_import template to MANIFEST.ini.

0.3.5

  • Bugfix: A need_part / np without a given ID gets a random id based on its content now.

  • Bugfix: Calculation of outgoing links does not crash, if need_parts are involved.

0.3.4

  • Bugfix: Need representation in PDFs were broken (e.g. all meta data on one line).

0.3.3

  • Bugfix: Latex and Latexpdf are working again.

0.3.2

  • Bugfix: Links to parts of needs (need_part / np) are now stored and presented as links incoming of target link.

0.3.1

  • Improvement: Added dynamic function check_linked_values.

  • Improvement: Added dynamic function calc_sum.

  • Improvement: Added role need_count, which shows the amount of found needs for a given filter-string.

  • Bugfix: Links to need_part / np in needflow are now shown correctly as extra line between

    need_parts containing needs.

  • Bugfix: Links to need_part / np in needtable are now shown and linked correctly in tables.

0.3.0

  • Improvement: Dynamic functions are now available to support calculation of need values.

  • Improvement: needs_functions can be used to register and use own dynamic functions.

  • Improvement: Added needs_global_options to set need values globally for all needs.

  • Improvement: Added needs_hide_options to hide specific options of all needs.

  • Bugfix: Removed needs are now deleted from existing needs.json (issue #68)

  • Removed: needs_template and needs_template_collapse are no longer supported.

0.2.5

  • Bugfix: Fix for changes made in 0.2.5.

0.2.4

  • Bugfix: Fixed performance issue (issue #63)

0.2.3

0.2.2

  • Improvement: The sections, to which a need belongs, are now stored, filterable and exported in needs.json. See updated filter. (PR #53 )

  • Improvement: Project specific options for needs are supported now. See needs_extra_options. (PR #48 )

  • Bugfix: Logging fixed (issue #50 )

  • Bugfix: Tests for custom styles are now working when executed with all other tests (PR #47)

0.2.1

  • Bugfix: Sphinx warnings fixed, if need-collapse was used. (issue #46)

  • Bugfix: dark.css, blank.css and common.css used wrong need-container selector. Fixed.

0.2.0

  • Deprecated: needfilter is replaced by needlist, needtable or needflow. Which support additional options for related layout.

  • Improvement: Added needtable directive.

  • Improvement: Added DataTables support for needtable (including table search, excel/pdf export and dynamic column selection).

  • Improvement: Added needs_id_regex, which takes a regular expression and which is used to validate given IDs of needs.

  • Improvement: Added meta information shields on documentation page

  • Improvement: Added more examples to documentation

  • Bugfix: Care about unneeded separator characters in tags (issue #36)

  • Bugfix: Avoiding multiple registration of resource files (js, css), if sphinx gets called several times (e.g. during tests)

  • Bugfix: Needs with no status shows up on filters (issue #45)

  • Bugfix: Supporting Sphinx 1.7 (issue #41)

0.1.49

  • Bugfix: Supporting plantuml >= 0.9 (issue #38)

  • Bugfix: need_outgoing does not crash, if given need-id does not exist (issue #32)

0.1.48

  • Improvement: Added configuration option needs_role_need_template.

  • Bugfix: Referencing not existing needs will result in build warnings instead of a build crash.

  • Refactoring: needs development files are stored internally under sphinxcontrib/needs, which is in sync with

    most other sphinxcontrib-packages.

0.1.47

  • Bugfix: dark.css was missing in MANIFEST.in.

  • Improvement: Better output, if configured needs_css file can not be found during build.

0.1.46

  • Bugfix: Added python2/3 compatibility for needs_import.

0.1.45

  • Bugfix: needs with no status are handled the correct way now.

0.1.44

  • Bugfix: Import statements are checked, if Python 2 or 3 is used.

0.1.43

  • Improvement: Added “dark.css” as style

  • Bugfix: Removed “,” as as separator of links in need presentation.

0.1.42

  • Improvement: Added config parameter needs_css, which allows to set a css file.

  • Improvement: Most need-elements (title, id, tags, status, …) got their own html class attribute to support custom styles.

  • Improvement: Set default style “modern.css” for all projects without configured needs_css parameter.

0.1.41

  • Improvement: Added config parameters needs_statuses and needs_tags to allow only configured statuses/tags inside documentation.

  • Bugfix: Added LICENSE file (MIT)

0.1.40

  • Bugfix: Removed jinja activation

0.1.39

  • Bugfix: Added missing needimport_template.rst to package

  • Bugfix: Corrected version param of needimport

0.1.38

  • Improvement: :links:, :tags: and other list-based options can handle “,” as delimiter

    (beside documented “;”). No spooky errors are thrown any more if “,” is used accidentally.

0.1.37

  • Bugfix: Implemented 0.1.36 bugfix also for needfilter and needimport.

0.1.36

  • Bugfix: Empty :links: and :tags: options for need items raise no error during build.

0.1.35

  • Improvement/Bug: Updated default node_template to use less space for node parameter representation

  • Improvement: Added :filter: option to needimport directive

  • Bugfix: Set correct default value for need_list option. So no more warnings should be thrown during build.

  • Bugfix: Imported needs gets sorted by id before adding them to the related document.

0.1.34

  • Improvement: New option tags for needimport directive

  • Bugfix: Handling of relative paths in needs builder

0.1.33

  • New feature: Directive needimport implemented

  • Improvement: needs-builder stores needs.json for all cases in the build directory (like _build/needs/needs.json) (See issue)

  • Bugfix: Wrong version in needs.json, if an existing needs.json got imported

  • Bugfix: Wrong need amount in initial needs.json fixed

0.1.32

  • Bugfix: Setting correct working directory during conf.py import

  • Bugfix: Better config handling, if Sphinx builds gets called multiple times during one single python process. (Configs from prio sphinx builds may still be active.)

  • Bugifx: Some clean ups for using Sphinx >= 1.6

0.1.31

  • Bugfix: Added missing dependency to setup.py: Sphinx>=1.6

0.1.30

  • Improvement: Builder needs added, which exports all needs to a json file.

0.1.29

  • Bugfix: Build has crashed, if sphinx-needs was loaded but not a single need was defined.

0.1.28

  • Bugfix: Added support for multiple sphinx projects initialisations/builds during a single python process call.

    (Reliable sphinx-needs configuration separation)

0.1.27

0.1.26

0.1.25

  • Restructured code

  • Restructured documentation

  • Improvement: Role need_outgoing was added to print outgoing links from a given need

  • Improvement: Role need_incoming was added to print incoming links to a given need

0.1.24

  • Bugfix: Reactivated jinja execution for documentation.

0.1.23

  • Improvement: complex filter for needfilter directive supports regex searches.

  • Improvement: complex filter has access to nearly all need variables (id, title, content, …)`.

  • Bugfix: If a duplicated ID is detected an error gets thrown.

0.1.22

  • Improvement: needfilter directives supports complex filter-logic by using parameter Filtering needs.

0.1.21

  • Improvement: Added word highlighting of need titles in linked pages of svg diagram boxes.

0.1.20

  • Bugfix for custom needs_types: Parameter in conf.py was not taken into account.

0.1.19

  • Added configuration parameter needs_id_required.

  • Backwards compatibility changes:

  • Reimplemented needlist as alias for needfilter

  • Added need directive/need as part of the default needs_types configuration.

0.1.18

Initial start for the changelog

  • Free definable need types (Requirements, Bugs, Tests, Employees, …)

  • Allowing configuration of needs with a

  • directive name

  • meaningful title

  • prefix for generated IDs

  • color

  • Added needfilter directive

  • Added layouts for needfilter:

  • list (default)

  • table

  • diagram (based on plantuml)

  • Integrated interaction with the activated plantuml sphinx extension

  • Added role need to create a reference to a need by giving the id