Skip to content

Commit

Permalink
🔧 Remove constraints from extra_options (#1123)
Browse files Browse the repository at this point in the history
`constraints` is a core sphinx-need option, and so it is not necessary to add it to the `extra_options`
  • Loading branch information
chrisjsewell authored Feb 22, 2024
1 parent 98777ea commit 9c8c721
Show file tree
Hide file tree
Showing 5 changed files with 4 additions and 3 deletions.
1 change: 0 additions & 1 deletion sphinx_needs/data.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions sphinx_needs/directives/need.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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)
Expand Down
1 change: 1 addition & 0 deletions sphinx_needs/directives/needimport.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion sphinx_needs/external_needs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

Expand Down
1 change: 0 additions & 1 deletion sphinx_needs/needs.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down

0 comments on commit 9c8c721

Please sign in to comment.