transpiler-mate-runtime 1.0.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.
Files changed (38) hide show
  1. transpiler_mate_runtime-1.0.0/.gitignore +9 -0
  2. transpiler_mate_runtime-1.0.0/LICENSE +201 -0
  3. transpiler_mate_runtime-1.0.0/PKG-INFO +27 -0
  4. transpiler_mate_runtime-1.0.0/README.md +12 -0
  5. transpiler_mate_runtime-1.0.0/docs/examples/hello.cwl +31 -0
  6. transpiler_mate_runtime-1.0.0/docs/explanation/architecture.md +41 -0
  7. transpiler_mate_runtime-1.0.0/docs/explanation/cwl-metadata.md +47 -0
  8. transpiler_mate_runtime-1.0.0/docs/explanation/index.md +8 -0
  9. transpiler_mate_runtime-1.0.0/docs/explanation/plugin-lifecycle.md +47 -0
  10. transpiler_mate_runtime-1.0.0/docs/how-to/access-remote-sources.md +59 -0
  11. transpiler_mate_runtime-1.0.0/docs/how-to/bundle-a-cwl-document.md +64 -0
  12. transpiler_mate_runtime-1.0.0/docs/how-to/index.md +8 -0
  13. transpiler_mate_runtime-1.0.0/docs/how-to/register-a-plugin.md +72 -0
  14. transpiler_mate_runtime-1.0.0/docs/how-to/select-a-process.md +31 -0
  15. transpiler_mate_runtime-1.0.0/docs/index.md +30 -0
  16. transpiler_mate_runtime-1.0.0/docs/reference/bundle-plugin.md +37 -0
  17. transpiler_mate_runtime-1.0.0/docs/reference/cli.md +69 -0
  18. transpiler_mate_runtime-1.0.0/docs/reference/context-resolution.md +62 -0
  19. transpiler_mate_runtime-1.0.0/docs/reference/errors-and-exit-codes.md +45 -0
  20. transpiler_mate_runtime-1.0.0/docs/reference/index.md +9 -0
  21. transpiler_mate_runtime-1.0.0/docs/reference/plugin-loading.md +52 -0
  22. transpiler_mate_runtime-1.0.0/docs/tutorials/getting-started.md +115 -0
  23. transpiler_mate_runtime-1.0.0/docs/tutorials/index.md +7 -0
  24. transpiler_mate_runtime-1.0.0/mkdocs.yaml +51 -0
  25. transpiler_mate_runtime-1.0.0/pyproject.toml +161 -0
  26. transpiler_mate_runtime-1.0.0/src/transpiler_mate/__about__.py +18 -0
  27. transpiler_mate_runtime-1.0.0/src/transpiler_mate/plugins/__init__.py +15 -0
  28. transpiler_mate_runtime-1.0.0/src/transpiler_mate/plugins/bundle.py +69 -0
  29. transpiler_mate_runtime-1.0.0/src/transpiler_mate/runtime/__init__.py +15 -0
  30. transpiler_mate_runtime-1.0.0/src/transpiler_mate/runtime/cli.py +510 -0
  31. transpiler_mate_runtime-1.0.0/src/transpiler_mate/runtime/context_resolver.py +107 -0
  32. transpiler_mate_runtime-1.0.0/src/transpiler_mate/runtime/plugin_loader.py +204 -0
  33. transpiler_mate_runtime-1.0.0/src/transpiler_mate/runtime/software_application_extractor.py +119 -0
  34. transpiler_mate_runtime-1.0.0/tests/test_bundle.py +114 -0
  35. transpiler_mate_runtime-1.0.0/tests/test_cli.py +430 -0
  36. transpiler_mate_runtime-1.0.0/tests/test_namespace.py +32 -0
  37. transpiler_mate_runtime-1.0.0/tests/test_plugin_loader.py +199 -0
  38. transpiler_mate_runtime-1.0.0/tests/test_software_application_extractor.py +103 -0
@@ -0,0 +1,9 @@
1
+ .task
2
+ .venv
3
+ __pycache__
4
+ uv.lock
5
+ .mypy_cache
6
+ .pytest_cache
7
+ .ruff_cache
8
+ .vscode
9
+ site
@@ -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 [yyyy] [name of copyright owner]
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.
@@ -0,0 +1,27 @@
1
+ Metadata-Version: 2.5
2
+ Name: transpiler-mate-runtime
3
+ Version: 1.0.0
4
+ Summary: Runtime discovery, execution, and CLI adapter for transpiler-mate plugins
5
+ Project-URL: Documentation, https://terradue.github.io/transpiler-mate-runtime/
6
+ Project-URL: Issues, https://github.com/Terradue/transpiler-mate-runtime/issues
7
+ Project-URL: Source, https://github.com/Terradue/transpiler-mate-runtime
8
+ Author-email: Simone Tripodi <simone.tripodi@terradue.com>, Fabrice Brito <fabrice.brito@terradue.com>
9
+ License-Expression: Apache-2.0
10
+ License-File: LICENSE
11
+ Classifier: Development Status :: 4 - Beta
12
+ Classifier: Programming Language :: Python
13
+ Classifier: Programming Language :: Python :: 3.10
14
+ Classifier: Programming Language :: Python :: 3.11
15
+ Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
17
+ Classifier: Programming Language :: Python :: 3.14
18
+ Classifier: Programming Language :: Python :: Implementation :: CPython
19
+ Classifier: Programming Language :: Python :: Implementation :: PyPy
20
+ Requires-Python: >=3.10
21
+ Requires-Dist: click<9,>=8.4.2
22
+ Requires-Dist: cwl-loader>=0.25.0
23
+ Requires-Dist: loguru==0.7.3
24
+ Requires-Dist: pydantic<3,>=2.13.4
25
+ Requires-Dist: pyld>=3.1.0
26
+ Requires-Dist: session-adapters>=0.5.0
27
+ Requires-Dist: transpiler-mate-api==1.0.0
@@ -0,0 +1,12 @@
1
+ # transpiler-mate-runtime
2
+
3
+ [![PyPI - Version](https://img.shields.io/pypi/v/transpiler-mate-runtime.svg)](https://pypi.org/project/transpiler-mate-runtime)
4
+ [![PyPI - Python Version](https://img.shields.io/pypi/pyversions/transpiler-mate-runtime.svg)](https://pypi.org/project/transpiler-mate-runtime)
5
+
6
+ Runtime implementation for discovering and invoking `transpiler-mate-api` plugins.
7
+
8
+ Click is confined to this distribution. Plugin packages depend on `transpiler-mate-api`, not on this package.
9
+
10
+ ## License
11
+
12
+ [![Apache License, Version 2.0](https://img.shields.io/badge/license-Apache%20License%202.0-blue)](https://www.apache.org/licenses/LICENSE-2.0)
@@ -0,0 +1,31 @@
1
+ cwlVersion: v1.2
2
+ class: CommandLineTool
3
+ $namespaces:
4
+ s: https://schema.org/
5
+ s:name: Hello tool
6
+ s:description: Print a greeting
7
+ s:dateCreated: "2026-08-24"
8
+ s:license: https://spdx.org/licenses/Apache-2.0
9
+ s:softwareVersion: 1.0.0
10
+ s:softwareHelp:
11
+ s:name: Hello tool documentation
12
+ s:url: https://example.org/hello/help
13
+ s:publisher:
14
+ s:name: Example organization
15
+ s:author:
16
+ s:givenName: Ada
17
+ s:familyName: Lovelace
18
+ s:email: ada@example.org
19
+ s:affiliation:
20
+ s:name: Example organization
21
+ $graph:
22
+ - id: hello
23
+ class: CommandLineTool
24
+ baseCommand: echo
25
+ inputs:
26
+ message:
27
+ type: string
28
+ default: Hello, world!
29
+ inputBinding:
30
+ position: 1
31
+ outputs: []
@@ -0,0 +1,41 @@
1
+ # Architecture
2
+
3
+ `transpiler-mate-runtime` is an adapter between an API-level plugin contract
4
+ and concrete execution concerns: package discovery, command-line parsing,
5
+ source access, CWL loading, and logging.
6
+
7
+ ## API and runtime separation
8
+
9
+ The `transpiler_mate` package is a native namespace shared by separately
10
+ distributed components:
11
+
12
+ - `transpiler_mate.api` defines `TranspilerPlugin`, `TranspilerContext`, option
13
+ models, metadata models, decorators, and plugin exceptions;
14
+ - `transpiler_mate.runtime` discovers plugins, builds commands, and resolves
15
+ contexts;
16
+ - `transpiler_mate.plugins.bundle` is the built-in plugin implementation.
17
+
18
+ This separation keeps Click out of plugin packages. A plugin can depend on the
19
+ stable API contract without coupling itself to this runtime's user interface.
20
+
21
+ ## Main components
22
+
23
+ | Component | Responsibility |
24
+ | --- | --- |
25
+ | `PluginGroup` | Discover entry points and expose them as lazy Click subcommands. |
26
+ | `plugin_loader` | Read entry-point metadata, load selected objects, and validate the plugin protocol. |
27
+ | CLI field conversion | Derive Click parameters from a plugin's Pydantic option model. |
28
+ | `DefaultTranspilerContextResolver` | Configure source adapters, load CWL, validate metadata, and select a process. |
29
+ | `software_application_extractor` | Convert preserved CWL JSON-LD metadata into the API's `SoftwareApplication`. |
30
+ | `bundle` | Serialize the complete resolved CWL document to a local file. |
31
+
32
+ ## Boundary of responsibility
33
+
34
+ The runtime owns how a plugin is found and invoked. A plugin owns the actual
35
+ transformation and its option schema. `cwl-loader` owns parsing and preserved
36
+ document metadata; `session-adapters` owns scheme-specific transport behavior;
37
+ the API package owns shared types.
38
+
39
+ Keeping these responsibilities explicit makes alternate front ends possible:
40
+ the plugin execution function itself accepts typed API objects and is not a
41
+ Click callback.
@@ -0,0 +1,47 @@
1
+ # CWL metadata
2
+
3
+ The runtime treats document metadata as part of the plugin input contract, not
4
+ as unstructured decoration. Before any plugin executes, the metadata must
5
+ validate as the `SoftwareApplication` model supplied by
6
+ `transpiler-mate-api`.
7
+
8
+ ## Why preserved metadata is used
9
+
10
+ For graph documents, `cwl-loader` parses `$graph` into
11
+ `cwl_utils.parser.Process` objects while preserving the surrounding
12
+ document-level metadata. The extractor reads that preserved mapping instead of
13
+ serializing the parsed process back to YAML or JSON.
14
+
15
+ This matters because parser objects represent the executable CWL structure,
16
+ while the preserved mapping retains JSON-LD terms and the document's namespace
17
+ context.
18
+
19
+ In the currently supported loader behavior, this preserved mapping comes from
20
+ fields surrounding `$graph`. A standalone process without a `$graph` wrapper
21
+ does not provide the document-level metadata expected by the extractor.
22
+
23
+ ## Conversion process
24
+
25
+ The extractor performs four operations:
26
+
27
+ 1. obtain the first available preserved document-level metadata mapping;
28
+ 2. make a deep copy so JSON-LD processing cannot mutate the parser's retained
29
+ metadata;
30
+ 3. use `$namespaces` as the expansion context and compact into an empty output
31
+ context, producing canonical IRIs;
32
+ 4. validate the compacted mapping as `SoftwareApplication` with aliases
33
+ enabled.
34
+
35
+ The empty output context is intentional: model aliases can match canonical
36
+ Schema.org IRIs without relying on whichever short prefix the source document
37
+ chose.
38
+
39
+ ## Failure boundary
40
+
41
+ The extractor itself distinguishes missing preserved metadata from JSON-LD and
42
+ Pydantic validation errors. During context resolution, all loading and metadata
43
+ extraction failures are wrapped as `PluginFailureError` saying that the source
44
+ could not be loaded as a CWL document.
45
+
46
+ Consequently, plugin code can assume that `context.metadata` is already a
47
+ validated `SoftwareApplication`.
@@ -0,0 +1,8 @@
1
+ # Explanation
2
+
3
+ Explanation pages describe why the runtime is structured as it is and how its
4
+ parts relate.
5
+
6
+ - [Architecture](architecture.md)
7
+ - [Plugin lifecycle](plugin-lifecycle.md)
8
+ - [CWL metadata](cwl-metadata.md)
@@ -0,0 +1,47 @@
1
+ # Plugin lifecycle
2
+
3
+ A plugin moves through discovery, command construction, context resolution,
4
+ and execution. Each stage is delayed until it is needed.
5
+
6
+ ## 1. Discovery
7
+
8
+ The root Click group queries installed metadata for the
9
+ `transpiler_mate.plugins` entry-point group. It sorts commands by name and
10
+ detects duplicate registrations without importing plugin modules.
11
+
12
+ This keeps root help responsive and prevents one unused plugin's import cost
13
+ from affecting every invocation.
14
+
15
+ ## 2. Loading and command construction
16
+
17
+ When a command is requested, its entry point is loaded and checked against the
18
+ `TranspilerPlugin` protocol. The entry-point name and plugin name must agree.
19
+
20
+ The runtime then reads `plugin.options_model.model_fields` and combines the
21
+ derived plugin options with the common `SOURCE` argument and connection
22
+ options. The generated command is cached.
23
+
24
+ ## 3. Option validation
25
+
26
+ Click parses individual values. The runtime omits untouched, non-required
27
+ defaults from the input dictionary so Pydantic can run default factories and
28
+ model-level logic normally. It then validates the complete options model with
29
+ both aliases and Python field names enabled.
30
+
31
+ No source is loaded when showing plugin help or when option validation fails.
32
+
33
+ ## 4. Context resolution
34
+
35
+ Only immediately before execution does the command create a resolver. The
36
+ resolver mounts transport adapters, loads the CWL document, validates its
37
+ Schema.org metadata, and optionally selects a process.
38
+
39
+ The resulting `TranspilerContext` gives every plugin the same normalized view
40
+ of its input regardless of whether the source was a local path, HTTP URL, or
41
+ OCI location.
42
+
43
+ ## 5. Execution and reporting
44
+
45
+ The runtime calls `plugin.execute(context, options)`. It distinguishes expected
46
+ result failures from unexpected execution errors, logs a success or failure
47
+ banner, and always reports elapsed and finish times once execution has begun.
@@ -0,0 +1,59 @@
1
+ # Access remote sources
2
+
3
+ Every plugin command accepts the same runtime connection options. Place them
4
+ after the plugin name and before or after other plugin options:
5
+
6
+ ```console
7
+ transpiler-mate <plugin> [RUNTIME_OPTIONS] [PLUGIN_OPTIONS] SOURCE
8
+ ```
9
+
10
+ ## Authenticate to HTTP and HTTPS
11
+
12
+ Set a bearer token:
13
+
14
+ ```console
15
+ export OAUTH2_BEARER="your-token"
16
+ transpiler-mate <plugin> [PLUGIN_OPTIONS] https://example.org/tool.cwl
17
+ ```
18
+
19
+ Or pass it directly:
20
+
21
+ ```console
22
+ transpiler-mate <plugin> \
23
+ --oauth2-bearer "your-token" \
24
+ [PLUGIN_OPTIONS] \
25
+ https://example.org/tool.cwl
26
+ ```
27
+
28
+ Without a token, the runtime uses a standard HTTP adapter. With a token, it
29
+ mounts a bearer-authentication adapter for both HTTP and HTTPS.
30
+
31
+ ## Authenticate to OCI
32
+
33
+ Prefer environment variables for credentials:
34
+
35
+ ```console
36
+ export OCI_HOSTNAME="registry.example.org"
37
+ export OCI_USERNAME="your-user"
38
+ export OCI_PASSWORD="your-password"
39
+ transpiler-mate <plugin> [PLUGIN_OPTIONS] oci://namespace/tool:tag
40
+ ```
41
+
42
+ The equivalent command options are `--oci-hostname`, `--oci-username`, and
43
+ `--oci-password`.
44
+
45
+ ## Select a process in a remote document
46
+
47
+ Append a fragment to the source:
48
+
49
+ ```console
50
+ transpiler-mate <plugin> [PLUGIN_OPTIONS] \
51
+ oci://namespace/workflow:tag#main
52
+ ```
53
+
54
+ See [Select a process](select-a-process.md) for the selection behavior.
55
+
56
+ !!! warning
57
+ Command-line secrets may be recorded in shell history and visible to other
58
+ local processes. Prefer the supported environment variables or your
59
+ platform's secret injection facility.
@@ -0,0 +1,64 @@
1
+ # Bundle a CWL document
2
+
3
+ Use the built-in `bundle` plugin to load a CWL document and serialize the
4
+ resolved document to a local file.
5
+
6
+ ## Bundle a local document
7
+
8
+ Pass the destination with `--output` and the source as the final argument:
9
+
10
+ ```console
11
+ transpiler-mate bundle --output build/workflow.cwl workflow.cwl
12
+ ```
13
+
14
+ Parent directories of the output are created automatically.
15
+
16
+ ## Bundle an HTTP or HTTPS document
17
+
18
+ Use the source URL directly:
19
+
20
+ ```console
21
+ transpiler-mate bundle \
22
+ --output build/workflow.cwl \
23
+ https://example.org/workflows/workflow.cwl
24
+ ```
25
+
26
+ For a protected endpoint, add a bearer token through the environment:
27
+
28
+ ```console
29
+ export OAUTH2_BEARER="your-token"
30
+ transpiler-mate bundle \
31
+ --output build/workflow.cwl \
32
+ https://example.org/workflows/workflow.cwl
33
+ ```
34
+
35
+ You can also pass `--oauth2-bearer`, but an environment variable is less likely
36
+ to expose the token in shell history or process listings.
37
+
38
+ ## Bundle an OCI document
39
+
40
+ Configure the registry connection and pass an `oci://` source:
41
+
42
+ ```console
43
+ export OCI_HOSTNAME="registry.example.org"
44
+ export OCI_USERNAME="your-user"
45
+ export OCI_PASSWORD="your-password"
46
+ transpiler-mate bundle \
47
+ --output build/workflow.cwl \
48
+ oci://namespace/workflow:tag
49
+ ```
50
+
51
+ The exact OCI path semantics are implemented by the installed
52
+ `session-adapters` package. The runtime supplies the hostname and credentials
53
+ to its OCI adapter.
54
+
55
+ ## Check the result
56
+
57
+ A successful invocation logs `SUCCESS` and exits with status `0`. Expected
58
+ input or output failures log `FAILURE` or `ERROR` and exit with status `1`; CLI
59
+ usage errors exit with status `2`. See [Errors and exit codes](../reference/errors-and-exit-codes.md).
60
+
61
+ The plugin serializes the complete loaded document. Adding a `#process-id` to
62
+ the source selects a process in the context for plugins that use
63
+ `resolved_process`; it does not make the built-in `bundle` plugin extract that
64
+ process from the document.
@@ -0,0 +1,8 @@
1
+ # How-to guides
2
+
3
+ How-to guides provide task-oriented instructions for common runtime jobs.
4
+
5
+ - [Bundle a CWL document](bundle-a-cwl-document.md)
6
+ - [Select a process](select-a-process.md)
7
+ - [Access remote sources](access-remote-sources.md)
8
+ - [Register a plugin](register-a-plugin.md)
@@ -0,0 +1,72 @@
1
+ # Register a plugin
2
+
3
+ A plugin distribution becomes a `transpiler-mate` subcommand by registering a
4
+ `TranspilerPlugin` object in the `transpiler_mate.plugins` entry-point group.
5
+
6
+ ## 1. Define its options and execution function
7
+
8
+ Use the API package's decorator and a Pydantic model:
9
+
10
+ ```python
11
+ from pathlib import Path
12
+
13
+ from pydantic import BaseModel, ConfigDict, Field
14
+ from transpiler_mate.api import TranspilerContext, transpiler_plugin
15
+
16
+
17
+ class ExampleOptions(BaseModel):
18
+ model_config = ConfigDict(extra="forbid")
19
+
20
+ output: Path = Field(description="Destination file")
21
+ verbose: bool = Field(default=False, description="Enable verbose output")
22
+
23
+
24
+ @transpiler_plugin(
25
+ name="example",
26
+ description="Run the example transpiler.",
27
+ options_model=ExampleOptions,
28
+ )
29
+ def plugin(context: TranspilerContext, options: ExampleOptions) -> None:
30
+ source = context.source
31
+ process = context.resolved_process
32
+ # Perform the transformation and write options.output.
33
+ ```
34
+
35
+ The runtime converts model fields into Click options. Required fields become
36
+ required options, field descriptions become help text, and optional Boolean
37
+ fields become `--name/--no-name` flag pairs.
38
+
39
+ ## 2. Register the entry point
40
+
41
+ If the module above is `example_plugin/__init__.py`, add this to the plugin
42
+ package's `pyproject.toml`:
43
+
44
+ ```toml
45
+ [project.entry-points."transpiler_mate.plugins"]
46
+ example = "example_plugin:plugin"
47
+ ```
48
+
49
+ The entry-point name must equal the plugin's `name`. The runtime rejects a
50
+ mismatch when the command is requested.
51
+
52
+ ## 3. Install and verify the plugin
53
+
54
+ Install the plugin distribution into the same environment as the runtime:
55
+
56
+ ```console
57
+ python -m pip install -e /path/to/example-plugin
58
+ transpiler-mate --help
59
+ transpiler-mate example --help
60
+ ```
61
+
62
+ The root help should list `example`, while the plugin help should show
63
+ `SOURCE`, the shared connection options, `--output`, and the Boolean flag pair.
64
+
65
+ ## 4. Report failures deliberately
66
+
67
+ Raise the API's `PluginFailureError` for an expected inability to produce a
68
+ result. Raise `PluginExecutionError` for an unexpected technical failure. Both
69
+ produce status `1`, but the runtime logs a traceback only for the latter.
70
+
71
+ Other `PluginError` subclasses are presented as Click errors. See
72
+ [Errors and exit codes](../reference/errors-and-exit-codes.md).
@@ -0,0 +1,31 @@
1
+ # Select a process
2
+
3
+ Append `#<process-id>` to a source location when a plugin needs one process
4
+ from a CWL graph:
5
+
6
+ ```console
7
+ transpiler-mate <plugin> [PLUGIN_OPTIONS] workflow.cwl#main
8
+ ```
9
+
10
+ The fragment is handled by the runtime rather than sent to the source loader.
11
+ The runtime loads `workflow.cwl`, searches the resulting process or process
12
+ list for `main`, and exposes the match as `context.resolved_process`.
13
+
14
+ The same syntax applies to remote sources:
15
+
16
+ ```console
17
+ transpiler-mate <plugin> [PLUGIN_OPTIONS] \
18
+ https://example.org/workflow.cwl#main
19
+ ```
20
+
21
+ If the ID does not exist, the runtime reports the IDs that are available and
22
+ exits with status `1`. A trailing `#` with no ID is an execution error.
23
+
24
+ When a loaded document contains multiple processes and no fragment is given,
25
+ the runtime logs a warning and leaves `resolved_process` unset. The full graph
26
+ remains available through `context.document`.
27
+
28
+ !!! note
29
+ The built-in `bundle` plugin writes `context.document`, not
30
+ `context.resolved_process`. Process selection is therefore useful only for
31
+ plugins that explicitly consume the selected process.