cwl2markdown 0.1.0__py3-none-any.whl
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.
- cwl2markdown/__about__.py +17 -0
- cwl2markdown/__init__.py +19 -0
- cwl2markdown/plugin.py +271 -0
- cwl2markdown/templates/index.md +6 -0
- cwl2markdown/templates/metadata.md +42 -0
- cwl2markdown/templates/workflow.md +85 -0
- cwl2markdown-0.1.0.dist-info/METADATA +110 -0
- cwl2markdown-0.1.0.dist-info/RECORD +12 -0
- cwl2markdown-0.1.0.dist-info/WHEEL +4 -0
- cwl2markdown-0.1.0.dist-info/entry_points.txt +2 -0
- cwl2markdown-0.1.0.dist-info/licenses/LICENSE +201 -0
- cwl2markdown-0.1.0.dist-info/licenses/NOTICE +4 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# Copyright 2026 Transpiler-Mate
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""Package metadata for CWL 2 Markdown."""
|
|
16
|
+
|
|
17
|
+
__version__ = "0.1.0"
|
cwl2markdown/__init__.py
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# Copyright 2026 Transpiler-Mate
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""CWL to Markdown Transpiler-Mate Plugin."""
|
|
16
|
+
|
|
17
|
+
from cwl2markdown.__about__ import __version__
|
|
18
|
+
|
|
19
|
+
__all__ = ["__version__"]
|
cwl2markdown/plugin.py
ADDED
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
# Copyright 2026 Transpiler-Mate
|
|
2
|
+
#
|
|
3
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
|
4
|
+
# you may not use this file except in compliance with the License.
|
|
5
|
+
# You may obtain a copy of the License at
|
|
6
|
+
#
|
|
7
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
|
8
|
+
#
|
|
9
|
+
# Unless required by applicable law or agreed to in writing, software
|
|
10
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
11
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
|
+
# See the License for the specific language governing permissions and
|
|
13
|
+
# limitations under the License.
|
|
14
|
+
|
|
15
|
+
"""transpiler-mate plugin for CWL 2 Markdown."""
|
|
16
|
+
|
|
17
|
+
from __future__ import annotations
|
|
18
|
+
|
|
19
|
+
import time
|
|
20
|
+
import types
|
|
21
|
+
from datetime import datetime
|
|
22
|
+
from importlib.metadata import PackageNotFoundError, version
|
|
23
|
+
from pathlib import Path
|
|
24
|
+
from typing import TYPE_CHECKING, Annotated, Any, Union, get_args, get_origin
|
|
25
|
+
|
|
26
|
+
from cwl_utils.parser import Process, Workflow, cwl_v1_0, cwl_v1_1, cwl_v1_2
|
|
27
|
+
from jinja2 import Environment, PackageLoader, select_autoescape
|
|
28
|
+
from loguru import logger
|
|
29
|
+
from pydantic import BaseModel, ConfigDict, Field
|
|
30
|
+
from transpiler_mate.api import (
|
|
31
|
+
AuthorRole,
|
|
32
|
+
ContributorRole,
|
|
33
|
+
PluginExecutionError,
|
|
34
|
+
SoftwareApplication,
|
|
35
|
+
transpiler_plugin,
|
|
36
|
+
)
|
|
37
|
+
|
|
38
|
+
if TYPE_CHECKING:
|
|
39
|
+
from transpiler_mate.api import TranspilerContext
|
|
40
|
+
|
|
41
|
+
# START custom built-in functions to simplify the CWL rendering
|
|
42
|
+
|
|
43
|
+
# CWLtype to string methods
|
|
44
|
+
|
|
45
|
+
NA_ROLE = "N/A"
|
|
46
|
+
|
|
47
|
+
InputRecordSchema = (
|
|
48
|
+
cwl_v1_0.InputRecordSchema | cwl_v1_1.InputRecordSchema | cwl_v1_2.InputRecordSchema
|
|
49
|
+
)
|
|
50
|
+
|
|
51
|
+
SchemaDefRequirement = (
|
|
52
|
+
cwl_v1_0.SchemaDefRequirement
|
|
53
|
+
| cwl_v1_1.SchemaDefRequirement
|
|
54
|
+
| cwl_v1_2.SchemaDefRequirement
|
|
55
|
+
)
|
|
56
|
+
|
|
57
|
+
|
|
58
|
+
def normalize_author(
|
|
59
|
+
software_application: SoftwareApplication,
|
|
60
|
+
) -> list[AuthorRole]:
|
|
61
|
+
"""Return application authors as role models for template rendering."""
|
|
62
|
+
authors = software_application.author
|
|
63
|
+
author_list = authors if isinstance(authors, list) else [authors]
|
|
64
|
+
return [
|
|
65
|
+
author
|
|
66
|
+
if isinstance(author, AuthorRole)
|
|
67
|
+
else AuthorRole(role_name=NA_ROLE, author=author)
|
|
68
|
+
for author in author_list
|
|
69
|
+
]
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
def normalize_contributor(
|
|
73
|
+
software_application: SoftwareApplication,
|
|
74
|
+
) -> list[ContributorRole]:
|
|
75
|
+
"""Return application contributors as role models for template rendering."""
|
|
76
|
+
contributors = software_application.contributor
|
|
77
|
+
if contributors is None:
|
|
78
|
+
return []
|
|
79
|
+
|
|
80
|
+
contributor_list = (
|
|
81
|
+
contributors if isinstance(contributors, list) else [contributors]
|
|
82
|
+
)
|
|
83
|
+
return [
|
|
84
|
+
contributor
|
|
85
|
+
if isinstance(contributor, ContributorRole)
|
|
86
|
+
else ContributorRole(role_name=NA_ROLE, contributor=contributor)
|
|
87
|
+
for contributor in contributor_list
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def type_to_string(typ: Any, parent: Process) -> str: # noqa: C901
|
|
92
|
+
"""
|
|
93
|
+
Serializes a CWL type to a human-readable string.
|
|
94
|
+
|
|
95
|
+
Args:
|
|
96
|
+
`typ` (`Any`): Any CWL type
|
|
97
|
+
|
|
98
|
+
Returns:
|
|
99
|
+
`str`: The human-readable string representing the input CWL type.
|
|
100
|
+
"""
|
|
101
|
+
if get_origin(typ) in (Union, types.UnionType):
|
|
102
|
+
return f"One of:<ul>{''.join(f'<li>{type_to_string(inner_type, parent)}</li>' for inner_type in get_args(typ))}</ul>"
|
|
103
|
+
|
|
104
|
+
if isinstance(typ, list):
|
|
105
|
+
return f"One of:<ul>{''.join(f'<li>{type_to_string(t, parent)}</li>' for t in typ)}</ul>"
|
|
106
|
+
|
|
107
|
+
if hasattr(typ, "items"):
|
|
108
|
+
return f"`array` of {type_to_string(typ.items, parent)}"
|
|
109
|
+
|
|
110
|
+
if isinstance(typ, InputRecordSchema):
|
|
111
|
+
fields = (
|
|
112
|
+
"".join(
|
|
113
|
+
f"<li>`{field.name.split('/')[-1]}`: {type_to_string(field.type_, parent)}</li>"
|
|
114
|
+
for field in typ.fields
|
|
115
|
+
)
|
|
116
|
+
if typ.fields
|
|
117
|
+
else ""
|
|
118
|
+
)
|
|
119
|
+
|
|
120
|
+
return f"[{typ.name.split('#')[-1]}]({typ.name}):<ul>{fields}</ul>"
|
|
121
|
+
|
|
122
|
+
if isinstance(typ, str):
|
|
123
|
+
type_str = typ
|
|
124
|
+
elif hasattr(typ, "__name__"):
|
|
125
|
+
type_str = typ.__name__
|
|
126
|
+
elif hasattr(typ, "type_"):
|
|
127
|
+
type_str = typ.type_
|
|
128
|
+
else:
|
|
129
|
+
# last hope to follow back
|
|
130
|
+
type_str = str(typ)
|
|
131
|
+
|
|
132
|
+
if "#" in type_str: # we can assume it is an URL
|
|
133
|
+
if parent and parent.requirements:
|
|
134
|
+
for requirement in parent.requirements:
|
|
135
|
+
if isinstance(requirement, SchemaDefRequirement):
|
|
136
|
+
for inner_type in requirement.types:
|
|
137
|
+
if type_str == inner_type.name:
|
|
138
|
+
return type_to_string(inner_type, parent)
|
|
139
|
+
|
|
140
|
+
# follow up on plain link if not found
|
|
141
|
+
return f"[{type_str.split('#')[-1]}]({type_str})"
|
|
142
|
+
|
|
143
|
+
for special_type in ["Any", "Directory", "File"]:
|
|
144
|
+
if special_type == type_str:
|
|
145
|
+
return (
|
|
146
|
+
f"[{type_str}](https://www.commonwl.org/v1.2/Workflow.html#{type_str})"
|
|
147
|
+
)
|
|
148
|
+
|
|
149
|
+
if type_str == "enum":
|
|
150
|
+
symbols = "".join(
|
|
151
|
+
f"<li>`{symbol.split('/')[-1]}`</li>"
|
|
152
|
+
for symbol in typ.symbols # type: ignore
|
|
153
|
+
)
|
|
154
|
+
return f"[{type_str}](https://www.commonwl.org/v1.2/Workflow.html#{type(typ).__name__}):<ul>{symbols}</ul>"
|
|
155
|
+
|
|
156
|
+
return f"[{type_str}](https://www.commonwl.org/v1.2/Workflow.html#CWLType)"
|
|
157
|
+
|
|
158
|
+
|
|
159
|
+
def _get_version() -> str:
|
|
160
|
+
try:
|
|
161
|
+
return version("cwl2markdown")
|
|
162
|
+
except PackageNotFoundError:
|
|
163
|
+
return "N/A"
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
def _to_mapping(functions: list[Any]) -> dict[str, Any]:
|
|
167
|
+
mapping: dict[str, Any] = {}
|
|
168
|
+
|
|
169
|
+
for function in functions:
|
|
170
|
+
mapping[function.__name__] = function
|
|
171
|
+
|
|
172
|
+
return mapping
|
|
173
|
+
|
|
174
|
+
|
|
175
|
+
def nullable(type_: Any) -> bool:
|
|
176
|
+
return (
|
|
177
|
+
isinstance(type_, list)
|
|
178
|
+
and "null" in type_
|
|
179
|
+
or hasattr(type_, "items")
|
|
180
|
+
and nullable(type_.items) # type: ignore
|
|
181
|
+
)
|
|
182
|
+
|
|
183
|
+
|
|
184
|
+
def get_exection_command(clt: Any) -> str:
|
|
185
|
+
result: list[str] = []
|
|
186
|
+
|
|
187
|
+
def _append_arg(arg: Any):
|
|
188
|
+
if isinstance(arg, list):
|
|
189
|
+
for arg_i in arg:
|
|
190
|
+
_append_arg(arg_i)
|
|
191
|
+
elif isinstance(arg, str):
|
|
192
|
+
result.append(arg)
|
|
193
|
+
else:
|
|
194
|
+
result.append("<ARGUMENT_DYNAMICALLY_SET>")
|
|
195
|
+
|
|
196
|
+
def _check_then_append(arg_name: str):
|
|
197
|
+
if hasattr(clt, arg_name) and getattr(clt, arg_name):
|
|
198
|
+
_append_arg(getattr(clt, arg_name))
|
|
199
|
+
|
|
200
|
+
_check_then_append("baseCommand")
|
|
201
|
+
_check_then_append("arguments")
|
|
202
|
+
|
|
203
|
+
return " ".join(result)
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
# END
|
|
207
|
+
|
|
208
|
+
|
|
209
|
+
class CWL2MarkdownOptions(BaseModel):
|
|
210
|
+
"""Options accepted by the CWL 2 Markdown plugin."""
|
|
211
|
+
|
|
212
|
+
model_config = ConfigDict(extra="forbid")
|
|
213
|
+
|
|
214
|
+
output: Annotated[
|
|
215
|
+
Path, Field(default=Path("./"), description="The output directory path")
|
|
216
|
+
]
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
@transpiler_plugin(
|
|
220
|
+
name="cwl2markdown",
|
|
221
|
+
description="CWL to Markdown Transpiler-Mate Plugin.",
|
|
222
|
+
options_model=CWL2MarkdownOptions,
|
|
223
|
+
)
|
|
224
|
+
def cwl2markdown(context: TranspilerContext, options: CWL2MarkdownOptions) -> None:
|
|
225
|
+
"""CWL to Markdown Transpiler-Mate Plugin."""
|
|
226
|
+
_jinja_environment = Environment(
|
|
227
|
+
loader=PackageLoader(package_name="cwl2markdown"),
|
|
228
|
+
autoescape=select_autoescape(),
|
|
229
|
+
)
|
|
230
|
+
_jinja_environment.globals["type_to_string"] = type_to_string
|
|
231
|
+
_jinja_environment.filters.update(
|
|
232
|
+
_to_mapping(
|
|
233
|
+
[
|
|
234
|
+
get_exection_command,
|
|
235
|
+
normalize_author,
|
|
236
|
+
normalize_contributor,
|
|
237
|
+
]
|
|
238
|
+
)
|
|
239
|
+
)
|
|
240
|
+
_jinja_environment.tests.update(_to_mapping([nullable]))
|
|
241
|
+
|
|
242
|
+
template = _jinja_environment.get_template("index.md")
|
|
243
|
+
|
|
244
|
+
try:
|
|
245
|
+
options.output.mkdir(parents=True, exist_ok=True)
|
|
246
|
+
|
|
247
|
+
for workflow in context.get_processes_by_type(
|
|
248
|
+
Workflow, [context.process_id] if context.process_id else None
|
|
249
|
+
):
|
|
250
|
+
target: Path = Path(options.output, f"{workflow.id}.md")
|
|
251
|
+
logger.info(f"Rendering Markdown documentation to {target.absolute()}...")
|
|
252
|
+
|
|
253
|
+
with target.open("w") as output_stream:
|
|
254
|
+
output_stream.write(
|
|
255
|
+
template.render(
|
|
256
|
+
version=_get_version(),
|
|
257
|
+
timestamp=datetime.fromtimestamp(time.time()).isoformat(
|
|
258
|
+
timespec="milliseconds"
|
|
259
|
+
),
|
|
260
|
+
software_application=context.metadata,
|
|
261
|
+
workflow=workflow,
|
|
262
|
+
index=context.document,
|
|
263
|
+
)
|
|
264
|
+
)
|
|
265
|
+
logger.success(
|
|
266
|
+
f"Markdown documentation successfully serialized to {target.absolute()}"
|
|
267
|
+
)
|
|
268
|
+
except Exception as e:
|
|
269
|
+
raise PluginExecutionError(
|
|
270
|
+
f"An error occurred when serializing to {options.output.absolute()}, see nested exception"
|
|
271
|
+
) from e
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
# {{software_application.name}} v{{software_application.software_version}}
|
|
2
|
+
|
|
3
|
+
{{software_application.description}}
|
|
4
|
+
|
|
5
|
+
> This software is licensed under the terms of the [{{software_application.license.name}}]({{software_application.license.url}}) license - SPDX short identifier: [{{software_application.license.identifier}}](https://spdx.org/licenses/{{software_application.license.identifier}})
|
|
6
|
+
>
|
|
7
|
+
> {{software_application.date_created}} - {{timestamp}} Copyright [{{software_application.publisher.name}}](mailto:{{software_application.publisher.email}}) - {% if software_application.publisher.identifier %}> [{{software_application.publisher.identifier}}]({{software_application.publisher.identifier}}){% endif %}
|
|
8
|
+
|
|
9
|
+
## Project Team
|
|
10
|
+
|
|
11
|
+
### Authors
|
|
12
|
+
|
|
13
|
+
| Name | Email | Organization | Role | Identifier |
|
|
14
|
+
|------|-------|--------------|------|------------|
|
|
15
|
+
{% for role in software_application | normalize_author %}| {{role.author.family_name}}, {{role.author.given_name}} | [{{role.author.email}}](mailto:{{role.author.email}}) | [{{role.author.affiliation.name}}]({{role.author.affiliation.identifier}}) | [{{role.role_name}}]({{role.additional_type}}) | [{{role.author.identifier}}]({{role.author.identifier}}) |
|
|
16
|
+
{% endfor %}
|
|
17
|
+
|
|
18
|
+
### Contributors
|
|
19
|
+
{% if software_application.contributor %}
|
|
20
|
+
| Name | Email | Organization | Role | Identifier |
|
|
21
|
+
|------|-------|--------------|------|------------|
|
|
22
|
+
{% for role in software_application | normalize_contributor %}| {{role.contributor.family_name}}, {{role.contributor.given_name}} | [{{role.contributor.email}}](mailto:{{role.contributor.email}}) | [{{role.contributor.affiliation.name}}]({{role.contributor.affiliation.identifier}}) | [{{role.role_name}}]({{role.additional_type}}) | [{{role.contributor.identifier}}]({{role.contributor.identifier}}) |
|
|
23
|
+
{% endfor %}
|
|
24
|
+
{% else %}
|
|
25
|
+
The are no contributors for this project.
|
|
26
|
+
{% endif %}
|
|
27
|
+
|
|
28
|
+
{% if software_application.software_help %}## {{software_application.software_help.name}}
|
|
29
|
+
|
|
30
|
+
{{software_application.software_help.name}} can be found on [{{software_application.software_help.url}}]({{software_application.software_help.url}}).
|
|
31
|
+
{% endif %}
|
|
32
|
+
|
|
33
|
+
## Runtime environment
|
|
34
|
+
|
|
35
|
+
### Supported Operating Systems
|
|
36
|
+
|
|
37
|
+
{% for operating_system in software_application.operating_system %}- {{operating_system}}
|
|
38
|
+
{% endfor %}
|
|
39
|
+
### Requirements
|
|
40
|
+
|
|
41
|
+
{% for software_requirement in software_application.software_requirements %}- [{{software_requirement}}]({{software_requirement}})
|
|
42
|
+
{% endfor %}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
{% macro serialize_clt(clt) -%}## {{clt.id}}
|
|
2
|
+
|
|
3
|
+
### CWL Class
|
|
4
|
+
|
|
5
|
+
[{{clt.class_}}](https://www.commonwl.org/{{clt.cwlVersion}}/{% if "ExpressionTool" == clt.class_ %}Workflow{% else %}{{clt.class_}}{% endif %}.html#{{clt.class_}})
|
|
6
|
+
|
|
7
|
+
### Inputs
|
|
8
|
+
|
|
9
|
+
| Id | Option | Type |
|
|
10
|
+
|----|------|-------|
|
|
11
|
+
{% for input in clt.inputs %}| `{{input.id}}` | `{% if input.inputBinding.prefix %}{{input.inputBinding.prefix}}{% else %}--{{input.id}}{% endif %}` | {{ type_to_string(input.type_, clt) }} |
|
|
12
|
+
{% endfor %}
|
|
13
|
+
{% if "CommandLineTool" == clt.class_ %}### Execution usage example:
|
|
14
|
+
|
|
15
|
+
```
|
|
16
|
+
{{clt | get_exection_command}} \
|
|
17
|
+
{% for input in clt.inputs %}{% if input.type_ is nullable %}({% endif %}{% if input.inputBinding.prefix %}{{input.inputBinding.prefix}}{% else %}--{{input.id}}{% endif %} <{{input.id.upper()}}>{% if input.type_ is nullable %}){% endif %}{% if not loop.last %} \{% endif %}
|
|
18
|
+
{% endfor %}```{% endif %}
|
|
19
|
+
{%- endmacro %}
|
|
20
|
+
|
|
21
|
+
{% macro serialize_workflow(workflow) -%}## {{workflow.id}}
|
|
22
|
+
|
|
23
|
+
### CWL Class
|
|
24
|
+
|
|
25
|
+
[{{workflow.class_}}](https://www.commonwl.org/{{workflow.cwlVersion}}/{{workflow.class_}}.html#{{workflow.class_}})
|
|
26
|
+
|
|
27
|
+
{% if workflow.requirements %}### Requirements
|
|
28
|
+
{% for requirement in workflow.requirements %}
|
|
29
|
+
* [{{requirement.class_}}](https://www.commonwl.org/{{workflow.cwlVersion}}/{{workflow.class_}}.html#{{requirement.class_}}){% endfor %}{% endif %}
|
|
30
|
+
|
|
31
|
+
### Inputs
|
|
32
|
+
|
|
33
|
+
| Id | Type | Label | Doc |
|
|
34
|
+
|----|------|-------|-----|
|
|
35
|
+
{% for input in workflow.inputs %}| `{{input.id}}` | {{ type_to_string(input.type_, workflow) }} | {{input.label}} | {{input.doc}} |
|
|
36
|
+
{% endfor %}
|
|
37
|
+
|
|
38
|
+
### Steps
|
|
39
|
+
|
|
40
|
+
| Id | Runs | Label | Doc |
|
|
41
|
+
|----|------|-------|-----|
|
|
42
|
+
{% for step in workflow.steps %}| [{{step.id}}](#{{step.run[1:]}}) | `{{step.run}}` | {{step.label}} | {{step.doc}} |
|
|
43
|
+
{% endfor %}
|
|
44
|
+
|
|
45
|
+
### Outputs
|
|
46
|
+
|
|
47
|
+
| Id | Type | Label | Doc |
|
|
48
|
+
|----|------|-------|-----|
|
|
49
|
+
{% for output in workflow.outputs %}| `{{output.id}}` | {{ type_to_string(output.type_, clt) }} | {{output.label}} | {{output.doc}} |
|
|
50
|
+
{% endfor %}
|
|
51
|
+
|
|
52
|
+
### OGC API - Processes
|
|
53
|
+
|
|
54
|
+
When `{{ workflow.id }}` [{{workflow.class_}}](https://www.commonwl.org/{{workflow.cwlVersion}}/{{workflow.class_}}.html#{{workflow.class_}}) is exposed through [OGC API - Processes - Part 1: Core](https://docs.ogc.org/is/18-062r2/18-062r2.html), `inputs` and `outputs` fields below represent the interface of the [getProcessDescription](https://developer.ogc.org/api/processes/index.html#tag/ProcessDescription/operation/getProcessDescription) API.
|
|
55
|
+
|
|
56
|
+
{% set ogc_processes_kinds=['Inputs', 'Outputs'] %}
|
|
57
|
+
{% for ogc_processes_kind in ogc_processes_kinds %}
|
|
58
|
+
#### {{ogc_processes_kind}}
|
|
59
|
+
|
|
60
|
+

|
|
61
|
+
{% endfor %}
|
|
62
|
+
|
|
63
|
+
### UML Diagrams
|
|
64
|
+
{% set diagrams=['Activity', 'Component', 'Class', 'Sequence', 'State'] %}
|
|
65
|
+
{% for diagram in diagrams %}
|
|
66
|
+
#### {{diagram}} diagram
|
|
67
|
+
|
|
68
|
+
Learn more about the [{{diagram}} diagram](https://en.wikipedia.org/wiki/{{diagram}}_diagram) below.
|
|
69
|
+
|
|
70
|
+

|
|
71
|
+
{% endfor %}
|
|
72
|
+
|
|
73
|
+
{% for step in workflow.steps %}### Run in step
|
|
74
|
+
|
|
75
|
+
`{{step.id}}`
|
|
76
|
+
|
|
77
|
+
{% set resolved_step = index.get(step.run[1:]) %}
|
|
78
|
+
{% if "Workflow" == resolved_step.class_ %}
|
|
79
|
+
{{serialize_workflow(resolved_step)}}
|
|
80
|
+
{% else %}
|
|
81
|
+
{{serialize_clt(resolved_step)}}
|
|
82
|
+
{% endif %}
|
|
83
|
+
{% endfor %}
|
|
84
|
+
|
|
85
|
+
{%- endmacro %}
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: cwl2markdown
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: CWL to Markdown Transpiler-Mate Plugin.
|
|
5
|
+
Project-URL: Homepage, https://github.com/Transpiler-Mate/cwl2markdown
|
|
6
|
+
Project-URL: Documentation, https://Transpiler-Mate.github.io/cwl2markdown/
|
|
7
|
+
Project-URL: Repository, https://github.com/Transpiler-Mate/cwl2markdown
|
|
8
|
+
Project-URL: Issues, https://github.com/Transpiler-Mate/cwl2markdown/issues
|
|
9
|
+
Project-URL: Changelog, https://github.com/Transpiler-Mate/cwl2markdown/blob/main/CHANGELOG.md
|
|
10
|
+
Author-email: Transpiler-Mate <info@terradue.com>
|
|
11
|
+
License-Expression: Apache-2.0
|
|
12
|
+
License-File: LICENSE
|
|
13
|
+
License-File: NOTICE
|
|
14
|
+
Classifier: Development Status :: 4 - Beta
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
17
|
+
Classifier: Programming Language :: Python
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
22
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
23
|
+
Classifier: Programming Language :: Python :: Implementation :: CPython
|
|
24
|
+
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
|
25
|
+
Requires-Python: >=3.10
|
|
26
|
+
Requires-Dist: jinja2>=3.1.6
|
|
27
|
+
Requires-Dist: loguru==0.7.3
|
|
28
|
+
Requires-Dist: transpiler-mate-api==1.0.0
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
<!--
|
|
32
|
+
Copyright 2026 Transpiler-Mate
|
|
33
|
+
|
|
34
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
35
|
+
you may not use this file except in compliance with the License.
|
|
36
|
+
You may obtain a copy of the License at
|
|
37
|
+
|
|
38
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
39
|
+
|
|
40
|
+
Unless required by applicable law or agreed to in writing, software
|
|
41
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
42
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
43
|
+
See the License for the specific language governing permissions and
|
|
44
|
+
limitations under the License.
|
|
45
|
+
-->
|
|
46
|
+
|
|
47
|
+
# CWL 2 Markdown
|
|
48
|
+
|
|
49
|
+
[](https://pypi.org/project/cwl2markdown)
|
|
50
|
+
[](https://pypi.org/project/cwl2markdown)
|
|
51
|
+
|
|
52
|
+
CWL to Markdown Transpiler-Mate plugin. It generates one Markdown page per CWL
|
|
53
|
+
workflow and renders document-level Schema.org `SoftwareApplication` metadata.
|
|
54
|
+
|
|
55
|
+
## Quick start
|
|
56
|
+
|
|
57
|
+
Install the plugin and runtime in the same Python environment:
|
|
58
|
+
|
|
59
|
+
```console
|
|
60
|
+
python -m pip install cwl2markdown transpiler-mate-runtime
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
Generate pages from a metadata-bearing CWL document:
|
|
64
|
+
|
|
65
|
+
```console
|
|
66
|
+
transpiler-mate cwl2markdown --output build/docs workflow.cwl
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
See the [first-steps tutorial](https://Transpiler-Mate.github.io/cwl2markdown/tutorials/first-steps/)
|
|
70
|
+
for a complete Schema.org metadata example.
|
|
71
|
+
|
|
72
|
+
## Project conventions
|
|
73
|
+
|
|
74
|
+
This project is templated a Hatch-based Python package with:
|
|
75
|
+
|
|
76
|
+
- Apache-2.0 license
|
|
77
|
+
- Keep a Changelog-compatible `CHANGELOG.md`
|
|
78
|
+
- Diátaxis documentation under `docs/`
|
|
79
|
+
- top-level `mkdocs.yaml`
|
|
80
|
+
- Taskfile integration with `Terradue/taskfile-utils`
|
|
81
|
+
- GitHub Actions CI
|
|
82
|
+
|
|
83
|
+
## Documentation
|
|
84
|
+
|
|
85
|
+
Project documentation is published at: https://Transpiler-Mate.github.io/cwl2markdown/
|
|
86
|
+
|
|
87
|
+
## Contribute
|
|
88
|
+
|
|
89
|
+
Submit a [Github issue](https://github.com/Transpiler-Mate/cwl2markdown/issues) if you have comments or suggestions.
|
|
90
|
+
|
|
91
|
+
### Local quality checks
|
|
92
|
+
|
|
93
|
+
Install [Hatch](https://hatch.pypa.io/) and [Taskfiles](https://taskfile.dev/docs/guide) then install the Git hook:
|
|
94
|
+
|
|
95
|
+
```console
|
|
96
|
+
task quality:pre-commit:install
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
Every commit runs Ruff (including the configured McCabe complexity limit),
|
|
100
|
+
Ruff formatting, strict mypy checks, and the pytest suite.
|
|
101
|
+
|
|
102
|
+
Run the complete hook explicitly with:
|
|
103
|
+
|
|
104
|
+
```console
|
|
105
|
+
task quality:pre-commit:run
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
## License
|
|
109
|
+
|
|
110
|
+
[](https://www.apache.org/licenses/LICENSE-2.0)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
cwl2markdown/__about__.py,sha256=EOMHTlOMF2TE_xQWaNS-pgk1iq3qnVY4D8IqqAQpfp8,646
|
|
2
|
+
cwl2markdown/__init__.py,sha256=rmNeN4EKY0ymSzgx_AqUKvrcKai899-oTwnE7j7J7eY,701
|
|
3
|
+
cwl2markdown/plugin.py,sha256=DenrAKmng6AkIpf2jodygZBCNxQWAnX0plIkToRA2i0,8534
|
|
4
|
+
cwl2markdown/templates/index.md,sha256=uv8BpRopg-G5rRpRkWRfoLWVlYYpuTfNI4F5SEiGojc,116
|
|
5
|
+
cwl2markdown/templates/metadata.md,sha256=P_Eo9Dx1MoLCbSCqhZfiXf7LfaMZuco9OlnYpgBPp8c,2440
|
|
6
|
+
cwl2markdown/templates/workflow.md,sha256=UnzqfnrcqfW9VX0wpc6wCgBSiaBsg91j9GD7kRBr210,3443
|
|
7
|
+
cwl2markdown-0.1.0.dist-info/METADATA,sha256=3FU1EAOb4KyY3YOMWJM3_BVlJvZqnIJKzgtAGTgOE8k,3880
|
|
8
|
+
cwl2markdown-0.1.0.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
|
|
9
|
+
cwl2markdown-0.1.0.dist-info/entry_points.txt,sha256=k12EIdeM7XrwFzHrN-dsg_8Y7alUeS3O0bz_CVX8RF8,74
|
|
10
|
+
cwl2markdown-0.1.0.dist-info/licenses/LICENSE,sha256=zEL5m3QzRfQ6NaRevd5g8fAsNu3v4X07WCQ6Gr5tyFw,11350
|
|
11
|
+
cwl2markdown-0.1.0.dist-info/licenses/NOTICE,sha256=6Wy8xbC6mXbtsETj-VJw8c646IIzRL-dDGGg-KiIu3A,108
|
|
12
|
+
cwl2markdown-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Transpiler-Mate
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|