flowgraph 0.1.2__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 (80) hide show
  1. flowgraph-0.1.2/LICENSE +29 -0
  2. flowgraph-0.1.2/PKG-INFO +150 -0
  3. flowgraph-0.1.2/README.md +104 -0
  4. flowgraph-0.1.2/pyproject.toml +83 -0
  5. flowgraph-0.1.2/setup.cfg +4 -0
  6. flowgraph-0.1.2/src/flowgraph/__init__.py +9 -0
  7. flowgraph-0.1.2/src/flowgraph/__main__.py +6 -0
  8. flowgraph-0.1.2/src/flowgraph/adapters/__init__.py +141 -0
  9. flowgraph-0.1.2/src/flowgraph/adapters/controls.py +96 -0
  10. flowgraph-0.1.2/src/flowgraph/adapters/cosapp.py +195 -0
  11. flowgraph-0.1.2/src/flowgraph/adapters/data_types.py +59 -0
  12. flowgraph-0.1.2/src/flowgraph/adapters/documentation.py +45 -0
  13. flowgraph-0.1.2/src/flowgraph/adapters/field_ops.py +121 -0
  14. flowgraph-0.1.2/src/flowgraph/adapters/file_conversion.py +393 -0
  15. flowgraph-0.1.2/src/flowgraph/adapters/files.py +191 -0
  16. flowgraph-0.1.2/src/flowgraph/adapters/filters.py +173 -0
  17. flowgraph-0.1.2/src/flowgraph/adapters/image_tools.py +394 -0
  18. flowgraph-0.1.2/src/flowgraph/adapters/mesh_creation_tools.py +431 -0
  19. flowgraph-0.1.2/src/flowgraph/adapters/mesh_generations.py +58 -0
  20. flowgraph-0.1.2/src/flowgraph/adapters/mesh_ops.py +362 -0
  21. flowgraph-0.1.2/src/flowgraph/adapters/paraview.py +39 -0
  22. flowgraph-0.1.2/src/flowgraph/adapters/plaid_bridge.py +205 -0
  23. flowgraph-0.1.2/src/flowgraph/adapters/readers.py +215 -0
  24. flowgraph-0.1.2/src/flowgraph/adapters/remote_files.py +118 -0
  25. flowgraph-0.1.2/src/flowgraph/adapters/simple_sources.py +199 -0
  26. flowgraph-0.1.2/src/flowgraph/adapters/sinks.py +80 -0
  27. flowgraph-0.1.2/src/flowgraph/adapters/user_code.py +196 -0
  28. flowgraph-0.1.2/src/flowgraph/adapters/workflow.py +176 -0
  29. flowgraph-0.1.2/src/flowgraph/adapters/workflow_interfaces.py +78 -0
  30. flowgraph-0.1.2/src/flowgraph/adapters/writers.py +159 -0
  31. flowgraph-0.1.2/src/flowgraph/application/__init__.py +1 -0
  32. flowgraph-0.1.2/src/flowgraph/application/node_registry.py +14 -0
  33. flowgraph-0.1.2/src/flowgraph/application/port_conversions.py +63 -0
  34. flowgraph-0.1.2/src/flowgraph/application/wasm_execution.py +132 -0
  35. flowgraph-0.1.2/src/flowgraph/application/workflow_cli.py +417 -0
  36. flowgraph-0.1.2/src/flowgraph/application/workflow_core.py +1193 -0
  37. flowgraph-0.1.2/src/flowgraph/application/workflow_history.py +93 -0
  38. flowgraph-0.1.2/src/flowgraph/application/workflow_io.py +393 -0
  39. flowgraph-0.1.2/src/flowgraph/application/workflow_layout.py +170 -0
  40. flowgraph-0.1.2/src/flowgraph/application/workflow_web_catalog.py +143 -0
  41. flowgraph-0.1.2/src/flowgraph/application/workflows.py +7 -0
  42. flowgraph-0.1.2/src/flowgraph/core_cli.py +81 -0
  43. flowgraph-0.1.2/src/flowgraph/domain/__init__.py +5 -0
  44. flowgraph-0.1.2/src/flowgraph/domain/mesh_document.py +91 -0
  45. flowgraph-0.1.2/src/flowgraph/examples/AllFilters.py +19 -0
  46. flowgraph-0.1.2/src/flowgraph/examples/convert_format.py +21 -0
  47. flowgraph-0.1.2/src/flowgraph/resources.py +29 -0
  48. flowgraph-0.1.2/src/flowgraph/testdata/AllFilters.json +390 -0
  49. flowgraph-0.1.2/src/flowgraph/testdata/FlowGraph.h5 +0 -0
  50. flowgraph-0.1.2/src/flowgraph/testdata/FlowGraph.stl +0 -0
  51. flowgraph-0.1.2/src/flowgraph/testdata/FlowGraph.xdmf +22 -0
  52. flowgraph-0.1.2/src/flowgraph/testdata/SimpleReadMesh.json +70 -0
  53. flowgraph-0.1.2/src/flowgraph/testdata/SpherePoints.csv +83 -0
  54. flowgraph-0.1.2/src/flowgraph/testdata/muscat-muscat-mesh-conversion.json +101 -0
  55. flowgraph-0.1.2/src/flowgraph/version.py +3 -0
  56. flowgraph-0.1.2/src/flowgraph.egg-info/PKG-INFO +150 -0
  57. flowgraph-0.1.2/src/flowgraph.egg-info/SOURCES.txt +78 -0
  58. flowgraph-0.1.2/src/flowgraph.egg-info/dependency_links.txt +1 -0
  59. flowgraph-0.1.2/src/flowgraph.egg-info/entry_points.txt +2 -0
  60. flowgraph-0.1.2/src/flowgraph.egg-info/requires.txt +23 -0
  61. flowgraph-0.1.2/src/flowgraph.egg-info/top_level.txt +1 -0
  62. flowgraph-0.1.2/tests/test_core_gui_boundary.py +23 -0
  63. flowgraph-0.1.2/tests/test_cosapp.py +85 -0
  64. flowgraph-0.1.2/tests/test_file_conversion.py +232 -0
  65. flowgraph-0.1.2/tests/test_headless_boundary.py +26 -0
  66. flowgraph-0.1.2/tests/test_image_tools.py +364 -0
  67. flowgraph-0.1.2/tests/test_mesh_creation_tools.py +115 -0
  68. flowgraph-0.1.2/tests/test_mesh_ops.py +381 -0
  69. flowgraph-0.1.2/tests/test_muscat_vtk.py +17 -0
  70. flowgraph-0.1.2/tests/test_packaging.py +53 -0
  71. flowgraph-0.1.2/tests/test_plaid_bridge.py +172 -0
  72. flowgraph-0.1.2/tests/test_readers.py +125 -0
  73. flowgraph-0.1.2/tests/test_remote_files.py +167 -0
  74. flowgraph-0.1.2/tests/test_wasm_execution.py +119 -0
  75. flowgraph-0.1.2/tests/test_workflow_cli.py +308 -0
  76. flowgraph-0.1.2/tests/test_workflow_core.py +524 -0
  77. flowgraph-0.1.2/tests/test_workflow_history.py +64 -0
  78. flowgraph-0.1.2/tests/test_workflow_io.py +374 -0
  79. flowgraph-0.1.2/tests/test_workflow_web_catalog.py +50 -0
  80. flowgraph-0.1.2/tests/test_writers.py +131 -0
@@ -0,0 +1,29 @@
1
+ BSD 3-Clause License
2
+
3
+ Copyright (c) 2026, Felipe Bordeu
4
+ All rights reserved.
5
+
6
+ Redistribution and use in source and binary forms, with or without
7
+ modification, are permitted provided that the following conditions are met:
8
+
9
+ 1. Redistributions of source code must retain the above copyright notice, this
10
+ list of conditions and the following disclaimer.
11
+
12
+ 2. Redistributions in binary form must reproduce the above copyright notice,
13
+ this list of conditions and the following disclaimer in the documentation
14
+ and/or other materials provided with the distribution.
15
+
16
+ 3. Neither the name of the copyright holder nor the names of its
17
+ contributors may be used to endorse or promote products derived from
18
+ this software without specific prior written permission.
19
+
20
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -0,0 +1,150 @@
1
+ Metadata-Version: 2.4
2
+ Name: flowgraph
3
+ Version: 0.1.2
4
+ Summary: Headless typed workflow engine and execution runtime
5
+ Author: Felipe Bordeu
6
+ Maintainer: Felipe Bordeu
7
+ License-Expression: BSD-3-Clause
8
+ Project-URL: Homepage, https://github.com/FBW-Engineering-Solutions/FlowGraph
9
+ Project-URL: Repository, https://github.com/FBW-Engineering-Solutions/FlowGraph.git
10
+ Project-URL: Issues, https://github.com/FBW-Engineering-Solutions/FlowGraph/issues
11
+ Keywords: workflow,graph,mesh,scientific-computing,automation
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Intended Audience :: Science/Research
15
+ Classifier: Programming Language :: Python :: 3
16
+ Classifier: Programming Language :: Python :: 3.11
17
+ Classifier: Programming Language :: Python :: 3.12
18
+ Classifier: Programming Language :: Python :: 3.13
19
+ Classifier: Programming Language :: Python :: 3.14
20
+ Classifier: Operating System :: OS Independent
21
+ Classifier: Topic :: Scientific/Engineering
22
+ Classifier: Topic :: Software Development :: Libraries :: Python Modules
23
+ Requires-Python: >=3.11
24
+ Description-Content-Type: text/markdown
25
+ License-File: LICENSE
26
+ Requires-Dist: vtk>=9.2
27
+ Requires-Dist: muscat>=2.5.2
28
+ Requires-Dist: meshio>=5.3
29
+ Requires-Dist: meshlane>=5.5.0
30
+ Requires-Dist: scipy>=1.10
31
+ Requires-Dist: pandas
32
+ Requires-Dist: h5py
33
+ Requires-Dist: pillow>=10.0
34
+ Provides-Extra: dev
35
+ Requires-Dist: pytest>=8.0; extra == "dev"
36
+ Requires-Dist: pytest-cov>=5.0; extra == "dev"
37
+ Requires-Dist: ruff>=0.6; extra == "dev"
38
+ Provides-Extra: ml
39
+ Requires-Dist: pyplaid; extra == "ml"
40
+ Provides-Extra: cosapp
41
+ Requires-Dist: cosapp>=1.6.1; extra == "cosapp"
42
+ Provides-Extra: ci
43
+ Requires-Dist: cosapp>=1.6.1; extra == "ci"
44
+ Requires-Dist: pycgns; extra == "ci"
45
+ Dynamic: license-file
46
+
47
+ # FlowGraph Core
48
+
49
+ `FlowGraph` is the GUI-free Python workflow engine. It provides typed workflow
50
+ composition, validation, persistence, execution, adapters, mesh and image data
51
+ operations, browser-WASM execution support, and metadata-only catalog export
52
+ for compatible external clients.
53
+
54
+ > **Alpha status:** FlowGraph Core `0.1.x` is an alpha series for evaluation,
55
+ > development, experimentation, and early adopter feedback. APIs and workflow
56
+ > behavior may change before `1.0.0`. See [`Release Policy`](docs/policies/release-policy.md).
57
+
58
+ ## Development
59
+
60
+ ```bash
61
+ uv sync --extra dev
62
+ uv run pytest
63
+ uv run ruff check .
64
+ ```
65
+
66
+ See [`Contributing`](.github/CONTRIBUTING.md) for prerequisites, development
67
+ workflow, testing, documentation, and pull-request expectations.
68
+
69
+ ## Headless workflows
70
+
71
+ The `flowgraph` command is headless and has no GUI runtime dependency:
72
+
73
+ ```bash
74
+ uv run flowgraph inspect workflow.json
75
+ uv run flowgraph run workflow.json --input name=value
76
+ uv run flowgraph run workflow.json --override node-id.parameter=value
77
+ uv run flowgraph run workflow.json --json-output results.json
78
+ ```
79
+
80
+ Workflows use the versioned `flowgraph-workflow` JSON format. Core validation and
81
+ execution are UI-independent.
82
+
83
+ ## Package artifacts
84
+
85
+ Build the portable, pure-Python source distribution and wheel with:
86
+
87
+ ```bash
88
+ uv build --out-dir dist/
89
+ ```
90
+
91
+ The resulting wheel is compatible with all supported Python platforms. See
92
+ `packaging/README.md` for release details.
93
+
94
+ The initial supported publication channels are GitHub source releases and
95
+ PyPI. Conda, Docker, operating-system package managers, and third-party mirrors
96
+ are not supported release channels at this time. See
97
+ [`Release Channels`](docs/policies/release-channels.md) for the release policy.
98
+
99
+ FlowGraph Core declares Python 3.11 or newer. CI covers Python 3.11 and 3.13 on
100
+ GitHub-hosted Ubuntu, Windows, and macOS runners; a platform/version combination
101
+ is supported only after its release-candidate job passes. See
102
+ [`Support Policy`](docs/policies/support-policy.md) for compatibility, deprecation,
103
+ maintenance, and unsupported-use policies.
104
+
105
+ ## Catalog export
106
+
107
+ FlowGraph can export non-executable node metadata for tools that need to author
108
+ or structurally validate workflow JSON:
109
+
110
+ ```bash
111
+ uv run python -m flowgraph.application.workflow_web_catalog node-catalog.json
112
+ ```
113
+
114
+ The catalog intentionally excludes node executors and other callable runtime
115
+ behavior.
116
+
117
+ ## Documentation and support
118
+
119
+ - [`Architecture`](docs/architecture.md) describes the core boundaries and workflow
120
+ model.
121
+ - [`Support Policy`](docs/policies/support-policy.md) describes supported environments and
122
+ compatibility expectations.
123
+ - [`SECURITY.md`](SECURITY.md) explains private vulnerability reporting and the
124
+ security boundaries of workflows and adapters.
125
+ - [`Changelog`](docs/changelog.md) records release changes and known limitations.
126
+ - [`docs/workflow-format.md`](docs/workflow-format.md) documents persistence,
127
+ compatibility, and capability boundaries.
128
+
129
+ ## Optional integrations
130
+
131
+ The `ml` extra enables the PyPlaid adapter and the `cosapp` extra enables the
132
+ CoSApp adapter. Neither extra is part of the minimum core support guarantee.
133
+ Install an extra only when its upstream dependency, license terms, platform
134
+ requirements, and integration behavior have been reviewed for the target
135
+ release:
136
+
137
+ ```bash
138
+ uv sync --extra ml
139
+ uv sync --extra cosapp
140
+ ```
141
+
142
+ Optional adapters may execute external tools or user-provided models. Treat
143
+ their workflows as trusted input and test the exact dependency versions before
144
+ production use.
145
+
146
+ ## License
147
+
148
+ FlowGraph Core is licensed under the [BSD 3-Clause License](LICENSE). Release
149
+ compliance requires review of the exact dependency lockfile, build artifacts,
150
+ third-party notices, native dependencies, and applicable license obligations.
@@ -0,0 +1,104 @@
1
+ # FlowGraph Core
2
+
3
+ `FlowGraph` is the GUI-free Python workflow engine. It provides typed workflow
4
+ composition, validation, persistence, execution, adapters, mesh and image data
5
+ operations, browser-WASM execution support, and metadata-only catalog export
6
+ for compatible external clients.
7
+
8
+ > **Alpha status:** FlowGraph Core `0.1.x` is an alpha series for evaluation,
9
+ > development, experimentation, and early adopter feedback. APIs and workflow
10
+ > behavior may change before `1.0.0`. See [`Release Policy`](docs/policies/release-policy.md).
11
+
12
+ ## Development
13
+
14
+ ```bash
15
+ uv sync --extra dev
16
+ uv run pytest
17
+ uv run ruff check .
18
+ ```
19
+
20
+ See [`Contributing`](.github/CONTRIBUTING.md) for prerequisites, development
21
+ workflow, testing, documentation, and pull-request expectations.
22
+
23
+ ## Headless workflows
24
+
25
+ The `flowgraph` command is headless and has no GUI runtime dependency:
26
+
27
+ ```bash
28
+ uv run flowgraph inspect workflow.json
29
+ uv run flowgraph run workflow.json --input name=value
30
+ uv run flowgraph run workflow.json --override node-id.parameter=value
31
+ uv run flowgraph run workflow.json --json-output results.json
32
+ ```
33
+
34
+ Workflows use the versioned `flowgraph-workflow` JSON format. Core validation and
35
+ execution are UI-independent.
36
+
37
+ ## Package artifacts
38
+
39
+ Build the portable, pure-Python source distribution and wheel with:
40
+
41
+ ```bash
42
+ uv build --out-dir dist/
43
+ ```
44
+
45
+ The resulting wheel is compatible with all supported Python platforms. See
46
+ `packaging/README.md` for release details.
47
+
48
+ The initial supported publication channels are GitHub source releases and
49
+ PyPI. Conda, Docker, operating-system package managers, and third-party mirrors
50
+ are not supported release channels at this time. See
51
+ [`Release Channels`](docs/policies/release-channels.md) for the release policy.
52
+
53
+ FlowGraph Core declares Python 3.11 or newer. CI covers Python 3.11 and 3.13 on
54
+ GitHub-hosted Ubuntu, Windows, and macOS runners; a platform/version combination
55
+ is supported only after its release-candidate job passes. See
56
+ [`Support Policy`](docs/policies/support-policy.md) for compatibility, deprecation,
57
+ maintenance, and unsupported-use policies.
58
+
59
+ ## Catalog export
60
+
61
+ FlowGraph can export non-executable node metadata for tools that need to author
62
+ or structurally validate workflow JSON:
63
+
64
+ ```bash
65
+ uv run python -m flowgraph.application.workflow_web_catalog node-catalog.json
66
+ ```
67
+
68
+ The catalog intentionally excludes node executors and other callable runtime
69
+ behavior.
70
+
71
+ ## Documentation and support
72
+
73
+ - [`Architecture`](docs/architecture.md) describes the core boundaries and workflow
74
+ model.
75
+ - [`Support Policy`](docs/policies/support-policy.md) describes supported environments and
76
+ compatibility expectations.
77
+ - [`SECURITY.md`](SECURITY.md) explains private vulnerability reporting and the
78
+ security boundaries of workflows and adapters.
79
+ - [`Changelog`](docs/changelog.md) records release changes and known limitations.
80
+ - [`docs/workflow-format.md`](docs/workflow-format.md) documents persistence,
81
+ compatibility, and capability boundaries.
82
+
83
+ ## Optional integrations
84
+
85
+ The `ml` extra enables the PyPlaid adapter and the `cosapp` extra enables the
86
+ CoSApp adapter. Neither extra is part of the minimum core support guarantee.
87
+ Install an extra only when its upstream dependency, license terms, platform
88
+ requirements, and integration behavior have been reviewed for the target
89
+ release:
90
+
91
+ ```bash
92
+ uv sync --extra ml
93
+ uv sync --extra cosapp
94
+ ```
95
+
96
+ Optional adapters may execute external tools or user-provided models. Treat
97
+ their workflows as trusted input and test the exact dependency versions before
98
+ production use.
99
+
100
+ ## License
101
+
102
+ FlowGraph Core is licensed under the [BSD 3-Clause License](LICENSE). Release
103
+ compliance requires review of the exact dependency lockfile, build artifacts,
104
+ third-party notices, native dependencies, and applicable license obligations.
@@ -0,0 +1,83 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "flowgraph"
7
+ version = "0.1.2"
8
+ description = "Headless typed workflow engine and execution runtime"
9
+ readme = "README.md"
10
+ requires-python = ">=3.11"
11
+ license = "BSD-3-Clause"
12
+ license-files = ["LICENSE"]
13
+ authors = [{ name = "Felipe Bordeu" }]
14
+ maintainers = [{ name = "Felipe Bordeu" }]
15
+ keywords = ["workflow", "graph", "mesh", "scientific-computing", "automation"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "Programming Language :: Python :: 3",
21
+ "Programming Language :: Python :: 3.11",
22
+ "Programming Language :: Python :: 3.12",
23
+ "Programming Language :: Python :: 3.13",
24
+ "Programming Language :: Python :: 3.14",
25
+ "Operating System :: OS Independent",
26
+ "Topic :: Scientific/Engineering",
27
+ "Topic :: Software Development :: Libraries :: Python Modules",
28
+ ]
29
+ dependencies = [
30
+ "vtk>=9.2",
31
+ "muscat>=2.5.2",
32
+ "meshio>=5.3",
33
+ "meshlane>=5.5.0",
34
+ "scipy>=1.10",
35
+ "pandas",
36
+ "h5py",
37
+ "pillow>=10.0",
38
+ ]
39
+
40
+ [project.optional-dependencies]
41
+ dev = [
42
+ "pytest>=8.0",
43
+ "pytest-cov>=5.0",
44
+ "ruff>=0.6",
45
+ ]
46
+ ml = [
47
+ "pyplaid",
48
+ ]
49
+ cosapp = [
50
+ "cosapp>=1.6.1",
51
+ ]
52
+ ci = [
53
+ "cosapp>=1.6.1",
54
+ "pycgns",
55
+ ]
56
+
57
+ [project.urls]
58
+ Homepage = "https://github.com/FBW-Engineering-Solutions/FlowGraph"
59
+ Repository = "https://github.com/FBW-Engineering-Solutions/FlowGraph.git"
60
+ Issues = "https://github.com/FBW-Engineering-Solutions/FlowGraph/issues"
61
+
62
+ [project.scripts]
63
+ flowgraph = "flowgraph.core_cli:main"
64
+
65
+ [tool.setuptools.packages.find]
66
+ where = ["src"]
67
+
68
+ [tool.setuptools]
69
+ package-dir = { "" = "src" }
70
+
71
+ [tool.setuptools.package-data]
72
+ "flowgraph" = [
73
+ "testdata/*",
74
+ ]
75
+
76
+ [tool.pytest.ini_options]
77
+ testpaths = ["tests"]
78
+ pythonpath = [".", "src"]
79
+
80
+ [tool.ruff]
81
+ target-version = "py311"
82
+ line-length = 100
83
+
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,9 @@
1
+ """Headless FlowGraph workflow engine namespace."""
2
+
3
+ from pkgutil import extend_path
4
+
5
+ __path__ = extend_path(__path__, __name__)
6
+
7
+ from .version import __version__
8
+
9
+ __all__ = ["__version__"]
@@ -0,0 +1,6 @@
1
+ """Run the headless FlowGraph command-line interface as a module."""
2
+
3
+ from flowgraph.core_cli import main
4
+
5
+ if __name__ == "__main__":
6
+ raise SystemExit(main())
@@ -0,0 +1,141 @@
1
+ """Grouped catalog of workflow adapters exposed to application composition."""
2
+
3
+ from dataclasses import dataclass
4
+
5
+ from flowgraph.adapters.controls import AVAILABLE_NODES as CONTROL_AVAILABLE_NODES
6
+ from flowgraph.adapters.cosapp import AVAILABLE_NODES as COSAPP_AVAILABLE_NODES
7
+ from flowgraph.adapters.documentation import AVAILABLE_NODES as DOCUMENTATION_AVAILABLE_NODES
8
+ from flowgraph.adapters.field_ops import AVAILABLE_NODES as FIELD_OPS_AVAILABLE_NODES
9
+ from flowgraph.adapters.file_conversion import MESH_FILE_CONVERSION
10
+ from flowgraph.adapters.files import (
11
+ READ_DIRECTORY_FILES,
12
+ SELECT_FILE,
13
+ SELECT_SERVER_FILE,
14
+ )
15
+ from flowgraph.adapters.filters import (
16
+ CREATE_MUSCAT_ELEMENT_FILTER,
17
+ FILTER_MESH_WITH_MUSCAT,
18
+ )
19
+ from flowgraph.adapters.image_tools import AVAILABLE_NODES as IMAGE_TOOLS_AVAILABLE_NODES
20
+ from flowgraph.adapters.mesh_creation_tools import AVAILABLE_NODES as MESH_CREATION_AVAILABLE_NODES
21
+ from flowgraph.adapters.mesh_generations import CSV_TO_MESH
22
+ from flowgraph.adapters.mesh_ops import AVAILABLE_NODES as MESH_OPS_AVAILABLE_NODES
23
+ from flowgraph.adapters.plaid_bridge import AVAILABLE_NODES as PLAID_AVAILABLE_NODES
24
+ from flowgraph.adapters.readers import (
25
+ LOAD_CSV,
26
+ LOAD_MESHIO,
27
+ LOAD_MESHLANE,
28
+ LOAD_MUSCAT,
29
+ )
30
+ from flowgraph.adapters.remote_files import DOWNLOAD_URL
31
+ from flowgraph.adapters.simple_sources import (
32
+ SET_FLOAT,
33
+ SET_INT,
34
+ SET_LIST_FLOAT,
35
+ SET_LIST_INT,
36
+ SET_LIST_STR,
37
+ SET_STRING,
38
+ SET_VEC3D,
39
+ )
40
+ from flowgraph.adapters.sinks import AVAILABLE_NODES as SINKS_AVAILABLE_NODES
41
+ from flowgraph.adapters.user_code import AVAILABLE_NODES as USER_CODE_AVAILABLE_NODES
42
+ from flowgraph.adapters.workflow import AVAILABLE_NODES as WORKFLOW_AVAILABLE_NODES
43
+ from flowgraph.adapters.workflow_interfaces import (
44
+ AVAILABLE_NODES as WORKFLOW_INTERFACE_AVAILABLE_NODES,
45
+ )
46
+ from flowgraph.adapters.writers import WRITE_MESHIO, WRITE_MESHLANE, WRITE_MUSCAT
47
+ from flowgraph.application.workflow_core import NodeDefinition
48
+
49
+
50
+ @dataclass(frozen=True)
51
+ class AdapterGroup:
52
+ """A named, ordered group of workflow nodes presented in one UI menu."""
53
+
54
+ label: str
55
+ node_definitions: tuple[NodeDefinition, ...] = ()
56
+ subgroups: tuple["AdapterGroup", ...] = ()
57
+
58
+ def all_node_definitions(self) -> tuple[NodeDefinition, ...]:
59
+ """Return definitions in this group and all nested groups."""
60
+ return self.node_definitions + tuple(
61
+ definition
62
+ for subgroup in self.subgroups
63
+ for definition in subgroup.all_node_definitions()
64
+ )
65
+
66
+
67
+ @dataclass(frozen=True)
68
+ class AdapterCatalog:
69
+ """Single application-facing catalog for adapter nodes and their UI metadata."""
70
+
71
+ groups: tuple[AdapterGroup, ...]
72
+
73
+ @property
74
+ def node_definitions(self) -> tuple[NodeDefinition, ...]:
75
+ """Return all adapter definitions in group and menu order."""
76
+ return tuple(
77
+ definition for group in self.groups for definition in group.all_node_definitions()
78
+ )
79
+
80
+ def require(self, definition_id: str) -> NodeDefinition:
81
+ """Return an adapter definition by ID or raise a descriptive key error."""
82
+ definition = next(
83
+ (candidate for candidate in self.node_definitions if candidate.id == definition_id),
84
+ None,
85
+ )
86
+ if definition is None:
87
+ raise KeyError(f"Unknown adapter node definition: {definition_id!r}")
88
+ return definition
89
+
90
+
91
+ ADAPTERS = AdapterCatalog(
92
+ groups=(
93
+ AdapterGroup(
94
+ "Inputs",
95
+ subgroups=(
96
+ AdapterGroup("Scalars", (SET_STRING, SET_INT, SET_FLOAT)),
97
+ AdapterGroup(
98
+ "Lists/Vectors", (SET_LIST_STR, SET_LIST_INT, SET_LIST_FLOAT, SET_VEC3D)
99
+ ),
100
+ AdapterGroup(
101
+ "Files",
102
+ (SELECT_FILE, SELECT_SERVER_FILE, DOWNLOAD_URL, READ_DIRECTORY_FILES),
103
+ ),
104
+ ),
105
+ ),
106
+ AdapterGroup(
107
+ "Mesh Tools",
108
+ subgroups=(
109
+ AdapterGroup(
110
+ "Readers",
111
+ (LOAD_MUSCAT, LOAD_MESHIO, LOAD_MESHLANE, LOAD_CSV),
112
+ ),
113
+ AdapterGroup("Mesh Gens", (CSV_TO_MESH,)),
114
+ AdapterGroup("Mesh Creation", MESH_CREATION_AVAILABLE_NODES),
115
+ AdapterGroup(
116
+ "Filters",
117
+ (CREATE_MUSCAT_ELEMENT_FILTER, FILTER_MESH_WITH_MUSCAT),
118
+ ),
119
+ AdapterGroup("Mesh Ops", MESH_OPS_AVAILABLE_NODES),
120
+ AdapterGroup("Field Ops", FIELD_OPS_AVAILABLE_NODES),
121
+ AdapterGroup("File Conversion", (MESH_FILE_CONVERSION,)),
122
+ AdapterGroup("Writers", (WRITE_MUSCAT, WRITE_MESHLANE, WRITE_MESHIO)),
123
+ ),
124
+ ),
125
+ AdapterGroup("Controls", CONTROL_AVAILABLE_NODES),
126
+ AdapterGroup("Image Tools", IMAGE_TOOLS_AVAILABLE_NODES),
127
+ AdapterGroup("Code", USER_CODE_AVAILABLE_NODES),
128
+ AdapterGroup("Workflow", WORKFLOW_INTERFACE_AVAILABLE_NODES + WORKFLOW_AVAILABLE_NODES),
129
+ AdapterGroup("Sinks", SINKS_AVAILABLE_NODES),
130
+ AdapterGroup("Doc", DOCUMENTATION_AVAILABLE_NODES),
131
+ AdapterGroup(
132
+ "External Tools",
133
+ subgroups=(
134
+ AdapterGroup("CoSApp", COSAPP_AVAILABLE_NODES),
135
+ AdapterGroup("Plaid", PLAID_AVAILABLE_NODES),
136
+ ),
137
+ ),
138
+ ),
139
+ )
140
+
141
+ __all__ = ["ADAPTERS"]
@@ -0,0 +1,96 @@
1
+ """Headless workflow nodes whose values are presented with GUI controls."""
2
+
3
+ import math
4
+ from collections.abc import Mapping
5
+ from typing import Any
6
+
7
+ from flowgraph.application.workflow_core import (
8
+ NodeDefinition,
9
+ ParameterDefinition,
10
+ PortDefinition,
11
+ PortDirection,
12
+ )
13
+
14
+ from .data_types import FLOAT, INTEGER, ParameterKind
15
+
16
+
17
+ def _slider_bounds(
18
+ parameters: Mapping[str, Any], *, integer: bool
19
+ ) -> tuple[int | float, int | float, int | float]:
20
+ """Validate and return a slider's minimum, maximum, and current value."""
21
+ minimum = parameters.get("min")
22
+ maximum = parameters.get("max")
23
+ value = parameters.get("value")
24
+ expected_type = int if integer else (int, float)
25
+
26
+ if (
27
+ isinstance(minimum, bool)
28
+ or not isinstance(minimum, expected_type)
29
+ or isinstance(maximum, bool)
30
+ or not isinstance(maximum, expected_type)
31
+ or isinstance(value, bool)
32
+ or not isinstance(value, expected_type)
33
+ ):
34
+ value_type = "integer" if integer else "number"
35
+ raise TypeError(f"The slider min, max, and value must be {value_type}s")
36
+
37
+ if integer:
38
+ if minimum >= maximum:
39
+ raise ValueError("The slider minimum must be less than its maximum")
40
+ else:
41
+ minimum = float(minimum)
42
+ maximum = float(maximum)
43
+ value = float(value)
44
+ if not all(math.isfinite(item) for item in (minimum, maximum, value)):
45
+ raise ValueError("The slider min, max, and value must be finite")
46
+ if minimum >= maximum:
47
+ raise ValueError("The slider minimum must be less than its maximum")
48
+
49
+ if not minimum <= value <= maximum:
50
+ raise ValueError("The slider value must be between its minimum and maximum")
51
+ return minimum, maximum, value
52
+
53
+
54
+ def _float_slider(_inputs: Mapping[str, Any], parameters: Mapping[str, Any]) -> Mapping[str, Any]:
55
+ """Output the current finite floating-point slider value."""
56
+ return {"value": _slider_bounds(parameters, integer=False)[2]}
57
+
58
+
59
+ FLOAT_SLIDER = NodeDefinition(
60
+ id="float-slider",
61
+ icon="mdi-tune-vertical",
62
+ label="Float Slider",
63
+ description="Outputs a floating-point value selected with a slider.",
64
+ ports=(PortDefinition("value", PortDirection.OUTPUT, FLOAT, "Value"),),
65
+ executor=_float_slider,
66
+ presentation="slider",
67
+ parameters=(
68
+ ParameterDefinition("min", ParameterKind.FLOAT, "Minimum", 0.0, "0.0"),
69
+ ParameterDefinition("max", ParameterKind.FLOAT, "Maximum", 1.0, "1.0"),
70
+ ParameterDefinition("value", ParameterKind.FLOAT, "Value", 0.5, "0.5", port=False),
71
+ ),
72
+ )
73
+
74
+
75
+ def _int_slider(_inputs: Mapping[str, Any], parameters: Mapping[str, Any]) -> Mapping[str, Any]:
76
+ """Output the current integer slider value."""
77
+ return {"value": _slider_bounds(parameters, integer=True)[2]}
78
+
79
+
80
+ INT_SLIDER = NodeDefinition(
81
+ id="int-slider",
82
+ icon="mdi-tune-vertical",
83
+ label="Integer Slider",
84
+ description="Outputs an integer value selected with a slider.",
85
+ ports=(PortDefinition("value", PortDirection.OUTPUT, INTEGER, "Value"),),
86
+ executor=_int_slider,
87
+ presentation="slider",
88
+ parameters=(
89
+ ParameterDefinition("min", ParameterKind.INTEGER, "Minimum", 0, "0"),
90
+ ParameterDefinition("max", ParameterKind.INTEGER, "Maximum", 100, "100"),
91
+ ParameterDefinition("value", ParameterKind.INTEGER, "Value", 50, "50", port=False),
92
+ ),
93
+ )
94
+
95
+
96
+ AVAILABLE_NODES = (FLOAT_SLIDER, INT_SLIDER)