vcti-ywf-template 2.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 (39) hide show
  1. vcti_ywf_template-2.0.0/LICENSE +8 -0
  2. vcti_ywf_template-2.0.0/PKG-INFO +197 -0
  3. vcti_ywf_template-2.0.0/README.md +163 -0
  4. vcti_ywf_template-2.0.0/pyproject.toml +77 -0
  5. vcti_ywf_template-2.0.0/setup.cfg +4 -0
  6. vcti_ywf_template-2.0.0/src/vcti/ywf/template/__init__.py +54 -0
  7. vcti_ywf_template-2.0.0/src/vcti/ywf/template/catalog.py +33 -0
  8. vcti_ywf_template-2.0.0/src/vcti/ywf/template/downloads.py +42 -0
  9. vcti_ywf_template-2.0.0/src/vcti/ywf/template/fastapi.py +129 -0
  10. vcti_ywf_template-2.0.0/src/vcti/ywf/template/file_name.py +18 -0
  11. vcti_ywf_template-2.0.0/src/vcti/ywf/template/files.py +639 -0
  12. vcti_ywf_template-2.0.0/src/vcti/ywf/template/manifest.py +42 -0
  13. vcti_ywf_template-2.0.0/src/vcti/ywf/template/py.typed +0 -0
  14. vcti_ywf_template-2.0.0/src/vcti/ywf/template/repository.py +213 -0
  15. vcti_ywf_template-2.0.0/src/vcti/ywf/template/run_status.py +146 -0
  16. vcti_ywf_template-2.0.0/src/vcti/ywf/template/runs.py +177 -0
  17. vcti_ywf_template-2.0.0/src/vcti/ywf/template/template.py +139 -0
  18. vcti_ywf_template-2.0.0/src/vcti/ywf/template/utils.py +12 -0
  19. vcti_ywf_template-2.0.0/src/vcti/ywf/template/workflow_nodes.py +299 -0
  20. vcti_ywf_template-2.0.0/src/vcti_ywf_template.egg-info/PKG-INFO +197 -0
  21. vcti_ywf_template-2.0.0/src/vcti_ywf_template.egg-info/SOURCES.txt +37 -0
  22. vcti_ywf_template-2.0.0/src/vcti_ywf_template.egg-info/dependency_links.txt +1 -0
  23. vcti_ywf_template-2.0.0/src/vcti_ywf_template.egg-info/requires.txt +21 -0
  24. vcti_ywf_template-2.0.0/src/vcti_ywf_template.egg-info/top_level.txt +1 -0
  25. vcti_ywf_template-2.0.0/tests/test_catalog.py +37 -0
  26. vcti_ywf_template-2.0.0/tests/test_docs.py +201 -0
  27. vcti_ywf_template-2.0.0/tests/test_downloads.py +30 -0
  28. vcti_ywf_template-2.0.0/tests/test_examples.py +268 -0
  29. vcti_ywf_template-2.0.0/tests/test_fastapi.py +142 -0
  30. vcti_ywf_template-2.0.0/tests/test_file_name.py +23 -0
  31. vcti_ywf_template-2.0.0/tests/test_files.py +648 -0
  32. vcti_ywf_template-2.0.0/tests/test_manifest.py +36 -0
  33. vcti_ywf_template-2.0.0/tests/test_repository.py +306 -0
  34. vcti_ywf_template-2.0.0/tests/test_run_status.py +107 -0
  35. vcti_ywf_template-2.0.0/tests/test_runs.py +146 -0
  36. vcti_ywf_template-2.0.0/tests/test_template.py +130 -0
  37. vcti_ywf_template-2.0.0/tests/test_utils.py +26 -0
  38. vcti_ywf_template-2.0.0/tests/test_version.py +15 -0
  39. vcti_ywf_template-2.0.0/tests/test_workflow_nodes.py +421 -0
