diff --git a/sphinx_needs/data.py b/sphinx_needs/data.py index e8042d909..f18cf2944 100644 --- a/sphinx_needs/data.py +++ b/sphinx_needs/data.py @@ -179,7 +179,6 @@ class NeedsInfoType(TypedDict): # TODO these all default to "" which I don't think is good duration: str completion: str - # constraints: str # this is already set in create_need # options from `BaseService.options` get added to every need, # via `ServiceManager.register`, which adds them to `extra_options`` # GithubService diff --git a/sphinx_needs/directives/need.py b/sphinx_needs/directives/need.py index 9c2cd4ab2..d9ba3b24e 100644 --- a/sphinx_needs/directives/need.py +++ b/sphinx_needs/directives/need.py @@ -130,6 +130,7 @@ def run(self) -> Sequence[nodes.Node]: post_template = self.options.get("post_template") duration = self.options.get("duration") completion = self.options.get("completion") + constraints = self.options.get("constraints", []) need_extra_options = {"duration": duration, "completion": completion} for extra_link in self.needs_config.extra_links: @@ -160,6 +161,7 @@ def run(self) -> Sequence[nodes.Node]: layout=layout, delete=delete_opt, jinja_content=jinja_content, + constraints=constraints, **need_extra_options, ) add_doc(env, self.docname) diff --git a/sphinx_needs/directives/needimport.py b/sphinx_needs/directives/needimport.py index cf9d26cc3..487915c28 100644 --- a/sphinx_needs/directives/needimport.py +++ b/sphinx_needs/directives/needimport.py @@ -212,6 +212,7 @@ def run(self) -> Sequence[nodes.Node]: "style", "layout", "need_type", + "constraints", *[x["option"] for x in extra_links], *NEEDS_CONFIG.extra_options, ) diff --git a/sphinx_needs/external_needs.py b/sphinx_needs/external_needs.py index 47d34a5d2..706a8f96d 100644 --- a/sphinx_needs/external_needs.py +++ b/sphinx_needs/external_needs.py @@ -144,7 +144,7 @@ def load_external_needs(app: Sphinx, env: BuildEnvironment, _docname: str) -> No need_params["links"] = need.get("links", []) need_params["tags"] = ",".join(need.get("tags", [])) need_params["status"] = need.get("status") - need_params["constraints"] = ",".join(need.get("constraints", [])) + need_params["constraints"] = need.get("constraints", []) del need_params["description"] diff --git a/sphinx_needs/needs.py b/sphinx_needs/needs.py index 756acaea8..c165cd4ad 100644 --- a/sphinx_needs/needs.py +++ b/sphinx_needs/needs.py @@ -516,7 +516,6 @@ def prepare_env(app: Sphinx, env: BuildEnvironment, _docname: str) -> None: for option in [ "duration", "completion", - "constraints", ]: # Check if not already set by user if option not in NEEDS_CONFIG.extra_options: