vcti-ywf 3.0.1__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.
- vcti_ywf-3.0.1/LICENSE +8 -0
- vcti_ywf-3.0.1/PKG-INFO +237 -0
- vcti_ywf-3.0.1/README.md +198 -0
- vcti_ywf-3.0.1/pyproject.toml +96 -0
- vcti_ywf-3.0.1/setup.cfg +4 -0
- vcti_ywf-3.0.1/src/vcti/ywf/__init__.py +78 -0
- vcti_ywf-3.0.1/src/vcti/ywf/dsl/__init__.py +16 -0
- vcti_ywf-3.0.1/src/vcti/ywf/dsl/context.py +95 -0
- vcti_ywf-3.0.1/src/vcti/ywf/dsl/executable.py +93 -0
- vcti_ywf-3.0.1/src/vcti/ywf/dsl/metadata.py +165 -0
- vcti_ywf-3.0.1/src/vcti/ywf/dsl/property.py +71 -0
- vcti_ywf-3.0.1/src/vcti/ywf/dsl/variable_reference.py +26 -0
- vcti_ywf-3.0.1/src/vcti/ywf/exceptions.py +112 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/__init__.py +38 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/context.py +430 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/controller.py +245 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/evaluator.py +86 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/event.py +249 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/interpolator.py +79 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/observable_context.py +231 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/observer.py +133 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/observers/__init__.py +21 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/observers/history_observer.py +181 -0
- vcti_ywf-3.0.1/src/vcti/ywf/execution/observers/logging_observer.py +80 -0
- vcti_ywf-3.0.1/src/vcti/ywf/flow/__init__.py +15 -0
- vcti_ywf-3.0.1/src/vcti/ywf/flow/block.py +432 -0
- vcti_ywf-3.0.1/src/vcti/ywf/flow/condition.py +47 -0
- vcti_ywf-3.0.1/src/vcti/ywf/flow/exceptions.py +26 -0
- vcti_ywf-3.0.1/src/vcti/ywf/loader/__init__.py +52 -0
- vcti_ywf-3.0.1/src/vcti/ywf/loader/_about.py +68 -0
- vcti_ywf-3.0.1/src/vcti/ywf/loader/_metadata.py +227 -0
- vcti_ywf-3.0.1/src/vcti/ywf/loader/_shared.py +261 -0
- vcti_ywf-3.0.1/src/vcti/ywf/loader/_steps.py +288 -0
- vcti_ywf-3.0.1/src/vcti/ywf/methods/__init__.py +26 -0
- vcti_ywf-3.0.1/src/vcti/ywf/methods/base.py +156 -0
- vcti_ywf-3.0.1/src/vcti/ywf/methods/dispatchers.py +99 -0
- vcti_ywf-3.0.1/src/vcti/ywf/methods/registry.py +510 -0
- vcti_ywf-3.0.1/src/vcti/ywf/py.typed +0 -0
- vcti_ywf-3.0.1/src/vcti/ywf/runtime/__init__.py +17 -0
- vcti_ywf-3.0.1/src/vcti/ywf/runtime/folders.py +82 -0
- vcti_ywf-3.0.1/src/vcti/ywf/runtime/runner.py +309 -0
- vcti_ywf-3.0.1/src/vcti/ywf/runtime/runtime.py +125 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/__init__.py +120 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/compare.py +59 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/data_scope.py +268 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/environ.py +165 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/exit.py +67 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/filereader.py +361 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/iterables.py +65 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/path_format.py +264 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/string.py +33 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/userlog.py +80 -0
- vcti_ywf-3.0.1/src/vcti/ywf/stdlib/variable.py +67 -0
- vcti_ywf-3.0.1/src/vcti/ywf/variable/list.py +202 -0
- vcti_ywf-3.0.1/src/vcti/ywf/variable/type.py +44 -0
- vcti_ywf-3.0.1/src/vcti/ywf/variable/variable.py +213 -0
- vcti_ywf-3.0.1/src/vcti/ywf/workflow/about.py +41 -0
- vcti_ywf-3.0.1/src/vcti/ywf/workflow/file_name.py +16 -0
- vcti_ywf-3.0.1/src/vcti/ywf/workflow/image_type.py +25 -0
- vcti_ywf-3.0.1/src/vcti/ywf/workflow/requirements.py +332 -0
- vcti_ywf-3.0.1/src/vcti/ywf/workflow/workflow.py +237 -0
- vcti_ywf-3.0.1/src/vcti_ywf.egg-info/PKG-INFO +237 -0
- vcti_ywf-3.0.1/src/vcti_ywf.egg-info/SOURCES.txt +93 -0
- vcti_ywf-3.0.1/src/vcti_ywf.egg-info/dependency_links.txt +1 -0
- vcti_ywf-3.0.1/src/vcti_ywf.egg-info/requires.txt +33 -0
- vcti_ywf-3.0.1/src/vcti_ywf.egg-info/top_level.txt +1 -0
- vcti_ywf-3.0.1/src/vcti_ywf.egg-info/zip-safe +1 -0
- vcti_ywf-3.0.1/tests/test_block_dispatch.py +178 -0
- vcti_ywf-3.0.1/tests/test_context.py +260 -0
- vcti_ywf-3.0.1/tests/test_context_scoping.py +274 -0
- vcti_ywf-3.0.1/tests/test_context_security.py +213 -0
- vcti_ywf-3.0.1/tests/test_exceptions.py +228 -0
- vcti_ywf-3.0.1/tests/test_execution_controller.py +292 -0
- vcti_ywf-3.0.1/tests/test_expression_evaluator.py +135 -0
- vcti_ywf-3.0.1/tests/test_flow.py +328 -0
- vcti_ywf-3.0.1/tests/test_flow_condition.py +247 -0
- vcti_ywf-3.0.1/tests/test_loaders.py +310 -0
- vcti_ywf-3.0.1/tests/test_method_registry_extended.py +369 -0
- vcti_ywf-3.0.1/tests/test_observers.py +168 -0
- vcti_ywf-3.0.1/tests/test_observers_extended.py +351 -0
- vcti_ywf-3.0.1/tests/test_registry.py +112 -0
- vcti_ywf-3.0.1/tests/test_runner.py +751 -0
- vcti_ywf-3.0.1/tests/test_runtime_folders.py +113 -0
- vcti_ywf-3.0.1/tests/test_schema.py +112 -0
- vcti_ywf-3.0.1/tests/test_small_gaps.py +218 -0
- vcti_ywf-3.0.1/tests/test_stdlib_basics.py +324 -0
- vcti_ywf-3.0.1/tests/test_stdlib_data_scope.py +404 -0
- vcti_ywf-3.0.1/tests/test_stdlib_environ.py +235 -0
- vcti_ywf-3.0.1/tests/test_stdlib_filereader.py +319 -0
- vcti_ywf-3.0.1/tests/test_stdlib_path_format.py +291 -0
- vcti_ywf-3.0.1/tests/test_template_interpolator.py +85 -0
- vcti_ywf-3.0.1/tests/test_variables.py +465 -0
- vcti_ywf-3.0.1/tests/test_version.py +15 -0
- vcti_ywf-3.0.1/tests/test_workflow_class.py +328 -0
- vcti_ywf-3.0.1/tests/test_workflow_requirements.py +337 -0
vcti_ywf-3.0.1/LICENSE
ADDED
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
Copyright (c) 2018-2026 Visual Collaboration Technologies Inc.
|
|
2
|
+
All Rights Reserved.
|
|
3
|
+
|
|
4
|
+
This software is proprietary and confidential. Unauthorized copying,
|
|
5
|
+
distribution, or use of this software, via any medium, is strictly
|
|
6
|
+
prohibited. Access is granted only to authorized VCollab developers
|
|
7
|
+
and individuals explicitly authorized by Visual Collaboration
|
|
8
|
+
Technologies Inc.
|
vcti_ywf-3.0.1/PKG-INFO
ADDED
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: vcti-ywf
|
|
3
|
+
Version: 3.0.1
|
|
4
|
+
Summary: YAML workflow engine — parses, validates, and executes step-based workflows with pluggable Action / Evaluator / Predicate / Iterable methods.
|
|
5
|
+
Author: Visual Collaboration Technologies Inc.
|
|
6
|
+
Requires-Python: <3.15,>=3.12
|
|
7
|
+
Description-Content-Type: text/markdown
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Requires-Dist: pydantic>=2.0
|
|
10
|
+
Requires-Dist: PyYAML>=6.0
|
|
11
|
+
Requires-Dist: pyyaml-include>=2.0
|
|
12
|
+
Requires-Dist: numpy>=1.24
|
|
13
|
+
Requires-Dist: pandas>=2.0
|
|
14
|
+
Requires-Dist: jinja2>=3.0
|
|
15
|
+
Requires-Dist: packaging>=21.0
|
|
16
|
+
Requires-Dist: simpleeval>=1.0
|
|
17
|
+
Requires-Dist: vcti-array-tree>=1.0.0
|
|
18
|
+
Requires-Dist: vcti-config>=3.1.2
|
|
19
|
+
Requires-Dist: vcti-data-scope>=1.0.0
|
|
20
|
+
Requires-Dist: vcti-enum>=1.1.0
|
|
21
|
+
Requires-Dist: vcti-error>=1.0.0
|
|
22
|
+
Requires-Dist: vcti-fileloader>=1.0.0
|
|
23
|
+
Requires-Dist: vcti-logging>=1.0.0
|
|
24
|
+
Requires-Dist: vcti-lookup>=1.0.1
|
|
25
|
+
Requires-Dist: vcti-path>=1.0.3
|
|
26
|
+
Requires-Dist: vcti-path-format>=1.2.0
|
|
27
|
+
Requires-Dist: vcti-path-format-descriptors>=1.1.0
|
|
28
|
+
Requires-Dist: vcti-path-tree>=1.1.1
|
|
29
|
+
Provides-Extra: hdf5
|
|
30
|
+
Requires-Dist: vcti-fileloader-hdf5>=1.0.0; extra == "hdf5"
|
|
31
|
+
Provides-Extra: test
|
|
32
|
+
Requires-Dist: pytest; extra == "test"
|
|
33
|
+
Requires-Dist: pytest-cov; extra == "test"
|
|
34
|
+
Provides-Extra: lint
|
|
35
|
+
Requires-Dist: ruff; extra == "lint"
|
|
36
|
+
Provides-Extra: typecheck
|
|
37
|
+
Requires-Dist: mypy; extra == "typecheck"
|
|
38
|
+
Dynamic: license-file
|
|
39
|
+
|
|
40
|
+
# YAML Workflow Framework
|
|
41
|
+
|
|
42
|
+
YAML workflow engine — parses, validates, and executes step-based workflows
|
|
43
|
+
with pluggable Action / Evaluator / Predicate / Iterable methods.
|
|
44
|
+
|
|
45
|
+
## Overview
|
|
46
|
+
|
|
47
|
+
`vcti-ywf` is the workflow engine behind VCollab Insights. A workflow is a
|
|
48
|
+
directory of YAML files — `about.yaml`, `variables/main.yaml`,
|
|
49
|
+
`steps/main.yaml` — that describe an automated process declaratively. The
|
|
50
|
+
engine parses those files (with support for `!var`, `!include`, and `!module`
|
|
51
|
+
tags), resolves variables, evaluates control-flow blocks (`if-else`,
|
|
52
|
+
`for-each`, `try-except`), and dispatches each step to a registered method
|
|
53
|
+
plugin.
|
|
54
|
+
|
|
55
|
+
Method plugins come in four typed shapes — **Action** (side-effecting),
|
|
56
|
+
**Evaluator** (produces a value), **Predicate** (boolean test), and
|
|
57
|
+
**Iterable** (yields keys for `for-each`). A built-in `stdlib` package ships
|
|
58
|
+
common methods; downstream consumers add domain-specific methods (CAE data
|
|
59
|
+
extraction, plotting, report generation) by registering their own classes.
|
|
60
|
+
|
|
61
|
+
Workflow YAML is evaluated against a sandboxed `Context` by default —
|
|
62
|
+
`- evaluator: evaluate` expressions go through `simpleeval`, and
|
|
63
|
+
`{{ var }}` template interpolation goes through Jinja2's
|
|
64
|
+
`SandboxedEnvironment`. Engine-internal context variables
|
|
65
|
+
(`__runtime__` and friends) are filtered from author-facing scope.
|
|
66
|
+
Hosts that run fully-trusted YAML can opt into raw `eval` or the
|
|
67
|
+
full Jinja2 environment by constructing the `Context` themselves and
|
|
68
|
+
passing it to `Runner.run()`.
|
|
69
|
+
|
|
70
|
+
## Installation
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
pip install vcti-ywf>=3.0.1
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
### In `requirements.txt`
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
vcti-ywf>=3.0.1
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
### In `pyproject.toml` dependencies
|
|
83
|
+
|
|
84
|
+
```toml
|
|
85
|
+
dependencies = [
|
|
86
|
+
"vcti-ywf>=3.0.1",
|
|
87
|
+
]
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
---
|
|
91
|
+
|
|
92
|
+
## Quick Start
|
|
93
|
+
|
|
94
|
+
Run a workflow from Python:
|
|
95
|
+
|
|
96
|
+
```python
|
|
97
|
+
from pathlib import Path
|
|
98
|
+
|
|
99
|
+
from vcti.ywf import Runner, Workflow
|
|
100
|
+
|
|
101
|
+
workflow = Workflow(Path("path/to/my-workflow"))
|
|
102
|
+
workflow.read_all()
|
|
103
|
+
|
|
104
|
+
result = Runner(workflow).run({"input_file": "data/model.h5"})
|
|
105
|
+
|
|
106
|
+
print(result.return_value) # top-level block's value
|
|
107
|
+
print(result.outputs) # declared outputs read from final context
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
For monitoring or debugging, build an `ObservableContext`, attach
|
|
111
|
+
observers, and pass it to `run()`:
|
|
112
|
+
|
|
113
|
+
```python
|
|
114
|
+
from vcti.ywf import ObservableContext, Runner
|
|
115
|
+
from vcti.ywf.execution.observers.history_observer import HistoryObserver
|
|
116
|
+
|
|
117
|
+
context = ObservableContext()
|
|
118
|
+
context.add_observer(HistoryObserver())
|
|
119
|
+
|
|
120
|
+
Runner(workflow).run({"input_file": "data/model.h5"}, context)
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
A minimal workflow directory looks like:
|
|
124
|
+
|
|
125
|
+
```
|
|
126
|
+
my-workflow/
|
|
127
|
+
├── about.yaml # title, description, tags, images
|
|
128
|
+
├── variables/
|
|
129
|
+
│ └── main.yaml # inputs + outputs declarations
|
|
130
|
+
└── steps/
|
|
131
|
+
└── main.yaml # execution steps
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
`variables/main.yaml` declares the workflow's external contract —
|
|
135
|
+
inputs (supplied by the caller) and outputs (produced by the run):
|
|
136
|
+
|
|
137
|
+
```yaml
|
|
138
|
+
inputs:
|
|
139
|
+
- name: input_file
|
|
140
|
+
type: input_file_path
|
|
141
|
+
description: Path to the simulation results
|
|
142
|
+
default: data/sample.h5
|
|
143
|
+
|
|
144
|
+
outputs:
|
|
145
|
+
- name: mode_count
|
|
146
|
+
type: int
|
|
147
|
+
default: 0
|
|
148
|
+
description: Number of modes extracted.
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
`steps/main.yaml` lists actions, evaluators, predicates, and iterables —
|
|
152
|
+
each is a YAML mapping keyed by its method name. The data-scope actions
|
|
153
|
+
illustrate the typical pattern:
|
|
154
|
+
|
|
155
|
+
```yaml
|
|
156
|
+
- action: define_data_scope
|
|
157
|
+
name: simulation
|
|
158
|
+
type: paths-group
|
|
159
|
+
|
|
160
|
+
- action: add_path_source
|
|
161
|
+
path: !var input_file
|
|
162
|
+
format: hdf5-file
|
|
163
|
+
label: results
|
|
164
|
+
|
|
165
|
+
- action: load_data_scope
|
|
166
|
+
|
|
167
|
+
- if:
|
|
168
|
+
predicate: is_data_scope_valid
|
|
169
|
+
then:
|
|
170
|
+
- action: log_message
|
|
171
|
+
message: "Data scope ready."
|
|
172
|
+
else:
|
|
173
|
+
- action: log_message
|
|
174
|
+
log_level: error
|
|
175
|
+
message: "Data scope failed to load."
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
## Documentation
|
|
179
|
+
|
|
180
|
+
**User guides** — start here:
|
|
181
|
+
|
|
182
|
+
- [docs/tutorial.md](docs/tutorial.md) — walk through the greeting workflow end-to-end with the Python API, then expand to control-flow blocks and data-scope actions.
|
|
183
|
+
- [docs/yaml-reference.md](docs/yaml-reference.md) — exhaustive field reference for `about.yaml`, `variables/main.yaml`, `steps/main.yaml`, and every step type (action / evaluator / predicate / iterable / if-else / for-each / try-except).
|
|
184
|
+
- [docs/yaml-tags.md](docs/yaml-tags.md) — `!var`, `!include`, and `!module` semantics with scoping rules.
|
|
185
|
+
- [docs/plugins.md](docs/plugins.md) — author guide for custom workflow methods.
|
|
186
|
+
- [docs/api.md](docs/api.md) — autogenerated API reference.
|
|
187
|
+
|
|
188
|
+
**Developer reference** — engine concepts subpackage by subpackage:
|
|
189
|
+
|
|
190
|
+
- [docs/developer/README.md](docs/developer/README.md) — index for the developer documentation.
|
|
191
|
+
- [docs/developer/core/workflow-structure.md](docs/developer/core/workflow-structure.md) — how a workflow is organised on disk.
|
|
192
|
+
- [docs/developer/core/variables.md](docs/developer/core/variables.md) — `inputs:` / `outputs:` sections, host-facing helpers.
|
|
193
|
+
- [docs/developer/core/runtime.md](docs/developer/core/runtime.md) — `Runtime`, `Runner`, `RunResult`, caller-supplied context.
|
|
194
|
+
- [docs/developer/core/execution-context.md](docs/developer/core/execution-context.md) — the sandboxed `Context`, trust posture, custom Jinja2 filters.
|
|
195
|
+
- [docs/developer/core/methods.md](docs/developer/core/methods.md) — method registry, dispatchers, plugin authoring.
|
|
196
|
+
- [docs/developer/core/flow.md](docs/developer/core/flow.md) — `Block` variants and dispatch.
|
|
197
|
+
- [docs/developer/core/dsl.md](docs/developer/core/dsl.md) — `Value` / `Property`, `ContextBase`, executables.
|
|
198
|
+
- [docs/developer/core/stdlib.md](docs/developer/core/stdlib.md) — built-in actions, evaluators, predicates, iterables.
|
|
199
|
+
|
|
200
|
+
**Internals** — for engine maintainers and tool builders:
|
|
201
|
+
|
|
202
|
+
- [docs/developer/internals/overview.md](docs/developer/internals/overview.md) — source-location tracking, observation, and control as three interlocking pieces.
|
|
203
|
+
- [docs/developer/internals/dsl.md](docs/developer/internals/dsl.md) — `MetadataMixin`, `Source` / `StepMetadata`, the `_meta` field.
|
|
204
|
+
- [docs/developer/internals/yaml-loader.md](docs/developer/internals/yaml-loader.md) — the three loader classes, `subdir_dir` / `current_file` invariants, `!var` / `!include` / `!module` implementation.
|
|
205
|
+
- [docs/developer/internals/execution-observing.md](docs/developer/internals/execution-observing.md) — `ObservableContext`, the event hierarchy, built-in observers, the `ExecutionController`.
|
|
206
|
+
- [docs/developer/internals/debug-command.md](docs/developer/internals/debug-command.md) — how to build a step-by-step debugger on top of the controller + observer pair.
|
|
207
|
+
|
|
208
|
+
---
|
|
209
|
+
|
|
210
|
+
## Dependencies
|
|
211
|
+
|
|
212
|
+
Third-party:
|
|
213
|
+
|
|
214
|
+
- [pydantic](https://docs.pydantic.dev/) (>=2.0) — model validation
|
|
215
|
+
- [PyYAML](https://pyyaml.org/) (>=6.0) and [pyyaml-include](https://pypi.org/project/pyyaml-include/) (>=2.0) — YAML parsing with `!include`
|
|
216
|
+
- [Jinja2](https://palletsprojects.com/p/jinja/) (>=3.0) — `{{ var }}` interpolation in `Property[str]` fields (sandboxed via `SandboxedEnvironment` in the default `Context`)
|
|
217
|
+
- [simpleeval](https://github.com/danthedeckie/simpleeval) (>=1.0) — sandboxed expression evaluator for `- evaluator: evaluate`
|
|
218
|
+
- [NumPy](https://numpy.org/) (>=1.24) — array handling via `vcti-array-tree`
|
|
219
|
+
- [pandas](https://pandas.pydata.org/) (>=2.0) — CSV reading in the `read_file` evaluator and DataFrame iteration in `list_items`
|
|
220
|
+
|
|
221
|
+
VCollab platform packages:
|
|
222
|
+
|
|
223
|
+
- [vcti-array-tree](https://pypi.org/project/vcti-array-tree/) — hierarchical array data
|
|
224
|
+
- [vcti-config](https://pypi.org/project/vcti-config/) — environment-variable decoding (`get_env` evaluator)
|
|
225
|
+
- [vcti-data-scope](https://pypi.org/project/vcti-data-scope/) — `DataScope` / `PathsGroup` types used by the data-scope actions
|
|
226
|
+
- [vcti-enum](https://pypi.org/project/vcti-enum/) — value-generated enums + Pydantic helpers
|
|
227
|
+
- [vcti-error](https://pypi.org/project/vcti-error/) — error codes
|
|
228
|
+
- [vcti-fileloader](https://pypi.org/project/vcti-fileloader/) — pluggable loader registry
|
|
229
|
+
- [vcti-logging](https://pypi.org/project/vcti-logging/) — logger
|
|
230
|
+
- [vcti-lookup](https://pypi.org/project/vcti-lookup/) — `Rule`-based attribute filtering
|
|
231
|
+
- [vcti-path](https://pypi.org/project/vcti-path/) — safe path & filename validation
|
|
232
|
+
- [vcti-path-format](https://pypi.org/project/vcti-path-format/), [vcti-path-format-descriptors](https://pypi.org/project/vcti-path-format-descriptors/) — file-format identification
|
|
233
|
+
- [vcti-path-tree](https://pypi.org/project/vcti-path-tree/) — directory tree scanning
|
|
234
|
+
|
|
235
|
+
Optional extras:
|
|
236
|
+
|
|
237
|
+
- `vcti-ywf[hdf5]` — pulls in [vcti-fileloader-hdf5](https://pypi.org/project/vcti-fileloader-hdf5/), which `Runner` auto-registers if installed.
|
vcti_ywf-3.0.1/README.md
ADDED
|
@@ -0,0 +1,198 @@
|
|
|
1
|
+
# YAML Workflow Framework
|
|
2
|
+
|
|
3
|
+
YAML workflow engine — parses, validates, and executes step-based workflows
|
|
4
|
+
with pluggable Action / Evaluator / Predicate / Iterable methods.
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
`vcti-ywf` is the workflow engine behind VCollab Insights. A workflow is a
|
|
9
|
+
directory of YAML files — `about.yaml`, `variables/main.yaml`,
|
|
10
|
+
`steps/main.yaml` — that describe an automated process declaratively. The
|
|
11
|
+
engine parses those files (with support for `!var`, `!include`, and `!module`
|
|
12
|
+
tags), resolves variables, evaluates control-flow blocks (`if-else`,
|
|
13
|
+
`for-each`, `try-except`), and dispatches each step to a registered method
|
|
14
|
+
plugin.
|
|
15
|
+
|
|
16
|
+
Method plugins come in four typed shapes — **Action** (side-effecting),
|
|
17
|
+
**Evaluator** (produces a value), **Predicate** (boolean test), and
|
|
18
|
+
**Iterable** (yields keys for `for-each`). A built-in `stdlib` package ships
|
|
19
|
+
common methods; downstream consumers add domain-specific methods (CAE data
|
|
20
|
+
extraction, plotting, report generation) by registering their own classes.
|
|
21
|
+
|
|
22
|
+
Workflow YAML is evaluated against a sandboxed `Context` by default —
|
|
23
|
+
`- evaluator: evaluate` expressions go through `simpleeval`, and
|
|
24
|
+
`{{ var }}` template interpolation goes through Jinja2's
|
|
25
|
+
`SandboxedEnvironment`. Engine-internal context variables
|
|
26
|
+
(`__runtime__` and friends) are filtered from author-facing scope.
|
|
27
|
+
Hosts that run fully-trusted YAML can opt into raw `eval` or the
|
|
28
|
+
full Jinja2 environment by constructing the `Context` themselves and
|
|
29
|
+
passing it to `Runner.run()`.
|
|
30
|
+
|
|
31
|
+
## Installation
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
pip install vcti-ywf>=3.0.1
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
### In `requirements.txt`
|
|
38
|
+
|
|
39
|
+
```
|
|
40
|
+
vcti-ywf>=3.0.1
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### In `pyproject.toml` dependencies
|
|
44
|
+
|
|
45
|
+
```toml
|
|
46
|
+
dependencies = [
|
|
47
|
+
"vcti-ywf>=3.0.1",
|
|
48
|
+
]
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Quick Start
|
|
54
|
+
|
|
55
|
+
Run a workflow from Python:
|
|
56
|
+
|
|
57
|
+
```python
|
|
58
|
+
from pathlib import Path
|
|
59
|
+
|
|
60
|
+
from vcti.ywf import Runner, Workflow
|
|
61
|
+
|
|
62
|
+
workflow = Workflow(Path("path/to/my-workflow"))
|
|
63
|
+
workflow.read_all()
|
|
64
|
+
|
|
65
|
+
result = Runner(workflow).run({"input_file": "data/model.h5"})
|
|
66
|
+
|
|
67
|
+
print(result.return_value) # top-level block's value
|
|
68
|
+
print(result.outputs) # declared outputs read from final context
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
For monitoring or debugging, build an `ObservableContext`, attach
|
|
72
|
+
observers, and pass it to `run()`:
|
|
73
|
+
|
|
74
|
+
```python
|
|
75
|
+
from vcti.ywf import ObservableContext, Runner
|
|
76
|
+
from vcti.ywf.execution.observers.history_observer import HistoryObserver
|
|
77
|
+
|
|
78
|
+
context = ObservableContext()
|
|
79
|
+
context.add_observer(HistoryObserver())
|
|
80
|
+
|
|
81
|
+
Runner(workflow).run({"input_file": "data/model.h5"}, context)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
A minimal workflow directory looks like:
|
|
85
|
+
|
|
86
|
+
```
|
|
87
|
+
my-workflow/
|
|
88
|
+
├── about.yaml # title, description, tags, images
|
|
89
|
+
├── variables/
|
|
90
|
+
│ └── main.yaml # inputs + outputs declarations
|
|
91
|
+
└── steps/
|
|
92
|
+
└── main.yaml # execution steps
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
`variables/main.yaml` declares the workflow's external contract —
|
|
96
|
+
inputs (supplied by the caller) and outputs (produced by the run):
|
|
97
|
+
|
|
98
|
+
```yaml
|
|
99
|
+
inputs:
|
|
100
|
+
- name: input_file
|
|
101
|
+
type: input_file_path
|
|
102
|
+
description: Path to the simulation results
|
|
103
|
+
default: data/sample.h5
|
|
104
|
+
|
|
105
|
+
outputs:
|
|
106
|
+
- name: mode_count
|
|
107
|
+
type: int
|
|
108
|
+
default: 0
|
|
109
|
+
description: Number of modes extracted.
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
`steps/main.yaml` lists actions, evaluators, predicates, and iterables —
|
|
113
|
+
each is a YAML mapping keyed by its method name. The data-scope actions
|
|
114
|
+
illustrate the typical pattern:
|
|
115
|
+
|
|
116
|
+
```yaml
|
|
117
|
+
- action: define_data_scope
|
|
118
|
+
name: simulation
|
|
119
|
+
type: paths-group
|
|
120
|
+
|
|
121
|
+
- action: add_path_source
|
|
122
|
+
path: !var input_file
|
|
123
|
+
format: hdf5-file
|
|
124
|
+
label: results
|
|
125
|
+
|
|
126
|
+
- action: load_data_scope
|
|
127
|
+
|
|
128
|
+
- if:
|
|
129
|
+
predicate: is_data_scope_valid
|
|
130
|
+
then:
|
|
131
|
+
- action: log_message
|
|
132
|
+
message: "Data scope ready."
|
|
133
|
+
else:
|
|
134
|
+
- action: log_message
|
|
135
|
+
log_level: error
|
|
136
|
+
message: "Data scope failed to load."
|
|
137
|
+
```
|
|
138
|
+
|
|
139
|
+
## Documentation
|
|
140
|
+
|
|
141
|
+
**User guides** — start here:
|
|
142
|
+
|
|
143
|
+
- [docs/tutorial.md](docs/tutorial.md) — walk through the greeting workflow end-to-end with the Python API, then expand to control-flow blocks and data-scope actions.
|
|
144
|
+
- [docs/yaml-reference.md](docs/yaml-reference.md) — exhaustive field reference for `about.yaml`, `variables/main.yaml`, `steps/main.yaml`, and every step type (action / evaluator / predicate / iterable / if-else / for-each / try-except).
|
|
145
|
+
- [docs/yaml-tags.md](docs/yaml-tags.md) — `!var`, `!include`, and `!module` semantics with scoping rules.
|
|
146
|
+
- [docs/plugins.md](docs/plugins.md) — author guide for custom workflow methods.
|
|
147
|
+
- [docs/api.md](docs/api.md) — autogenerated API reference.
|
|
148
|
+
|
|
149
|
+
**Developer reference** — engine concepts subpackage by subpackage:
|
|
150
|
+
|
|
151
|
+
- [docs/developer/README.md](docs/developer/README.md) — index for the developer documentation.
|
|
152
|
+
- [docs/developer/core/workflow-structure.md](docs/developer/core/workflow-structure.md) — how a workflow is organised on disk.
|
|
153
|
+
- [docs/developer/core/variables.md](docs/developer/core/variables.md) — `inputs:` / `outputs:` sections, host-facing helpers.
|
|
154
|
+
- [docs/developer/core/runtime.md](docs/developer/core/runtime.md) — `Runtime`, `Runner`, `RunResult`, caller-supplied context.
|
|
155
|
+
- [docs/developer/core/execution-context.md](docs/developer/core/execution-context.md) — the sandboxed `Context`, trust posture, custom Jinja2 filters.
|
|
156
|
+
- [docs/developer/core/methods.md](docs/developer/core/methods.md) — method registry, dispatchers, plugin authoring.
|
|
157
|
+
- [docs/developer/core/flow.md](docs/developer/core/flow.md) — `Block` variants and dispatch.
|
|
158
|
+
- [docs/developer/core/dsl.md](docs/developer/core/dsl.md) — `Value` / `Property`, `ContextBase`, executables.
|
|
159
|
+
- [docs/developer/core/stdlib.md](docs/developer/core/stdlib.md) — built-in actions, evaluators, predicates, iterables.
|
|
160
|
+
|
|
161
|
+
**Internals** — for engine maintainers and tool builders:
|
|
162
|
+
|
|
163
|
+
- [docs/developer/internals/overview.md](docs/developer/internals/overview.md) — source-location tracking, observation, and control as three interlocking pieces.
|
|
164
|
+
- [docs/developer/internals/dsl.md](docs/developer/internals/dsl.md) — `MetadataMixin`, `Source` / `StepMetadata`, the `_meta` field.
|
|
165
|
+
- [docs/developer/internals/yaml-loader.md](docs/developer/internals/yaml-loader.md) — the three loader classes, `subdir_dir` / `current_file` invariants, `!var` / `!include` / `!module` implementation.
|
|
166
|
+
- [docs/developer/internals/execution-observing.md](docs/developer/internals/execution-observing.md) — `ObservableContext`, the event hierarchy, built-in observers, the `ExecutionController`.
|
|
167
|
+
- [docs/developer/internals/debug-command.md](docs/developer/internals/debug-command.md) — how to build a step-by-step debugger on top of the controller + observer pair.
|
|
168
|
+
|
|
169
|
+
---
|
|
170
|
+
|
|
171
|
+
## Dependencies
|
|
172
|
+
|
|
173
|
+
Third-party:
|
|
174
|
+
|
|
175
|
+
- [pydantic](https://docs.pydantic.dev/) (>=2.0) — model validation
|
|
176
|
+
- [PyYAML](https://pyyaml.org/) (>=6.0) and [pyyaml-include](https://pypi.org/project/pyyaml-include/) (>=2.0) — YAML parsing with `!include`
|
|
177
|
+
- [Jinja2](https://palletsprojects.com/p/jinja/) (>=3.0) — `{{ var }}` interpolation in `Property[str]` fields (sandboxed via `SandboxedEnvironment` in the default `Context`)
|
|
178
|
+
- [simpleeval](https://github.com/danthedeckie/simpleeval) (>=1.0) — sandboxed expression evaluator for `- evaluator: evaluate`
|
|
179
|
+
- [NumPy](https://numpy.org/) (>=1.24) — array handling via `vcti-array-tree`
|
|
180
|
+
- [pandas](https://pandas.pydata.org/) (>=2.0) — CSV reading in the `read_file` evaluator and DataFrame iteration in `list_items`
|
|
181
|
+
|
|
182
|
+
VCollab platform packages:
|
|
183
|
+
|
|
184
|
+
- [vcti-array-tree](https://pypi.org/project/vcti-array-tree/) — hierarchical array data
|
|
185
|
+
- [vcti-config](https://pypi.org/project/vcti-config/) — environment-variable decoding (`get_env` evaluator)
|
|
186
|
+
- [vcti-data-scope](https://pypi.org/project/vcti-data-scope/) — `DataScope` / `PathsGroup` types used by the data-scope actions
|
|
187
|
+
- [vcti-enum](https://pypi.org/project/vcti-enum/) — value-generated enums + Pydantic helpers
|
|
188
|
+
- [vcti-error](https://pypi.org/project/vcti-error/) — error codes
|
|
189
|
+
- [vcti-fileloader](https://pypi.org/project/vcti-fileloader/) — pluggable loader registry
|
|
190
|
+
- [vcti-logging](https://pypi.org/project/vcti-logging/) — logger
|
|
191
|
+
- [vcti-lookup](https://pypi.org/project/vcti-lookup/) — `Rule`-based attribute filtering
|
|
192
|
+
- [vcti-path](https://pypi.org/project/vcti-path/) — safe path & filename validation
|
|
193
|
+
- [vcti-path-format](https://pypi.org/project/vcti-path-format/), [vcti-path-format-descriptors](https://pypi.org/project/vcti-path-format-descriptors/) — file-format identification
|
|
194
|
+
- [vcti-path-tree](https://pypi.org/project/vcti-path-tree/) — directory tree scanning
|
|
195
|
+
|
|
196
|
+
Optional extras:
|
|
197
|
+
|
|
198
|
+
- `vcti-ywf[hdf5]` — pulls in [vcti-fileloader-hdf5](https://pypi.org/project/vcti-fileloader-hdf5/), which `Runner` auto-registers if installed.
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "vcti-ywf"
|
|
7
|
+
version = "3.0.1"
|
|
8
|
+
description = "YAML workflow engine — parses, validates, and executes step-based workflows with pluggable Action / Evaluator / Predicate / Iterable methods."
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
authors = [
|
|
11
|
+
{name = "Visual Collaboration Technologies Inc."}
|
|
12
|
+
]
|
|
13
|
+
requires-python = ">=3.12,<3.15"
|
|
14
|
+
dependencies = [
|
|
15
|
+
"pydantic>=2.0",
|
|
16
|
+
"PyYAML>=6.0",
|
|
17
|
+
"pyyaml-include>=2.0",
|
|
18
|
+
"numpy>=1.24",
|
|
19
|
+
"pandas>=2.0",
|
|
20
|
+
"jinja2>=3.0",
|
|
21
|
+
"packaging>=21.0",
|
|
22
|
+
"simpleeval>=1.0",
|
|
23
|
+
"vcti-array-tree>=1.0.0",
|
|
24
|
+
"vcti-config>=3.1.2",
|
|
25
|
+
"vcti-data-scope>=1.0.0",
|
|
26
|
+
"vcti-enum>=1.1.0",
|
|
27
|
+
"vcti-error>=1.0.0",
|
|
28
|
+
"vcti-fileloader>=1.0.0",
|
|
29
|
+
"vcti-logging>=1.0.0",
|
|
30
|
+
"vcti-lookup>=1.0.1",
|
|
31
|
+
"vcti-path>=1.0.3",
|
|
32
|
+
"vcti-path-format>=1.2.0",
|
|
33
|
+
"vcti-path-format-descriptors>=1.1.0",
|
|
34
|
+
"vcti-path-tree>=1.1.1",
|
|
35
|
+
]
|
|
36
|
+
|
|
37
|
+
[tool.setuptools.packages.find]
|
|
38
|
+
where = ["src"]
|
|
39
|
+
include = ["vcti.ywf", "vcti.ywf.*"]
|
|
40
|
+
|
|
41
|
+
[tool.setuptools.package-data]
|
|
42
|
+
"vcti.ywf" = ["py.typed"]
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
hdf5 = ["vcti-fileloader-hdf5>=1.0.0"]
|
|
46
|
+
test = ["pytest", "pytest-cov"]
|
|
47
|
+
lint = ["ruff"]
|
|
48
|
+
typecheck = ["mypy"]
|
|
49
|
+
|
|
50
|
+
[tool.setuptools]
|
|
51
|
+
zip-safe = true
|
|
52
|
+
|
|
53
|
+
[tool.pytest.ini_options]
|
|
54
|
+
# Coverage target is intentionally below 60% — current suite covers in-memory
|
|
55
|
+
# execution paths but not the runtime/loader/runner code. Raise as test
|
|
56
|
+
# coverage grows.
|
|
57
|
+
addopts = "--cov=vcti.ywf --cov-report=term-missing --cov-fail-under=55"
|
|
58
|
+
|
|
59
|
+
[tool.mypy]
|
|
60
|
+
python_version = "3.12"
|
|
61
|
+
files = ["src"]
|
|
62
|
+
namespace_packages = true
|
|
63
|
+
explicit_package_bases = true
|
|
64
|
+
mypy_path = ["src"]
|
|
65
|
+
# strict mode is a longer-term goal; the migrated source is largely untyped.
|
|
66
|
+
# Keep default checks enabled (no implicit Optional, return type checking,
|
|
67
|
+
# etc.) and silence missing-stubs for optional / non-stubbed third-party
|
|
68
|
+
# packages so mypy still catches genuine errors.
|
|
69
|
+
ignore_missing_imports = true
|
|
70
|
+
check_untyped_defs = false
|
|
71
|
+
disallow_untyped_defs = false
|
|
72
|
+
warn_unused_ignores = false
|
|
73
|
+
|
|
74
|
+
[tool.coverage.run]
|
|
75
|
+
branch = true
|
|
76
|
+
|
|
77
|
+
[tool.coverage.report]
|
|
78
|
+
exclude_also = [
|
|
79
|
+
"raise NotImplementedError",
|
|
80
|
+
"if TYPE_CHECKING:",
|
|
81
|
+
"if __name__ == .__main__.:",
|
|
82
|
+
"@(abc\\.)?abstractmethod",
|
|
83
|
+
"\\.\\.\\.",
|
|
84
|
+
]
|
|
85
|
+
|
|
86
|
+
[tool.ruff]
|
|
87
|
+
target-version = "py312"
|
|
88
|
+
line-length = 99
|
|
89
|
+
|
|
90
|
+
[tool.ruff.lint]
|
|
91
|
+
select = ["E", "F", "W", "I", "UP"]
|
|
92
|
+
# E501 (line-too-long) is dropped in favour of letting the formatter handle
|
|
93
|
+
# wrapping; some files (e.g. observer.py) use a column-aligned multi-statement
|
|
94
|
+
# dispatch table that E701 would otherwise flag. Re-enable both as test
|
|
95
|
+
# coverage and code cleanup catch up.
|
|
96
|
+
ignore = ["E501", "E701"]
|
vcti_ywf-3.0.1/setup.cfg
ADDED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# Copyright Visual Collaboration Technologies Inc. All Rights Reserved.
|
|
2
|
+
# See LICENSE for details.
|
|
3
|
+
"""vcti.ywf — YAML Workflow Framework engine.
|
|
4
|
+
|
|
5
|
+
Parses, validates, and executes step-based workflows defined in YAML, with
|
|
6
|
+
pluggable Action / Evaluator / Predicate / Iterable methods.
|
|
7
|
+
|
|
8
|
+
The top-level package re-exports the most common entry points so callers
|
|
9
|
+
can write::
|
|
10
|
+
|
|
11
|
+
from vcti.ywf import Runner, Workflow
|
|
12
|
+
|
|
13
|
+
Plugin authors implementing custom steps will want the method base classes
|
|
14
|
+
and the registry::
|
|
15
|
+
|
|
16
|
+
from vcti.ywf import ActionBase, EvaluatorBase, PredicateBase, IterableBase
|
|
17
|
+
from vcti.ywf import MethodRegistry
|
|
18
|
+
|
|
19
|
+
For everything else (control-flow blocks, execution events, observers,
|
|
20
|
+
loader internals), import from the relevant subpackage directly.
|
|
21
|
+
"""
|
|
22
|
+
|
|
23
|
+
from importlib.metadata import version
|
|
24
|
+
|
|
25
|
+
# Importing stdlib registers built-in methods with MethodRegistry. This must
|
|
26
|
+
# happen before anything that builds the dispatcher unions (flow.block,
|
|
27
|
+
# workflow.workflow) is imported. methods.__init__ also forces this, so
|
|
28
|
+
# importing Runner / Workflow below is safe — but doing it explicitly here
|
|
29
|
+
# makes the dependency direction clear.
|
|
30
|
+
from . import stdlib # noqa: F401
|
|
31
|
+
from .exceptions import (
|
|
32
|
+
WorkflowConfigError,
|
|
33
|
+
WorkflowError,
|
|
34
|
+
WorkflowExecutionError,
|
|
35
|
+
WorkflowParseError,
|
|
36
|
+
)
|
|
37
|
+
from .execution.context import Context
|
|
38
|
+
from .execution.controller import ExecutionController, ExecutionMode
|
|
39
|
+
from .execution.evaluator import ExpressionEvaluator
|
|
40
|
+
from .execution.interpolator import TemplateInterpolator
|
|
41
|
+
from .execution.observable_context import ObservableContext
|
|
42
|
+
from .execution.observer import ExecutionObserver
|
|
43
|
+
from .methods.base import ActionBase, EvaluatorBase, IterableBase, PredicateBase
|
|
44
|
+
from .methods.registry import MethodRegistry
|
|
45
|
+
from .runtime import RUNTIME_VAR, Runner, RunResult, Runtime, get_runtime
|
|
46
|
+
from .workflow.workflow import Workflow
|
|
47
|
+
|
|
48
|
+
__version__ = version("vcti-ywf")
|
|
49
|
+
|
|
50
|
+
__all__ = [
|
|
51
|
+
"__version__",
|
|
52
|
+
# Library entry points
|
|
53
|
+
"Runner",
|
|
54
|
+
"RunResult",
|
|
55
|
+
"Runtime",
|
|
56
|
+
"Workflow",
|
|
57
|
+
"get_runtime",
|
|
58
|
+
"RUNTIME_VAR",
|
|
59
|
+
# Execution
|
|
60
|
+
"Context",
|
|
61
|
+
"ObservableContext",
|
|
62
|
+
"ExpressionEvaluator",
|
|
63
|
+
"TemplateInterpolator",
|
|
64
|
+
"ExecutionController",
|
|
65
|
+
"ExecutionMode",
|
|
66
|
+
"ExecutionObserver",
|
|
67
|
+
# Plugin authoring
|
|
68
|
+
"ActionBase",
|
|
69
|
+
"EvaluatorBase",
|
|
70
|
+
"PredicateBase",
|
|
71
|
+
"IterableBase",
|
|
72
|
+
"MethodRegistry",
|
|
73
|
+
# Errors
|
|
74
|
+
"WorkflowError",
|
|
75
|
+
"WorkflowParseError",
|
|
76
|
+
"WorkflowConfigError",
|
|
77
|
+
"WorkflowExecutionError",
|
|
78
|
+
]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
#!/usr/bin/env python
|
|
2
|
+
|
|
3
|
+
# Copyright (C) 2018 Visual Collaboration Technologies Inc.
|
|
4
|
+
# All Rights Reserved.
|
|
5
|
+
#
|
|
6
|
+
# This file is a property of Visual Collaboration Technologies Inc.
|
|
7
|
+
# Unauthorized access, reproduction or redistribution of any kind is prohibited.
|
|
8
|
+
"""DSL primitives for the YAML Workflow Framework.
|
|
9
|
+
|
|
10
|
+
This package defines the foundational types used across the execution model:
|
|
11
|
+
|
|
12
|
+
- VariableReference: represents a !var tag parsed from YAML
|
|
13
|
+
- Value / Property: field value resolution (literal or variable reference)
|
|
14
|
+
- ContextBase: abstract interface for execution contexts
|
|
15
|
+
- Executable / EvaluatableBase: base interfaces for all executable components
|
|
16
|
+
"""
|