@@ -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.
@@ -0,0 +1,197 @@
1
+ Metadata-Version: 2.4
2
+ Name: vcti-ywf-template
3
+ Version: 2.0.0
4
+ Summary: Template discovery, repository, and run-state management for the vcti-ywf workflow engine.
5
+ Author: Visual Collaboration Technologies Inc.
6
+ License-Expression: LicenseRef-Proprietary
7
+ Project-URL: Repository, https://github.com/vcollab/vcti-python-ywf-template
8
+ Project-URL: Changelog, https://github.com/vcollab/vcti-python-ywf-template/blob/main/CHANGELOG.md
9
+ Classifier: Operating System :: OS Independent
10
+ Classifier: Programming Language :: Python :: 3.12
11
+ Classifier: Programming Language :: Python :: 3.13
12
+ Classifier: Programming Language :: Python :: 3.14
13
+ Requires-Python: <3.15,>=3.12
14
+ Description-Content-Type: text/markdown
15
+ License-File: LICENSE
16
+ Requires-Dist: pydantic>=2.0
17
+ Requires-Dist: vcti-ywf<6,>=5.0.0
18
+ Requires-Dist: vcti-archive>=1.0.2
19
+ Requires-Dist: vcti-git[pygit2]<3,>=2.0.0
20
+ Requires-Dist: vcti-path>=1.2.0
21
+ Requires-Dist: vcti-path-tree>=1.1.1
22
+ Requires-Dist: vcti-short-uid>=1.2.1
23
+ Provides-Extra: fastapi
24
+ Requires-Dist: fastapi>=0.100; extra == "fastapi"
25
+ Provides-Extra: test
26
+ Requires-Dist: pytest; extra == "test"
27
+ Requires-Dist: pytest-cov; extra == "test"
28
+ Requires-Dist: fastapi>=0.100; extra == "test"
29
+ Provides-Extra: lint
30
+ Requires-Dist: ruff; extra == "lint"
31
+ Provides-Extra: typecheck
32
+ Requires-Dist: mypy; extra == "typecheck"
33
+ Dynamic: license-file
34
+
35
+ # vcti-ywf-template
36
+
37
+ Template discovery, repository, and run-state management for the vcti-ywf workflow engine.
38
+
39
+ ## Overview
40
+
41
+ `vcti-ywf-template` is the template-management layer on top of the
42
+ [`vcti-ywf`](https://pypi.org/project/vcti-ywf/) YAML workflow engine. The
43
+ engine loads and executes one workflow directory; this package manages a
44
+ *directory of templates* around it: listing them as a catalog, reading and
45
+ changing the files inside a template, and recording the state of each run.
46
+ A **template** is a directory holding a workflow under `source/` and its
47
+ per-run state under `runs/`; a **repository** is a directory of templates,
48
+ optionally cloned from a Git remote.
49
+
50
+ Install it when you are building a host application — a REST service, a
51
+ desktop GUI, an editor extension — that lets users browse, upload or run
52
+ workflow templates. To execute a known workflow headless, `vcti-ywf` alone
53
+ is enough.
54
+
55
+ ## Installation
56
+
57
+ ```bash
58
+ pip install vcti-ywf-template
59
+ ```
60
+
61
+ ### In `requirements.txt`
62
+
63
+ ```
64
+ vcti-ywf-template>=2.0.0
65
+ ```
66
+
67
+ ### In `pyproject.toml` dependencies
68
+
69
+ ```toml
70
+ dependencies = [
71
+ "vcti-ywf-template>=2.0.0",
72
+ ]
73
+ ```
74
+
75
+ ---
76
+
77
+ ## Quick Start
78
+
79
+ A template is a directory with a root workflow node named by
80
+ `source/.entrypoint`. Write the smallest valid one, then open the directory
81
+ that holds it as a repository:
82
+
83
+ ```python
84
+ from pathlib import Path
85
+
86
+ from vcti.ywf.template import TemplatesRepository, get_template_catalog
87
+
88
+ node = Path("templates/modal-analysis/source/main")
89
+ node.mkdir(parents=True)
90
+ (node.parent / ".entrypoint").write_text("main", encoding="utf-8")
91
+ (node / "about.yaml").write_text("title: Modal Analysis\n", encoding="utf-8")
92
+
93
+ # Point at an existing directory of templates, or pass remote_repo_url=
94
+ # to clone one on first use.
95
+ repo = TemplatesRepository(Path("templates"))
96
+
97
+ catalog = get_template_catalog(repo)
98
+ for manifest in catalog.root:
99
+ title = manifest.metadata.title if manifest.metadata else "(no metadata)"
100
+ print(manifest.id, "—", title)
101
+ ```
102
+
103
+ Open a single template to reach its workflow nodes, files and runs:
104
+
105
+ ```python
106
+ template = repo.get_template("modal-analysis")
107
+ print(template.workflow_nodes.root_node) # main
108
+
109
+ # Files are addressed by POSIX-style IDs relative to the template root.
110
+ print(template.files.resolve_path("source/main/about.yaml", must_be_file=True))
111
+ ```
112
+
113
+ The package records the state of a run; launching the runner is the host
114
+ application's job:
115
+
116
+ ```python
117
+ from vcti.ywf.template import RunState, RunStatusManager
118
+
119
+ run_id = template.runs.create_run()
120
+ template.runs.set_active_run(run_id)
121
+
122
+ status = RunStatusManager(template.runs.get_run_path(run_id))
123
+ status.update(state=RunState.RUNNING, pid=12345)
124
+ status.update(state=RunState.COMPLETED, pid=None) # None clears the PID
125
+
126
+ print(template.runs.get_run_status(run_id).state) # completed
127
+ ```
128
+
129
+ Uploads are binary streams and downloads are descriptions, so the
130
+ package needs no web framework:
131
+
132
+ ```python
133
+ import io
134
+
135
+ template.files.upload("notes.txt", io.BytesIO(b"hello"))
136
+
137
+ download = template.download() # the template as a .vyf archive
138
+ print(download.filename) # modal-analysis.vyf
139
+ archive_bytes = b"".join(download.chunks) # runs/ is left out by default
140
+ ```
141
+
142
+ With FastAPI, install the `fastapi` extra
143
+ (`pip install vcti-ywf-template[fastapi]`) and use the adapter module
144
+ `vcti.ywf.template.fastapi` to convert `UploadFile` and responses to and
145
+ from these types. [docs/patterns.md](docs/patterns.md) shows the routes,
146
+ along with validating uploads, safe replacement, run tracking, and the
147
+ pitfalls worth knowing.
148
+
149
+ ---
150
+
151
+ ## Key API
152
+
153
+ | Name | What it is |
154
+ |------|------------|
155
+ | `TemplatesRepository` | A directory of templates: list, get, create from an uploaded ZIP, and clone or pull from a Git remote. |
156
+ | `TemplateCatalog`, `get_template_catalog` | The manifests of every valid template in a repository, serialized as a JSON array. |
157
+ | `TemplateManifest`, `get_template_manifest` | A template's ID and the metadata of its root workflow node. |
158
+ | `Template` | One template directory: `files`, `workflow_nodes` and `runs`, plus download, duplicate, rename and delete. |
159
+ | `TemplateFiles` | File operations confined to the template root: resolve, tree, upload, download, rename, duplicate, delete. |
160
+ | `WorkflowNodes`, `ValidationProblem` | Read access to the workflow nodes under `source/`: the root node, its metadata and declared variables, and `validate()` for a full check. |
161
+ | `TemplateRuns` | The run directories under `runs/` and the active-run pointer. |
162
+ | `FileDownload`, `ArchiveDownload` | What the download methods return: a file's path, or the chunks of a ZIP, with the name to send it under. |
163
+ | `vcti.ywf.template.fastapi` | Optional adapter: `download_response`, `upload_file`, `create_template_from_upload`. |
164
+ | `RunState`, `RunStatus`, `RunStatusManager` | The state of a run and its persistence in `status.json`. |
165
+
166
+ ---
167
+
168
+ ## Dependencies
169
+
170
+ - [`vcti-ywf`](https://pypi.org/project/vcti-ywf/) 5 — the workflow engine
171
+ (`vcti.ywf.engine`) whose workflow directories this package manages.
172
+ - [`vcti-archive`](https://pypi.org/project/vcti-archive/) — ZIP extraction
173
+ for uploads and streaming ZIP downloads.
174
+ - [`vcti-git`](https://pypi.org/project/vcti-git/) 2 (with the `pygit2`
175
+ backend) — clone and pull for Git-backed repositories.
176
+ - [`vcti-path`](https://pypi.org/project/vcti-path/) — file-ID resolution
177
+ and file-name validation.
178
+ - [`vcti-short-uid`](https://pypi.org/project/vcti-short-uid/) — generated
179
+ template and run IDs.
180
+ - [`vcti-path-tree`](https://pypi.org/project/vcti-path-tree/) — the
181
+ directory tree of a template's files.
182
+ - [`pydantic`](https://pypi.org/project/pydantic/) — the manifest,
183
+ catalog and run-status models.
184
+
185
+ Optional: [`fastapi`](https://pypi.org/project/fastapi/), installed with
186
+ the `fastapi` extra, for the adapter module only.
187
+
188
+ ---
189
+
190
+ ## Documentation
191
+
192
+ | If you want to… | Read |
193
+ |---|---|
194
+ | Get started using the package | Quick Start above |
195
+ | Build a host application: FastAPI routes, uploads, runs, pitfalls | [docs/patterns.md](docs/patterns.md) |
196
+ | Understand the layers, the on-disk layout and the package's boundaries | [docs/design.md](docs/design.md) |
197
+ | Navigate and understand the source | [docs/source-guide.md](docs/source-guide.md) |
@@ -0,0 +1,163 @@
1
+ # vcti-ywf-template
2
+
3
+ Template discovery, repository, and run-state management for the vcti-ywf workflow engine.
4
+
5
+ ## Overview
6
+
7
+ `vcti-ywf-template` is the template-management layer on top of the
8
+ [`vcti-ywf`](https://pypi.org/project/vcti-ywf/) YAML workflow engine. The
9
+ engine loads and executes one workflow directory; this package manages a
10
+ *directory of templates* around it: listing them as a catalog, reading and
11
+ changing the files inside a template, and recording the state of each run.
12
+ A **template** is a directory holding a workflow under `source/` and its
13
+ per-run state under `runs/`; a **repository** is a directory of templates,
14
+ optionally cloned from a Git remote.
15
+
16
+ Install it when you are building a host application — a REST service, a
17
+ desktop GUI, an editor extension — that lets users browse, upload or run
18
+ workflow templates. To execute a known workflow headless, `vcti-ywf` alone
19
+ is enough.
20
+
21
+ ## Installation
22
+
23
+ ```bash
24
+ pip install vcti-ywf-template
25
+ ```
26
+
27
+ ### In `requirements.txt`
28
+
29
+ ```
30
+ vcti-ywf-template>=2.0.0
31
+ ```
32
+
33
+ ### In `pyproject.toml` dependencies
34
+
35
+ ```toml
36
+ dependencies = [
37
+ "vcti-ywf-template>=2.0.0",
38
+ ]
39
+ ```
40
+
41
+ ---
42
+
43
+ ## Quick Start
44
+
45
+ A template is a directory with a root workflow node named by
46
+ `source/.entrypoint`. Write the smallest valid one, then open the directory
47
+ that holds it as a repository:
48
+
49
+ ```python
50
+ from pathlib import Path
51
+
52
+ from vcti.ywf.template import TemplatesRepository, get_template_catalog
53
+
54
+ node = Path("templates/modal-analysis/source/main")
55
+ node.mkdir(parents=True)
56
+ (node.parent / ".entrypoint").write_text("main", encoding="utf-8")
57
+ (node / "about.yaml").write_text("title: Modal Analysis\n", encoding="utf-8")
58
+
59
+ # Point at an existing directory of templates, or pass remote_repo_url=
60
+ # to clone one on first use.
61
+ repo = TemplatesRepository(Path("templates"))
62
+
63
+ catalog = get_template_catalog(repo)
64
+ for manifest in catalog.root:
65
+ title = manifest.metadata.title if manifest.metadata else "(no metadata)"
66
+ print(manifest.id, "—", title)
67
+ ```
68
+
69
+ Open a single template to reach its workflow nodes, files and runs:
70
+
71
+ ```python
72
+ template = repo.get_template("modal-analysis")
73
+ print(template.workflow_nodes.root_node) # main
74
+
75
+ # Files are addressed by POSIX-style IDs relative to the template root.
76
+ print(template.files.resolve_path("source/main/about.yaml", must_be_file=True))
77
+ ```
78
+
79
+ The package records the state of a run; launching the runner is the host
80
+ application's job:
81
+
82
+ ```python
83
+ from vcti.ywf.template import RunState, RunStatusManager
84
+
85
+ run_id = template.runs.create_run()
86
+ template.runs.set_active_run(run_id)
87
+
88
+ status = RunStatusManager(template.runs.get_run_path(run_id))
89
+ status.update(state=RunState.RUNNING, pid=12345)
90
+ status.update(state=RunState.COMPLETED, pid=None) # None clears the PID
91
+
92
+ print(template.runs.get_run_status(run_id).state) # completed
93
+ ```
94
+
95
+ Uploads are binary streams and downloads are descriptions, so the
96
+ package needs no web framework:
97
+
98
+ ```python
99
+ import io
100
+
101
+ template.files.upload("notes.txt", io.BytesIO(b"hello"))
102
+
103
+ download = template.download() # the template as a .vyf archive
104
+ print(download.filename) # modal-analysis.vyf
105
+ archive_bytes = b"".join(download.chunks) # runs/ is left out by default
106
+ ```
107
+
108
+ With FastAPI, install the `fastapi` extra
109
+ (`pip install vcti-ywf-template[fastapi]`) and use the adapter module
110
+ `vcti.ywf.template.fastapi` to convert `UploadFile` and responses to and
111
+ from these types. [docs/patterns.md](docs/patterns.md) shows the routes,
112
+ along with validating uploads, safe replacement, run tracking, and the
113
+ pitfalls worth knowing.
114
+
115
+ ---
116
+
117
+ ## Key API
118
+
119
+ | Name | What it is |
120
+ |------|------------|
121
+ | `TemplatesRepository` | A directory of templates: list, get, create from an uploaded ZIP, and clone or pull from a Git remote. |
122
+ | `TemplateCatalog`, `get_template_catalog` | The manifests of every valid template in a repository, serialized as a JSON array. |
123
+ | `TemplateManifest`, `get_template_manifest` | A template's ID and the metadata of its root workflow node. |
124
+ | `Template` | One template directory: `files`, `workflow_nodes` and `runs`, plus download, duplicate, rename and delete. |
125
+ | `TemplateFiles` | File operations confined to the template root: resolve, tree, upload, download, rename, duplicate, delete. |
126
+ | `WorkflowNodes`, `ValidationProblem` | Read access to the workflow nodes under `source/`: the root node, its metadata and declared variables, and `validate()` for a full check. |
127
+ | `TemplateRuns` | The run directories under `runs/` and the active-run pointer. |
128
+ | `FileDownload`, `ArchiveDownload` | What the download methods return: a file's path, or the chunks of a ZIP, with the name to send it under. |
129
+ | `vcti.ywf.template.fastapi` | Optional adapter: `download_response`, `upload_file`, `create_template_from_upload`. |
130
+ | `RunState`, `RunStatus`, `RunStatusManager` | The state of a run and its persistence in `status.json`. |
131
+
132
+ ---
133
+
134
+ ## Dependencies
135
+
136
+ - [`vcti-ywf`](https://pypi.org/project/vcti-ywf/) 5 — the workflow engine
137
+ (`vcti.ywf.engine`) whose workflow directories this package manages.
138
+ - [`vcti-archive`](https://pypi.org/project/vcti-archive/) — ZIP extraction
139
+ for uploads and streaming ZIP downloads.
140
+ - [`vcti-git`](https://pypi.org/project/vcti-git/) 2 (with the `pygit2`
141
+ backend) — clone and pull for Git-backed repositories.
142
+ - [`vcti-path`](https://pypi.org/project/vcti-path/) — file-ID resolution
143
+ and file-name validation.
144
+ - [`vcti-short-uid`](https://pypi.org/project/vcti-short-uid/) — generated
145
+ template and run IDs.
146
+ - [`vcti-path-tree`](https://pypi.org/project/vcti-path-tree/) — the
147
+ directory tree of a template's files.
148
+ - [`pydantic`](https://pypi.org/project/pydantic/) — the manifest,
149
+ catalog and run-status models.
150
+
151
+ Optional: [`fastapi`](https://pypi.org/project/fastapi/), installed with
152
+ the `fastapi` extra, for the adapter module only.
153
+
154
+ ---
155
+
156
+ ## Documentation
157
+
158
+ | If you want to… | Read |
159
+ |---|---|
160
+ | Get started using the package | Quick Start above |
161
+ | Build a host application: FastAPI routes, uploads, runs, pitfalls | [docs/patterns.md](docs/patterns.md) |
162
+ | Understand the layers, the on-disk layout and the package's boundaries | [docs/design.md](docs/design.md) |
163
+ | Navigate and understand the source | [docs/source-guide.md](docs/source-guide.md) |
@@ -0,0 +1,77 @@
1
+ [build-system]
2
+ requires = ["setuptools>=77.0", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "vcti-ywf-template"
7
+ version = "2.0.0"
8
+ description = "Template discovery, repository, and run-state management for the vcti-ywf workflow engine."
9
+ readme = "README.md"
10
+ authors = [
11
+ {name = "Visual Collaboration Technologies Inc."}
12
+ ]
13
+ license = "LicenseRef-Proprietary"
14
+ license-files = ["LICENSE"]
15
+ classifiers = [
16
+ "Operating System :: OS Independent",
17
+ "Programming Language :: Python :: 3.12",
18
+ "Programming Language :: Python :: 3.13",
19
+ "Programming Language :: Python :: 3.14",
20
+ ]
21
+ requires-python = ">=3.12,<3.15"
22
+ dependencies = [
23
+ "pydantic>=2.0",
24
+ "vcti-ywf>=5.0.0,<6",
25
+ "vcti-archive>=1.0.2",
26
+ "vcti-git[pygit2]>=2.0.0,<3",
27
+ "vcti-path>=1.2.0",
28
+ "vcti-path-tree>=1.1.1",
29
+ "vcti-short-uid>=1.2.1",
30
+ ]
31
+
32
+ [project.urls]
33
+ Repository = "https://github.com/vcollab/vcti-python-ywf-template"
34
+ Changelog = "https://github.com/vcollab/vcti-python-ywf-template/blob/main/CHANGELOG.md"
35
+
36
+ [tool.setuptools.packages.find]
37
+ where = ["src"]
38
+ include = ["vcti.ywf.template", "vcti.ywf.template.*"]
39
+
40
+ [tool.setuptools.package-data]
41
+ "vcti.ywf.template" = ["py.typed"]
42
+
43
+ [project.optional-dependencies]
44
+ fastapi = ["fastapi>=0.100"]
45
+ test = ["pytest", "pytest-cov", "fastapi>=0.100"]
46
+ lint = ["ruff"]
47
+ typecheck = ["mypy"]
48
+
49
+ [tool.pytest.ini_options]
50
+ addopts = "--cov=vcti.ywf.template --cov-report=term-missing --cov-fail-under=95"
51
+
52
+ [tool.mypy]
53
+ python_version = "3.12"
54
+ strict = true
55
+ files = ["src"]
56
+ namespace_packages = true
57
+ explicit_package_bases = true
58
+ mypy_path = ["src"]
59
+
60
+ [tool.coverage.run]
61
+ branch = true
62
+
63
+ [tool.coverage.report]
64
+ exclude_also = [
65
+ "raise NotImplementedError",
66
+ "if TYPE_CHECKING:",
67
+ "if __name__ == .__main__.:",
68
+ "@(abc\\.)?abstractmethod",
69
+ "^\\s*\\.\\.\\.\\s*$",
70
+ ]
71
+
72
+ [tool.ruff]
73
+ target-version = "py312"
74
+ line-length = 99
75
+
76
+ [tool.ruff.lint]
77
+ select = ["E", "F", "W", "I", "UP"]
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,54 @@
1
+ # Copyright Visual Collaboration Technologies Inc. All Rights Reserved.
2
+ # See LICENSE for details.
3
+ """vcti.ywf.template — template management for the vcti-ywf workflow engine.
4
+
5
+ Provides discovery, repository (local + Git-backed), file management,
6
+ and run-state tracking for workflow templates. Built on top of
7
+ ``vcti.ywf`` (the workflow engine), which it depends on but does not
8
+ modify.
9
+
10
+ Common imports::
11
+
12
+ from vcti.ywf.template import (
13
+ Template,
14
+ TemplateCatalog,
15
+ TemplatesRepository,
16
+ TemplateManifest,
17
+ TemplateRuns,
18
+ RunStatus,
19
+ get_template_catalog,
20
+ )
21
+ """
22
+
23
+ from importlib.metadata import version
24
+
25
+ from .catalog import TemplateCatalog, get_template_catalog
26
+ from .downloads import ArchiveDownload, FileDownload
27
+ from .files import TemplateFiles
28
+ from .manifest import TemplateManifest, get_template_manifest
29
+ from .repository import TemplatesRepository
30
+ from .run_status import RunState, RunStatus, RunStatusManager
31
+ from .runs import TemplateRuns
32
+ from .template import Template
33
+ from .workflow_nodes import ValidationProblem, WorkflowNodes
34
+
35
+ __version__ = version("vcti-ywf-template")
36
+
37
+ __all__ = [
38
+ "__version__",
39
+ "ArchiveDownload",
40
+ "FileDownload",
41
+ "Template",
42
+ "TemplateCatalog",
43
+ "TemplateFiles",
44
+ "TemplateManifest",
45
+ "TemplateRuns",
46
+ "TemplatesRepository",
47
+ "RunState",
48
+ "RunStatus",
49
+ "RunStatusManager",
50
+ "ValidationProblem",
51
+ "WorkflowNodes",
52
+ "get_template_catalog",
53
+ "get_template_manifest",
54
+ ]
@@ -0,0 +1,33 @@
1
+ # Copyright Visual Collaboration Technologies Inc. All Rights Reserved.
2
+ # See LICENSE for details.
3
+ """The template catalog: the manifests of every valid template in a repository."""
4
+
5
+ from pydantic import RootModel
6
+
7
+ from .manifest import TemplateManifest, get_template_manifest
8
+ from .repository import TemplatesRepository
9
+
10
+
11
+ class TemplateCatalog(RootModel[list[TemplateManifest]]):
12
+ """
13
+ Container for a collection of template manifests.
14
+
15
+ Attributes:
16
+ root (list[TemplateManifest]): List of template manifests.
17
+ """
18
+
19
+ root: list[TemplateManifest]
20
+
21
+
22
+ def get_template_catalog(templates_repo: TemplatesRepository) -> TemplateCatalog:
23
+ """
24
+ Retrieve the template catalog from the specified repository.
25
+
26
+ Args:
27
+ templates_repo (TemplatesRepository): The repository to fetch templates from.
28
+
29
+ Returns:
30
+ TemplateCatalog: A catalog containing all available templates.
31
+ """
32
+ templates_list = templates_repo.list_templates()
33
+ return TemplateCatalog(root=[get_template_manifest(template) for template in templates_list])
@@ -0,0 +1,42 @@
1
+ # Copyright Visual Collaboration Technologies Inc. All Rights Reserved.
2
+ # See LICENSE for details.
3
+ """Framework-neutral descriptions of a download.
4
+
5
+ The download methods return one of these instead of an HTTP response, so the
6
+ package depends on no web framework. A host turns the description into
7
+ whatever its framework sends; ``vcti.ywf.template.fastapi`` does that for
8
+ FastAPI.
9
+ """
10
+
11
+ from collections.abc import Iterable
12
+ from dataclasses import dataclass
13
+ from pathlib import Path
14
+
15
+
16
+ @dataclass(frozen=True)
17
+ class FileDownload:
18
+ """A single file to send as it is on disk.
19
+
20
+ Attributes:
21
+ path: Absolute path of the file.
22
+ filename: The name the recipient should save it under.
23
+ """
24
+
25
+ path: Path
26
+ filename: str
27
+
28
+
29
+ @dataclass(frozen=True)
30
+ class ArchiveDownload:
31
+ """A directory to send as a ZIP archive, produced as it is read.
32
+
33
+ Attributes:
34
+ chunks: The archive's bytes, yielded in order. Iterating starts the
35
+ archiving; each iteration produces an independent stream.
36
+ filename: The name the recipient should save the archive under.
37
+ media_type: The content type of the archive.
38
+ """
39
+
40
+ chunks: Iterable[bytes]
41
+ filename: str
42
+ media_type: str = "application/zip"