ewokssphinx 2.0.0__tar.gz → 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/LICENSE.md +1 -1
- {ewokssphinx-2.0.0/src/ewokssphinx.egg-info → ewokssphinx-2.2.0}/PKG-INFO +16 -9
- ewokssphinx-2.2.0/README.md +34 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/pyproject.toml +17 -11
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/ewoks_task_directive.py +4 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/ewoks_task_utils.py +7 -4
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/sphinx_task_utils.py +75 -26
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/conftest.py +1 -1
- ewokssphinx-2.2.0/src/ewokssphinx/tests/dummy_tasks_nested.py +35 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/test_task_directive_pydantic.py +19 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/test_utils.py +5 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/type_utils.py +3 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0/src/ewokssphinx.egg-info}/PKG-INFO +16 -9
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx.egg-info/SOURCES.txt +1 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx.egg-info/requires.txt +1 -2
- ewokssphinx-2.0.0/README.md +0 -26
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/setup.cfg +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/__init__.py +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/ewokssphinx.css +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/__init__.py +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/dummy_tasks.py +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/dummy_tasks_pydantic.py +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/test_task_cache.py +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/test_task_directive.py +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx.egg-info/dependency_links.txt +0 -0
- {ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx.egg-info/top_level.txt +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# MIT License
|
|
2
2
|
|
|
3
|
-
**Copyright (c)
|
|
3
|
+
**Copyright (c) 2026 European Synchrotron Radiation Facility**
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
6
6
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ewokssphinx
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Ewoks Sphinx directives
|
|
5
5
|
Author-email: ESRF <dau-pydev@esrf.fr>
|
|
6
6
|
License: # MIT License
|
|
7
7
|
|
|
8
|
-
**Copyright (c)
|
|
8
|
+
**Copyright (c) 2026 European Synchrotron Radiation Facility**
|
|
9
9
|
|
|
10
10
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
11
11
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -24,11 +24,11 @@ License: # MIT License
|
|
|
24
24
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
25
25
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
26
|
|
|
27
|
-
Project-URL: Homepage, https://
|
|
28
|
-
Project-URL: Documentation, https://
|
|
29
|
-
Project-URL: Repository, https://
|
|
30
|
-
Project-URL: Issues, https://
|
|
31
|
-
Project-URL: Changelog, https://
|
|
27
|
+
Project-URL: Homepage, https://github.com/ewoks-kit/ewokssphinx/
|
|
28
|
+
Project-URL: Documentation, https://github.com/ewoks-kit/ewokssphinx/blob/main/README.md
|
|
29
|
+
Project-URL: Repository, https://github.com/ewoks-kit/ewokssphinx/
|
|
30
|
+
Project-URL: Issues, https://github.com/ewoks-kit/ewokssphinx/issues
|
|
31
|
+
Project-URL: Changelog, https://github.com/ewoks-kit/ewokssphinx/blob/main/CHANGELOG.md
|
|
32
32
|
Keywords: ewoks,sphinx
|
|
33
33
|
Classifier: Intended Audience :: Science/Research
|
|
34
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -44,8 +44,7 @@ Provides-Extra: test
|
|
|
44
44
|
Requires-Dist: pytest>=7; extra == "test"
|
|
45
45
|
Provides-Extra: dev
|
|
46
46
|
Requires-Dist: ewokssphinx[test]; extra == "dev"
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist: flake8>=4; extra == "dev"
|
|
47
|
+
Requires-Dist: ruff; extra == "dev"
|
|
49
48
|
Provides-Extra: doc
|
|
50
49
|
Requires-Dist: ewokssphinx[test]; extra == "doc"
|
|
51
50
|
Requires-Dist: myst-parser; extra == "doc"
|
|
@@ -55,6 +54,14 @@ Dynamic: license-file
|
|
|
55
54
|
|
|
56
55
|
# ewokssphinx
|
|
57
56
|
|
|
57
|
+
|
|
58
|
+
[](https://github.com/ewoks-kit/ewokssphinx/actions/workflows/test.yml)
|
|
59
|
+
[](https://github.com/astral-sh/ruff)
|
|
60
|
+
[](https://github.com/ewoks-kit/ewokssphinx/blob/main/LICENSE.md)
|
|
61
|
+
[](https://codecov.io/gh/ewoks-kit/ewokssphinx)
|
|
62
|
+
[](https://ewokssphinx.readthedocs.io/en/latest/?badge=latest)
|
|
63
|
+
[](https://pypi.org/project/ewokssphinx/)
|
|
64
|
+
|
|
58
65
|
A set of Sphinx directives for Ewoks
|
|
59
66
|
|
|
60
67
|
## Quick start
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
# ewokssphinx
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
[](https://github.com/ewoks-kit/ewokssphinx/actions/workflows/test.yml)
|
|
5
|
+
[](https://github.com/astral-sh/ruff)
|
|
6
|
+
[](https://github.com/ewoks-kit/ewokssphinx/blob/main/LICENSE.md)
|
|
7
|
+
[](https://codecov.io/gh/ewoks-kit/ewokssphinx)
|
|
8
|
+
[](https://ewokssphinx.readthedocs.io/en/latest/?badge=latest)
|
|
9
|
+
[](https://pypi.org/project/ewokssphinx/)
|
|
10
|
+
|
|
11
|
+
A set of Sphinx directives for Ewoks
|
|
12
|
+
|
|
13
|
+
## Quick start
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
pip install ewokssphinx
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
Then, add `ewokssphinx` to the list of `extensions` in the Sphinx configuration file:
|
|
20
|
+
|
|
21
|
+
```python
|
|
22
|
+
# conf.py
|
|
23
|
+
|
|
24
|
+
...
|
|
25
|
+
|
|
26
|
+
extensions = [
|
|
27
|
+
...,
|
|
28
|
+
"ewokssphinx"
|
|
29
|
+
]
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
## Documentation
|
|
33
|
+
|
|
34
|
+
[Full documentation](https://ewokssphinx.readthedocs.io/en/latest) with [examples](https://ewokssphinx.readthedocs.io/en/latest/examples.html)
|
|
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "ewokssphinx"
|
|
7
|
-
version = "2.
|
|
7
|
+
version = "2.2.0"
|
|
8
8
|
keywords = ['ewoks', 'sphinx']
|
|
9
9
|
authors = [{ name = "ESRF", email = "dau-pydev@esrf.fr" }]
|
|
10
10
|
description = "Ewoks Sphinx directives"
|
|
@@ -24,11 +24,11 @@ dependencies = [
|
|
|
24
24
|
]
|
|
25
25
|
|
|
26
26
|
[project.urls]
|
|
27
|
-
Homepage = "https://
|
|
28
|
-
Documentation = "https://
|
|
29
|
-
Repository = "https://
|
|
30
|
-
Issues = "https://
|
|
31
|
-
Changelog = "https://
|
|
27
|
+
Homepage = "https://github.com/ewoks-kit/ewokssphinx/"
|
|
28
|
+
Documentation = "https://github.com/ewoks-kit/ewokssphinx/blob/main/README.md"
|
|
29
|
+
Repository = "https://github.com/ewoks-kit/ewokssphinx/"
|
|
30
|
+
Issues = "https://github.com/ewoks-kit/ewokssphinx/issues"
|
|
31
|
+
Changelog = "https://github.com/ewoks-kit/ewokssphinx/blob/main/CHANGELOG.md"
|
|
32
32
|
|
|
33
33
|
[project.optional-dependencies]
|
|
34
34
|
test = [
|
|
@@ -36,8 +36,7 @@ test = [
|
|
|
36
36
|
]
|
|
37
37
|
dev = [
|
|
38
38
|
"ewokssphinx[test]",
|
|
39
|
-
"
|
|
40
|
-
"flake8 >=4",
|
|
39
|
+
"ruff",
|
|
41
40
|
]
|
|
42
41
|
doc = [
|
|
43
42
|
"ewokssphinx[test]",
|
|
@@ -59,6 +58,13 @@ ewokssphinx = ["*.css"]
|
|
|
59
58
|
[tool.coverage.run]
|
|
60
59
|
omit = ['*/tests/*']
|
|
61
60
|
|
|
62
|
-
[tool.
|
|
63
|
-
|
|
64
|
-
|
|
61
|
+
[tool.ruff.lint]
|
|
62
|
+
select = ["E", "F", "I", "S"]
|
|
63
|
+
ignore = ["E501"]
|
|
64
|
+
|
|
65
|
+
[tool.ruff.lint.per-file-ignores]
|
|
66
|
+
# Ignore `S101` (assert used violations) in all test files
|
|
67
|
+
"src/ewokssphinx/tests/*.py" = ["S101"]
|
|
68
|
+
|
|
69
|
+
[tool.ruff.lint.isort]
|
|
70
|
+
force-single-line = true
|
|
@@ -5,6 +5,7 @@ from sphinx.util.docutils import SphinxDirective
|
|
|
5
5
|
|
|
6
6
|
from .ewoks_task_utils import cached_tasks
|
|
7
7
|
from .ewoks_task_utils import discover_tasks
|
|
8
|
+
from .sphinx_task_utils import additional_model_nodes
|
|
8
9
|
from .sphinx_task_utils import task_nodes
|
|
9
10
|
|
|
10
11
|
logger = logging.getLogger(__name__)
|
|
@@ -42,4 +43,7 @@ class EwoksTaskDirective(SphinxDirective):
|
|
|
42
43
|
)
|
|
43
44
|
|
|
44
45
|
task_sections = task_nodes(self, tasks)
|
|
46
|
+
additional_model_section = additional_model_nodes(self, tasks)
|
|
47
|
+
if additional_model_section is not None:
|
|
48
|
+
return [*task_sections, additional_model_section]
|
|
45
49
|
return task_sections
|
|
@@ -9,6 +9,7 @@ from pydantic import BaseModel
|
|
|
9
9
|
from pydantic_core import PydanticUndefined
|
|
10
10
|
from sphinx.util.typing import stringify_annotation
|
|
11
11
|
|
|
12
|
+
from .type_utils import ParameterDescription
|
|
12
13
|
from .type_utils import TaskDescription
|
|
13
14
|
|
|
14
15
|
|
|
@@ -24,14 +25,14 @@ def discover_tasks(
|
|
|
24
25
|
task_name = _get_task_name(task["task_identifier"], task["task_type"])
|
|
25
26
|
|
|
26
27
|
if task.get("input_model"):
|
|
27
|
-
inputs =
|
|
28
|
+
inputs = parse_pydantic_model(task["input_model"])
|
|
28
29
|
else:
|
|
29
30
|
inputs = _parse_parameter_names(
|
|
30
31
|
task.get("required_input_names", []),
|
|
31
32
|
task.get("optional_input_names", []),
|
|
32
33
|
)
|
|
33
34
|
if task.get("output_model"):
|
|
34
|
-
outputs =
|
|
35
|
+
outputs = parse_pydantic_model(task["output_model"])
|
|
35
36
|
else:
|
|
36
37
|
outputs = _parse_parameter_names(task.get("output_names", []), [])
|
|
37
38
|
|
|
@@ -102,12 +103,14 @@ def _parse_parameter_names(
|
|
|
102
103
|
return parameters
|
|
103
104
|
|
|
104
105
|
|
|
105
|
-
def
|
|
106
|
+
def parse_pydantic_model(model: str | None) -> list[ParameterDescription]:
|
|
106
107
|
parameters = []
|
|
107
108
|
if model is None:
|
|
108
109
|
return parameters
|
|
109
110
|
|
|
110
111
|
model_cls = _import_model(model)
|
|
112
|
+
if not issubclass(model_cls, BaseModel):
|
|
113
|
+
raise ValueError("Not a pydantic model")
|
|
111
114
|
for name, field_info in model_cls.model_fields.items():
|
|
112
115
|
parameters.append(_parse_pydantic_field(name, field_info))
|
|
113
116
|
return parameters
|
|
@@ -123,7 +126,7 @@ def _parse_doc(text) -> str:
|
|
|
123
126
|
return inspect.cleandoc(text) if text else ""
|
|
124
127
|
|
|
125
128
|
|
|
126
|
-
def _parse_pydantic_field(name, field_info) ->
|
|
129
|
+
def _parse_pydantic_field(name, field_info) -> ParameterDescription:
|
|
127
130
|
examples = getattr(field_info, "examples", None)
|
|
128
131
|
default = getattr(field_info, "default", None)
|
|
129
132
|
if default is PydanticUndefined:
|
|
@@ -4,6 +4,8 @@ from typing import Sequence
|
|
|
4
4
|
from docutils import nodes
|
|
5
5
|
from sphinx.util.docutils import SphinxDirective
|
|
6
6
|
|
|
7
|
+
from .ewoks_task_utils import parse_pydantic_model
|
|
8
|
+
from .type_utils import ParameterDescription
|
|
7
9
|
from .type_utils import TaskDescription
|
|
8
10
|
|
|
9
11
|
|
|
@@ -45,39 +47,38 @@ def _task_section(directive: SphinxDirective, task: dict[str, Any]) -> nodes.sec
|
|
|
45
47
|
)
|
|
46
48
|
)
|
|
47
49
|
|
|
48
|
-
|
|
50
|
+
section.append(
|
|
51
|
+
_field_list(directive, {"inputs": task["inputs"], "outputs": task["outputs"]})
|
|
52
|
+
)
|
|
53
|
+
|
|
54
|
+
return section
|
|
55
|
+
|
|
56
|
+
|
|
57
|
+
def _field_list(
|
|
58
|
+
directive: SphinxDirective, field_categories: dict[str, list[ParameterDescription]]
|
|
59
|
+
) -> nodes.definition_list:
|
|
60
|
+
# Combine fields in a container so that
|
|
49
61
|
# Sphinx does not attach the "simple" CSS class.
|
|
50
62
|
io_def = nodes.container("")
|
|
51
|
-
|
|
63
|
+
|
|
64
|
+
for category, fields in field_categories.items():
|
|
65
|
+
if not fields:
|
|
66
|
+
continue
|
|
52
67
|
input_parameters = _parameter_nodes(
|
|
53
68
|
directive,
|
|
54
|
-
title="
|
|
55
|
-
css_classes=["field-odd"],
|
|
56
|
-
parameters=
|
|
57
|
-
is_outputs=
|
|
69
|
+
title=f"{category.capitalize()}:",
|
|
70
|
+
css_classes=["field-even" if len(io_def) % 2 == 0 else "field-odd"],
|
|
71
|
+
parameters=fields,
|
|
72
|
+
is_outputs=category == "outputs",
|
|
58
73
|
)
|
|
59
74
|
io_def.append(input_parameters)
|
|
60
75
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
css_classes=["field-even"],
|
|
66
|
-
parameters=task["outputs"],
|
|
67
|
-
is_outputs=True,
|
|
68
|
-
)
|
|
69
|
-
io_def.append(output_parameters)
|
|
70
|
-
|
|
71
|
-
section.append(
|
|
72
|
-
nodes.definition_list(
|
|
73
|
-
"",
|
|
74
|
-
io_def,
|
|
75
|
-
classes=["ewokssphinx-field-list"],
|
|
76
|
-
)
|
|
76
|
+
return nodes.definition_list(
|
|
77
|
+
"",
|
|
78
|
+
io_def,
|
|
79
|
+
classes=["ewokssphinx-field-list"],
|
|
77
80
|
)
|
|
78
81
|
|
|
79
|
-
return section
|
|
80
|
-
|
|
81
82
|
|
|
82
83
|
def _field_node(name: str, body: nodes.Element) -> nodes.field:
|
|
83
84
|
"""Construct a Sphinx field like: Identifier: my.module.Task"""
|
|
@@ -110,7 +111,7 @@ def _parameter_nodes(
|
|
|
110
111
|
directive: SphinxDirective,
|
|
111
112
|
title: str,
|
|
112
113
|
css_classes: list[str],
|
|
113
|
-
parameters:
|
|
114
|
+
parameters: list[ParameterDescription],
|
|
114
115
|
is_outputs: bool,
|
|
115
116
|
) -> nodes.definition_list_item:
|
|
116
117
|
|
|
@@ -127,7 +128,7 @@ def _parameter_nodes(
|
|
|
127
128
|
|
|
128
129
|
|
|
129
130
|
def _parameter_node(
|
|
130
|
-
directive: SphinxDirective, parameter:
|
|
131
|
+
directive: SphinxDirective, parameter: ParameterDescription, is_output: bool
|
|
131
132
|
) -> nodes.definition_list_item:
|
|
132
133
|
"""
|
|
133
134
|
Full parameter description structure:
|
|
@@ -190,3 +191,51 @@ def _examples_node(examples: list[Any]) -> nodes.container:
|
|
|
190
191
|
def _rst_to_nodes(directive: SphinxDirective, text: str) -> list[nodes.Node]:
|
|
191
192
|
# TODO: directives like ".. note::" still appear as plain text.
|
|
192
193
|
return directive.parse_text_to_nodes(text)
|
|
194
|
+
|
|
195
|
+
|
|
196
|
+
def _get_annotations(tasks: Sequence[dict[str, Any]]):
|
|
197
|
+
annotations: set[str] = set()
|
|
198
|
+
|
|
199
|
+
for task_dict in tasks:
|
|
200
|
+
task = TaskDescription(**task_dict)
|
|
201
|
+
parameters = task.inputs + task.outputs
|
|
202
|
+
for parameter in parameters:
|
|
203
|
+
annotation = parameter.annotation
|
|
204
|
+
if annotation is None:
|
|
205
|
+
continue
|
|
206
|
+
if "|" in annotation:
|
|
207
|
+
for a in annotation.split("|"):
|
|
208
|
+
annotations.add(a.strip())
|
|
209
|
+
else:
|
|
210
|
+
annotations.add(annotation)
|
|
211
|
+
|
|
212
|
+
# Enforce consistent ordering
|
|
213
|
+
return sorted(annotations)
|
|
214
|
+
|
|
215
|
+
|
|
216
|
+
def additional_model_nodes(
|
|
217
|
+
directive: SphinxDirective, tasks: Sequence[dict[str, Any]]
|
|
218
|
+
) -> nodes.section | None:
|
|
219
|
+
annotations = _get_annotations(tasks)
|
|
220
|
+
|
|
221
|
+
model_sections = []
|
|
222
|
+
for annotation in annotations:
|
|
223
|
+
try:
|
|
224
|
+
model = parse_pydantic_model(annotation)
|
|
225
|
+
except (ValueError, ModuleNotFoundError):
|
|
226
|
+
# Not a Pydantic model
|
|
227
|
+
continue
|
|
228
|
+
section = nodes.section("", ids=[annotation])
|
|
229
|
+
section.append(nodes.title("", annotation.split(".")[-1]))
|
|
230
|
+
|
|
231
|
+
section.append(_field_list(directive, {"fields": model}))
|
|
232
|
+
model_sections.append(section)
|
|
233
|
+
if not model_sections:
|
|
234
|
+
return None
|
|
235
|
+
|
|
236
|
+
return nodes.section(
|
|
237
|
+
"",
|
|
238
|
+
nodes.title("", "Additional models"),
|
|
239
|
+
*model_sections,
|
|
240
|
+
ids=["Additional models"],
|
|
241
|
+
)
|
|
@@ -22,7 +22,7 @@ def app_with_cache(tmp_path_factory):
|
|
|
22
22
|
json_cache_path = srcdir / "discovered_ewoks_tasks.json"
|
|
23
23
|
with open(srcdir / "conf.py", "w") as conf:
|
|
24
24
|
conf.write('extensions = ["ewokssphinx"]\n')
|
|
25
|
-
conf.write(f'ewokssphinx_task_cache_path = "{json_cache_path}"\n')
|
|
25
|
+
conf.write(f'ewokssphinx_task_cache_path = "{json_cache_path.as_posix()}"\n')
|
|
26
26
|
conf.write("ewokssphinx_ignore_discovery_error = True\n")
|
|
27
27
|
|
|
28
28
|
task = {
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
from typing import Literal
|
|
2
|
+
|
|
3
|
+
from ewokscore import Task
|
|
4
|
+
from ewokscore.model import BaseInputModel
|
|
5
|
+
from ewokscore.model import BaseOutputModel
|
|
6
|
+
from pydantic import BaseModel
|
|
7
|
+
from pydantic import Field
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class Coordinates(BaseModel):
|
|
11
|
+
planet: str = "Earth"
|
|
12
|
+
latitude: int = Field(examples=[-90, 0, 90])
|
|
13
|
+
longitude: float = Field(
|
|
14
|
+
description="Longitude of the GPS point. **In degrees.**", examples=[-90, 0, 90]
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
class Location(BaseModel):
|
|
19
|
+
location: str = Field(
|
|
20
|
+
..., description="Name of the closest city or location to the given coordinates"
|
|
21
|
+
)
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
class Inputs(BaseInputModel):
|
|
25
|
+
coordinates: Coordinates
|
|
26
|
+
vehicle: Literal["car", "bike", "bus"] = "car"
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
class Outputs(BaseOutputModel):
|
|
30
|
+
location: Location | Coordinates
|
|
31
|
+
time: str
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class ComputeTimeToGo(Task, input_model=Inputs, output_model=Outputs):
|
|
35
|
+
pass
|
{ewokssphinx-2.0.0 → ewokssphinx-2.2.0}/src/ewokssphinx/tests/test_task_directive_pydantic.py
RENAMED
|
@@ -2,6 +2,7 @@ from docutils import nodes
|
|
|
2
2
|
from sphinx.testing import restructuredtext
|
|
3
3
|
|
|
4
4
|
from .test_utils import assert_node
|
|
5
|
+
from .test_utils import assert_section
|
|
5
6
|
from .test_utils import assert_task_preamble
|
|
6
7
|
|
|
7
8
|
|
|
@@ -57,3 +58,21 @@ def test_ewokstasks_with_pydantic_input_model(app):
|
|
|
57
58
|
nodes.Text,
|
|
58
59
|
"Name of the closest city or location to the given coordinates",
|
|
59
60
|
)
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
def test_ewokstasks_with_nested_pydantic_model(app):
|
|
64
|
+
parsed_nodes = restructuredtext.parse(
|
|
65
|
+
app,
|
|
66
|
+
""".. ewokstasks:: ewokssphinx.tests.dummy_tasks_nested
|
|
67
|
+
:task-type: class
|
|
68
|
+
""",
|
|
69
|
+
)
|
|
70
|
+
|
|
71
|
+
assert len(parsed_nodes) == 2
|
|
72
|
+
task_section, model_section = parsed_nodes
|
|
73
|
+
assert_section(task_section, "ComputeTimeToGo")
|
|
74
|
+
|
|
75
|
+
assert len(model_section) == 3
|
|
76
|
+
assert_section(model_section, "Additional models")
|
|
77
|
+
assert_section(model_section[1], "Coordinates")
|
|
78
|
+
assert_section(model_section[2], "Location")
|
|
@@ -69,3 +69,8 @@ def assert_task_preamble(parsed_nodes, identifier, doc, task_type):
|
|
|
69
69
|
assert_node(field_list_nodes, nodes.field_list)
|
|
70
70
|
assert_field_node(field_list_nodes[0], name="Identifier", value=identifier)
|
|
71
71
|
assert_field_node(field_list_nodes[1], name="Task type", value=task_type)
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
def assert_section(node, title: str):
|
|
75
|
+
assert isinstance(node, nodes.section)
|
|
76
|
+
assert_node(node[0], nodes.title, title)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: ewokssphinx
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.2.0
|
|
4
4
|
Summary: Ewoks Sphinx directives
|
|
5
5
|
Author-email: ESRF <dau-pydev@esrf.fr>
|
|
6
6
|
License: # MIT License
|
|
7
7
|
|
|
8
|
-
**Copyright (c)
|
|
8
|
+
**Copyright (c) 2026 European Synchrotron Radiation Facility**
|
|
9
9
|
|
|
10
10
|
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
|
11
11
|
this software and associated documentation files (the "Software"), to deal in
|
|
@@ -24,11 +24,11 @@ License: # MIT License
|
|
|
24
24
|
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
25
25
|
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
26
26
|
|
|
27
|
-
Project-URL: Homepage, https://
|
|
28
|
-
Project-URL: Documentation, https://
|
|
29
|
-
Project-URL: Repository, https://
|
|
30
|
-
Project-URL: Issues, https://
|
|
31
|
-
Project-URL: Changelog, https://
|
|
27
|
+
Project-URL: Homepage, https://github.com/ewoks-kit/ewokssphinx/
|
|
28
|
+
Project-URL: Documentation, https://github.com/ewoks-kit/ewokssphinx/blob/main/README.md
|
|
29
|
+
Project-URL: Repository, https://github.com/ewoks-kit/ewokssphinx/
|
|
30
|
+
Project-URL: Issues, https://github.com/ewoks-kit/ewokssphinx/issues
|
|
31
|
+
Project-URL: Changelog, https://github.com/ewoks-kit/ewokssphinx/blob/main/CHANGELOG.md
|
|
32
32
|
Keywords: ewoks,sphinx
|
|
33
33
|
Classifier: Intended Audience :: Science/Research
|
|
34
34
|
Classifier: License :: OSI Approved :: MIT License
|
|
@@ -44,8 +44,7 @@ Provides-Extra: test
|
|
|
44
44
|
Requires-Dist: pytest>=7; extra == "test"
|
|
45
45
|
Provides-Extra: dev
|
|
46
46
|
Requires-Dist: ewokssphinx[test]; extra == "dev"
|
|
47
|
-
Requires-Dist:
|
|
48
|
-
Requires-Dist: flake8>=4; extra == "dev"
|
|
47
|
+
Requires-Dist: ruff; extra == "dev"
|
|
49
48
|
Provides-Extra: doc
|
|
50
49
|
Requires-Dist: ewokssphinx[test]; extra == "doc"
|
|
51
50
|
Requires-Dist: myst-parser; extra == "doc"
|
|
@@ -55,6 +54,14 @@ Dynamic: license-file
|
|
|
55
54
|
|
|
56
55
|
# ewokssphinx
|
|
57
56
|
|
|
57
|
+
|
|
58
|
+
[](https://github.com/ewoks-kit/ewokssphinx/actions/workflows/test.yml)
|
|
59
|
+
[](https://github.com/astral-sh/ruff)
|
|
60
|
+
[](https://github.com/ewoks-kit/ewokssphinx/blob/main/LICENSE.md)
|
|
61
|
+
[](https://codecov.io/gh/ewoks-kit/ewokssphinx)
|
|
62
|
+
[](https://ewokssphinx.readthedocs.io/en/latest/?badge=latest)
|
|
63
|
+
[](https://pypi.org/project/ewokssphinx/)
|
|
64
|
+
|
|
58
65
|
A set of Sphinx directives for Ewoks
|
|
59
66
|
|
|
60
67
|
## Quick start
|
|
@@ -15,6 +15,7 @@ src/ewokssphinx.egg-info/top_level.txt
|
|
|
15
15
|
src/ewokssphinx/tests/__init__.py
|
|
16
16
|
src/ewokssphinx/tests/conftest.py
|
|
17
17
|
src/ewokssphinx/tests/dummy_tasks.py
|
|
18
|
+
src/ewokssphinx/tests/dummy_tasks_nested.py
|
|
18
19
|
src/ewokssphinx/tests/dummy_tasks_pydantic.py
|
|
19
20
|
src/ewokssphinx/tests/test_task_cache.py
|
|
20
21
|
src/ewokssphinx/tests/test_task_directive.py
|
ewokssphinx-2.0.0/README.md
DELETED
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
# ewokssphinx
|
|
2
|
-
|
|
3
|
-
A set of Sphinx directives for Ewoks
|
|
4
|
-
|
|
5
|
-
## Quick start
|
|
6
|
-
|
|
7
|
-
```bash
|
|
8
|
-
pip install ewokssphinx
|
|
9
|
-
```
|
|
10
|
-
|
|
11
|
-
Then, add `ewokssphinx` to the list of `extensions` in the Sphinx configuration file:
|
|
12
|
-
|
|
13
|
-
```python
|
|
14
|
-
# conf.py
|
|
15
|
-
|
|
16
|
-
...
|
|
17
|
-
|
|
18
|
-
extensions = [
|
|
19
|
-
...,
|
|
20
|
-
"ewokssphinx"
|
|
21
|
-
]
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
## Documentation
|
|
25
|
-
|
|
26
|
-
[Full documentation](https://ewokssphinx.readthedocs.io/en/latest) with [examples](https://ewokssphinx.readthedocs.io/en/latest/examples.html)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|