flowgraph 0.1.7__tar.gz → 0.1.9__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.
- {flowgraph-0.1.7/src/flowgraph.egg-info → flowgraph-0.1.9}/PKG-INFO +85 -21
- {flowgraph-0.1.7 → flowgraph-0.1.9}/README.md +72 -11
- {flowgraph-0.1.7 → flowgraph-0.1.9}/pyproject.toml +10 -21
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/__init__.py +8 -1
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/data_types.py +1 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/field_ops.py +1 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/files.py +60 -9
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/filters.py +1 -12
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/image_tools.py +44 -1
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/imagej.py +87 -6
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/mesh_analysis.py +32 -8
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/mesh_creation_tools.py +2 -2
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/mesh_ops.py +2 -2
- flowgraph-0.1.9/src/flowgraph/adapters/sinks.py +208 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/user_code.py +77 -2
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/workflow.py +2 -0
- flowgraph-0.1.9/src/flowgraph/application/node_registry.py +28 -0
- flowgraph-0.1.9/src/flowgraph/application/plugins.py +60 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/port_conversions.py +2 -0
- flowgraph-0.1.9/src/flowgraph/application/wasm_packages.py +245 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_cli.py +68 -13
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_core.py +147 -95
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_defaults.py +11 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_execution.py +97 -8
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_io.py +6 -3
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_session.py +36 -5
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/core_cli.py +64 -4
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/paraview_gateway.py +26 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/server/http.py +156 -11
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/server/jobs.py +153 -26
- flowgraph-0.1.9/src/flowgraph/server/packages.py +233 -0
- flowgraph-0.1.9/src/flowgraph/server/worker.py +81 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/server/workspace.py +7 -1
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/AllFilters.json +3 -3
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/ColorCardboard.jpg +0 -0
- flowgraph-0.1.9/src/flowgraph/testdata/ImageJBlur.json +249 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/SimpleReadMesh.json +3 -3
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/version.py +1 -1
- {flowgraph-0.1.7 → flowgraph-0.1.9/src/flowgraph.egg-info}/PKG-INFO +85 -21
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph.egg-info/SOURCES.txt +11 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph.egg-info/requires.txt +13 -9
- flowgraph-0.1.9/tests/test_audit_requirements.py +112 -0
- flowgraph-0.1.9/tests/test_image_roi.py +95 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_image_tools.py +112 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_imagej.py +217 -1
- flowgraph-0.1.9/tests/test_local_server.py +1044 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_mesh_analysis.py +107 -7
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_mesh_ops.py +9 -5
- flowgraph-0.1.9/tests/test_native_packages.py +180 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_node_selector.py +2 -60
- flowgraph-0.1.9/tests/test_packaging.py +449 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_paraview.py +54 -0
- flowgraph-0.1.9/tests/test_plugins.py +279 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_readers.py +24 -3
- flowgraph-0.1.9/tests/test_release.py +477 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_sinks.py +8 -2
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_transfer_fields.py +23 -2
- flowgraph-0.1.9/tests/test_user_function_parameters.py +127 -0
- flowgraph-0.1.9/tests/test_wasm_packages.py +148 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workflow_cli.py +120 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workflow_execution.py +159 -2
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workflow_io.py +43 -1
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workflow_web_catalog.py +23 -2
- flowgraph-0.1.9/tests/test_workspace_file.py +254 -0
- flowgraph-0.1.7/src/flowgraph/adapters/sinks.py +0 -111
- flowgraph-0.1.7/src/flowgraph/application/node_registry.py +0 -14
- flowgraph-0.1.7/src/flowgraph/server/worker.py +0 -36
- flowgraph-0.1.7/tests/test_local_server.py +0 -536
- flowgraph-0.1.7/tests/test_packaging.py +0 -180
- flowgraph-0.1.7/tests/test_release.py +0 -235
- {flowgraph-0.1.7 → flowgraph-0.1.9}/LICENSE +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/setup.cfg +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/__init__.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/__main__.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/calculator.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/controls.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/cosapp.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/documentation.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/field_gradient.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/file_conversion.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/mesh_composition.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/mesh_generations.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/paraview.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/plaid_bridge.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/readers.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/remote_files.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/simple_sources.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/table_tools.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/vector_tools.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/workflow_interfaces.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/writers.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/adapters/zones.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/__init__.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/file_dependencies.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_history.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_layout.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflow_web_catalog.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/application/workflows.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/domain/__init__.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/domain/filepath.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/domain/mesh_document.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/examples/AllFilters.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/examples/convert_format.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/resources.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/server/__init__.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/FlowGraph.h5 +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/FlowGraph.stl +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/FlowGraph.xdmf +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/SpherePoints.csv +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph/testdata/muscat-muscat-mesh-conversion.json +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph.egg-info/dependency_links.txt +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph.egg-info/entry_points.txt +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/src/flowgraph.egg-info/top_level.txt +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_array_nodes.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_array_types.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_cache_policy.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_calculator.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_conditional_workflow.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_controls.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_core_gui_boundary.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_cosapp.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_directory_dependencies.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_extract_field.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_extract_vector_value.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_field_gradient.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_file_conversion.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_filepath.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_fluency_optimization.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_headless_boundary.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_mesh_composition.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_mesh_creation_tools.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_muscat_vtk.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_plaid_bridge.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_remote_files.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_remove_lonely_nodes.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_scalars_to_array_1d.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_simple_sources.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_table_tools.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_user_code_mesh.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_vector_field_gradient.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_vector_tools.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workflow_core.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workflow_history.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workflow_session.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_workspace_directories.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_writers.py +0 -0
- {flowgraph-0.1.7 → flowgraph-0.1.9}/tests/test_zones.py +0 -0
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: flowgraph
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.9
|
|
4
4
|
Summary: Headless typed workflow engine and execution runtime
|
|
5
5
|
Author: Felipe Bordeu
|
|
6
6
|
Maintainer: Felipe Bordeu
|
|
7
7
|
License-Expression: BSD-3-Clause
|
|
8
8
|
Project-URL: Homepage, https://github.com/FBW-Engineering-Solutions/FlowGraph
|
|
9
|
+
Project-URL: Documentation, https://flowgraph.readthedocs.io/en/latest/
|
|
9
10
|
Project-URL: Repository, https://github.com/FBW-Engineering-Solutions/FlowGraph.git
|
|
10
11
|
Project-URL: Issues, https://github.com/FBW-Engineering-Solutions/FlowGraph/issues
|
|
11
12
|
Keywords: workflow,graph,mesh,scientific-computing,automation
|
|
@@ -23,16 +24,18 @@ Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
|
23
24
|
Requires-Python: >=3.11
|
|
24
25
|
Description-Content-Type: text/markdown
|
|
25
26
|
License-File: LICENSE
|
|
27
|
+
Requires-Dist: packaging>=24
|
|
26
28
|
Requires-Dist: vtk>=9.2
|
|
27
|
-
Requires-Dist: muscat>=2.
|
|
28
|
-
|
|
29
|
-
Requires-Dist:
|
|
30
|
-
|
|
31
|
-
Requires-Dist:
|
|
32
|
-
Requires-Dist:
|
|
33
|
-
Requires-Dist:
|
|
34
|
-
Requires-Dist:
|
|
35
|
-
Requires-Dist:
|
|
29
|
+
Requires-Dist: muscat>=2.6.0
|
|
30
|
+
Provides-Extra: server
|
|
31
|
+
Requires-Dist: uv>=0.6; extra == "server"
|
|
32
|
+
Provides-Extra: io
|
|
33
|
+
Requires-Dist: meshio>=5.3; extra == "io"
|
|
34
|
+
Requires-Dist: meshlane>=5.5.0; extra == "io"
|
|
35
|
+
Requires-Dist: pandas; extra == "io"
|
|
36
|
+
Requires-Dist: h5py; extra == "io"
|
|
37
|
+
Requires-Dist: pillow>=10.0; extra == "io"
|
|
38
|
+
Requires-Dist: openpyxl>=3.1.5; extra == "io"
|
|
36
39
|
Provides-Extra: imagej
|
|
37
40
|
Requires-Dist: pyimagej; extra == "imagej"
|
|
38
41
|
Requires-Dist: scyjava; extra == "imagej"
|
|
@@ -71,7 +74,7 @@ API, node safety contracts, transport options and resource limits.
|
|
|
71
74
|
## Development setup
|
|
72
75
|
|
|
73
76
|
```bash
|
|
74
|
-
uv sync --extra dev
|
|
77
|
+
uv sync --extra dev --extra io
|
|
75
78
|
uv run pytest
|
|
76
79
|
uv run ruff check .
|
|
77
80
|
```
|
|
@@ -91,10 +94,27 @@ uv run flowgraph run workflow.json --input name=value
|
|
|
91
94
|
uv run flowgraph run workflow.json -i name=value
|
|
92
95
|
uv run flowgraph run workflow.json --override node-id.parameter=value
|
|
93
96
|
uv run flowgraph run workflow.json --json-output results.json
|
|
97
|
+
uv run flowgraph run workflow.json --verbose
|
|
98
|
+
uv run flowgraph run workflow.json --plugin /path/custom_nodes.py
|
|
99
|
+
uv run flowgraph inspect workflow.json --plugin /path/custom_nodes.py --full
|
|
94
100
|
```
|
|
95
101
|
|
|
102
|
+
Use repeatable `--plugin FILE.py` to load trusted custom definitions exported as
|
|
103
|
+
`AVAILABLE_NODES`. The same option on `flowgraph serve` adds nodes to its catalog
|
|
104
|
+
and execution workers. Imports execute Python code, including during inspection;
|
|
105
|
+
only load trusted files. See the [plugin guide](doc/user-guide/custom-nodes.md#load-python-file-plugins-from-the-cli-or-server)
|
|
106
|
+
for the file format, path rules, dependencies and restart requirements.
|
|
107
|
+
|
|
96
108
|
Use `--input` or its short form `-i` for each published workflow input; repeat
|
|
97
109
|
the option to provide multiple inputs.
|
|
110
|
+
|
|
111
|
+
Add `--verbose` (or `-v`) to `run` for execution states and live, bounded node
|
|
112
|
+
output-port summaries on stderr, matching `serve` diagnostics. Node stdout/stderr
|
|
113
|
+
remain visible and Python console output is line-buffered in verbose mode.
|
|
114
|
+
Summaries use runtime values without making copies or generating previews.
|
|
115
|
+
Verbose logs may contain sensitive workflow data; keep them private.
|
|
116
|
+
Final outputs and `--json-output` retain their normal behavior.
|
|
117
|
+
|
|
98
118
|
`flowgraph inspect` displays the resolved default to the right of each published
|
|
99
119
|
input, or marks it as required or having conflicting saved values.
|
|
100
120
|
Inspection is compact by default; add `--full` (or `-f`) to include the workflow
|
|
@@ -141,12 +161,49 @@ together; the workflow file and execution response formats are unchanged.
|
|
|
141
161
|
|
|
142
162
|
## Experimental local server
|
|
143
163
|
|
|
144
|
-
|
|
164
|
+
### Optional workspace packages
|
|
165
|
+
|
|
166
|
+
Install the `server` extra (`uv sync --extra server`, or install `flowgraph[server]`)
|
|
167
|
+
and pass `--allow-package-install` to `flowgraph serve` to enable the web editor's
|
|
168
|
+
confirmed wheel-only installation API. It is disabled by default. Compatible
|
|
169
|
+
prebuilt Python/native wheels are installed with uv into
|
|
170
|
+
`<workspace>/.flowgraph-packages/<python-and-platform-id>/site-packages`, not the
|
|
171
|
+
base environment. Extras persist across server restarts. Stop the backend and
|
|
172
|
+
delete `.flowgraph-packages` to remove them. Read-only workspace destinations,
|
|
173
|
+
source builds, conflicting distributions and base-module shadowing are rejected.
|
|
174
|
+
Installation requires idle execution and restarts session workers, clearing caches.
|
|
175
|
+
The managed directory is excluded from the file API. Only install trusted code;
|
|
176
|
+
this is not a sandbox or a multi-user package service.
|
|
177
|
+
|
|
178
|
+
The prototype branch includes an authenticated execution API (loopback by default):
|
|
179
|
+
|
|
180
|
+
For LAN or internet browser clients, put an HTTPS reverse proxy in front of the
|
|
181
|
+
API and pass `--public-url https://python.example.com` to `flowgraph serve`.
|
|
182
|
+
The proxy must preserve the public Host header, Authorization, Origin, and CORS
|
|
183
|
+
preflight headers. Leave Python on `127.0.0.1:8765` when the proxy runs on the
|
|
184
|
+
same machine. An explicit IPv4 `--host` (including `0.0.0.0`) is supported but
|
|
185
|
+
non-loopback binding requires `--public-url`; restrict the HTTP port to a trusted
|
|
186
|
+
proxy network. This option advertises HTTPS; it does not enable TLS in Python.
|
|
187
|
+
Certificates must be trusted by browser clients, including for private LAN IPs.
|
|
188
|
+
Use `--allow-origin` to allow your exact editor origin (the hosted editor is the
|
|
189
|
+
default). The launch link includes the remote backend address in its fragment.
|
|
190
|
+
This is a trusted single-user service, not a sandbox or a public multi-user API;
|
|
191
|
+
use an unprivileged account, firewall/VPN restrictions, and proxy request limits.
|
|
145
192
|
|
|
146
193
|
```bash
|
|
147
194
|
uv run flowgraph serve --workspace /absolute/path/to/existing/workspace
|
|
148
195
|
```
|
|
149
196
|
|
|
197
|
+
Add `--verbose` (or `-v`) for server lifecycle, configuration, sanitized HTTP
|
|
198
|
+
activity, execution state changes, and bounded node output-port summaries on
|
|
199
|
+
stderr. Worker stdout/stderr (prints and logs) also appear in the console.
|
|
200
|
+
Verbose logs may contain sensitive workflow data; keep them private.
|
|
201
|
+
For an isolated tool launch:
|
|
202
|
+
|
|
203
|
+
```bash
|
|
204
|
+
uvx --with imagej flowgraph serve --workspace . --verbose
|
|
205
|
+
```
|
|
206
|
+
|
|
150
207
|
Port 8765 and the allowed editor origin `https://flowgraph-web.fbw-es.com` are
|
|
151
208
|
defaults; explicit `--allow-origin` values replace that origin. The editor still
|
|
152
209
|
requires bearer authentication and browser local-network permission. Click the
|
|
@@ -154,7 +211,11 @@ printed **Open editor** link to pass the token and port automatically; keep the
|
|
|
154
211
|
link private.
|
|
155
212
|
|
|
156
213
|
It runs one workflow at a time in a cancellable native subprocess and provides
|
|
157
|
-
runtime metadata, catalog, and workspace file endpoints.
|
|
214
|
+
runtime metadata, catalog, and workspace file endpoints. Execution timeouts are
|
|
215
|
+
advisory: the worker remains alive until completion or explicit cancellation,
|
|
216
|
+
and the HTTP server is not stopped. GUI clients can supply a per-job timeout;
|
|
217
|
+
`--execution-timeout` sets the default warning threshold (120 seconds).
|
|
218
|
+
Core is API-only and never
|
|
158
219
|
serves editor assets. Web and desktop clients own their GUI hosting and explicitly
|
|
159
220
|
allow their origin with `--allow-origin`. Native workflow code is **not sandboxed**.
|
|
160
221
|
See [Local server API and limitations](docs/local-server.md) for authentication,
|
|
@@ -171,14 +232,7 @@ uv build --out-dir dist/
|
|
|
171
232
|
The resulting wheel is compatible with all supported Python platforms. See
|
|
172
233
|
`packaging/README.md` for release details.
|
|
173
234
|
|
|
174
|
-
|
|
175
|
-
is distributed through the [`flowgraph` Anaconda channel](https://anaconda.org/channels/flowgraph):
|
|
176
|
-
|
|
177
|
-
```bash
|
|
178
|
-
conda install -c flowgraph flowgraph
|
|
179
|
-
```
|
|
180
|
-
|
|
181
|
-
Docker, operating-system package managers, and third-party mirrors are not
|
|
235
|
+
Conda, Docker, operating-system package managers, and third-party mirrors are not
|
|
182
236
|
supported release channels at this time. See
|
|
183
237
|
[`Release Channels`](docs/policies/release-channels.md) for the release policy.
|
|
184
238
|
|
|
@@ -220,6 +274,16 @@ behavior.
|
|
|
220
274
|
|
|
221
275
|
## Optional integrations
|
|
222
276
|
|
|
277
|
+
The `io` extra supplies meshio, Meshlane, pandas, h5py, Pillow, and openpyxl
|
|
278
|
+
for mesh, table, and image I/O and image processing. Install it when your
|
|
279
|
+
workflows use these libraries:
|
|
280
|
+
|
|
281
|
+
```bash
|
|
282
|
+
uv pip install 'flowgraph[io]'
|
|
283
|
+
# From a source checkout:
|
|
284
|
+
uv sync --extra io
|
|
285
|
+
```
|
|
286
|
+
|
|
223
287
|
The `ml` extra enables the PyPlaid adapter and the `cosapp` extra enables the
|
|
224
288
|
CoSApp adapter. Neither extra is part of the minimum core support guarantee.
|
|
225
289
|
Install an extra only when its upstream dependency, license terms, platform
|
|
@@ -19,7 +19,7 @@ API, node safety contracts, transport options and resource limits.
|
|
|
19
19
|
## Development setup
|
|
20
20
|
|
|
21
21
|
```bash
|
|
22
|
-
uv sync --extra dev
|
|
22
|
+
uv sync --extra dev --extra io
|
|
23
23
|
uv run pytest
|
|
24
24
|
uv run ruff check .
|
|
25
25
|
```
|
|
@@ -39,10 +39,27 @@ uv run flowgraph run workflow.json --input name=value
|
|
|
39
39
|
uv run flowgraph run workflow.json -i name=value
|
|
40
40
|
uv run flowgraph run workflow.json --override node-id.parameter=value
|
|
41
41
|
uv run flowgraph run workflow.json --json-output results.json
|
|
42
|
+
uv run flowgraph run workflow.json --verbose
|
|
43
|
+
uv run flowgraph run workflow.json --plugin /path/custom_nodes.py
|
|
44
|
+
uv run flowgraph inspect workflow.json --plugin /path/custom_nodes.py --full
|
|
42
45
|
```
|
|
43
46
|
|
|
47
|
+
Use repeatable `--plugin FILE.py` to load trusted custom definitions exported as
|
|
48
|
+
`AVAILABLE_NODES`. The same option on `flowgraph serve` adds nodes to its catalog
|
|
49
|
+
and execution workers. Imports execute Python code, including during inspection;
|
|
50
|
+
only load trusted files. See the [plugin guide](doc/user-guide/custom-nodes.md#load-python-file-plugins-from-the-cli-or-server)
|
|
51
|
+
for the file format, path rules, dependencies and restart requirements.
|
|
52
|
+
|
|
44
53
|
Use `--input` or its short form `-i` for each published workflow input; repeat
|
|
45
54
|
the option to provide multiple inputs.
|
|
55
|
+
|
|
56
|
+
Add `--verbose` (or `-v`) to `run` for execution states and live, bounded node
|
|
57
|
+
output-port summaries on stderr, matching `serve` diagnostics. Node stdout/stderr
|
|
58
|
+
remain visible and Python console output is line-buffered in verbose mode.
|
|
59
|
+
Summaries use runtime values without making copies or generating previews.
|
|
60
|
+
Verbose logs may contain sensitive workflow data; keep them private.
|
|
61
|
+
Final outputs and `--json-output` retain their normal behavior.
|
|
62
|
+
|
|
46
63
|
`flowgraph inspect` displays the resolved default to the right of each published
|
|
47
64
|
input, or marks it as required or having conflicting saved values.
|
|
48
65
|
Inspection is compact by default; add `--full` (or `-f`) to include the workflow
|
|
@@ -89,12 +106,49 @@ together; the workflow file and execution response formats are unchanged.
|
|
|
89
106
|
|
|
90
107
|
## Experimental local server
|
|
91
108
|
|
|
92
|
-
|
|
109
|
+
### Optional workspace packages
|
|
110
|
+
|
|
111
|
+
Install the `server` extra (`uv sync --extra server`, or install `flowgraph[server]`)
|
|
112
|
+
and pass `--allow-package-install` to `flowgraph serve` to enable the web editor's
|
|
113
|
+
confirmed wheel-only installation API. It is disabled by default. Compatible
|
|
114
|
+
prebuilt Python/native wheels are installed with uv into
|
|
115
|
+
`<workspace>/.flowgraph-packages/<python-and-platform-id>/site-packages`, not the
|
|
116
|
+
base environment. Extras persist across server restarts. Stop the backend and
|
|
117
|
+
delete `.flowgraph-packages` to remove them. Read-only workspace destinations,
|
|
118
|
+
source builds, conflicting distributions and base-module shadowing are rejected.
|
|
119
|
+
Installation requires idle execution and restarts session workers, clearing caches.
|
|
120
|
+
The managed directory is excluded from the file API. Only install trusted code;
|
|
121
|
+
this is not a sandbox or a multi-user package service.
|
|
122
|
+
|
|
123
|
+
The prototype branch includes an authenticated execution API (loopback by default):
|
|
124
|
+
|
|
125
|
+
For LAN or internet browser clients, put an HTTPS reverse proxy in front of the
|
|
126
|
+
API and pass `--public-url https://python.example.com` to `flowgraph serve`.
|
|
127
|
+
The proxy must preserve the public Host header, Authorization, Origin, and CORS
|
|
128
|
+
preflight headers. Leave Python on `127.0.0.1:8765` when the proxy runs on the
|
|
129
|
+
same machine. An explicit IPv4 `--host` (including `0.0.0.0`) is supported but
|
|
130
|
+
non-loopback binding requires `--public-url`; restrict the HTTP port to a trusted
|
|
131
|
+
proxy network. This option advertises HTTPS; it does not enable TLS in Python.
|
|
132
|
+
Certificates must be trusted by browser clients, including for private LAN IPs.
|
|
133
|
+
Use `--allow-origin` to allow your exact editor origin (the hosted editor is the
|
|
134
|
+
default). The launch link includes the remote backend address in its fragment.
|
|
135
|
+
This is a trusted single-user service, not a sandbox or a public multi-user API;
|
|
136
|
+
use an unprivileged account, firewall/VPN restrictions, and proxy request limits.
|
|
93
137
|
|
|
94
138
|
```bash
|
|
95
139
|
uv run flowgraph serve --workspace /absolute/path/to/existing/workspace
|
|
96
140
|
```
|
|
97
141
|
|
|
142
|
+
Add `--verbose` (or `-v`) for server lifecycle, configuration, sanitized HTTP
|
|
143
|
+
activity, execution state changes, and bounded node output-port summaries on
|
|
144
|
+
stderr. Worker stdout/stderr (prints and logs) also appear in the console.
|
|
145
|
+
Verbose logs may contain sensitive workflow data; keep them private.
|
|
146
|
+
For an isolated tool launch:
|
|
147
|
+
|
|
148
|
+
```bash
|
|
149
|
+
uvx --with imagej flowgraph serve --workspace . --verbose
|
|
150
|
+
```
|
|
151
|
+
|
|
98
152
|
Port 8765 and the allowed editor origin `https://flowgraph-web.fbw-es.com` are
|
|
99
153
|
defaults; explicit `--allow-origin` values replace that origin. The editor still
|
|
100
154
|
requires bearer authentication and browser local-network permission. Click the
|
|
@@ -102,7 +156,11 @@ printed **Open editor** link to pass the token and port automatically; keep the
|
|
|
102
156
|
link private.
|
|
103
157
|
|
|
104
158
|
It runs one workflow at a time in a cancellable native subprocess and provides
|
|
105
|
-
runtime metadata, catalog, and workspace file endpoints.
|
|
159
|
+
runtime metadata, catalog, and workspace file endpoints. Execution timeouts are
|
|
160
|
+
advisory: the worker remains alive until completion or explicit cancellation,
|
|
161
|
+
and the HTTP server is not stopped. GUI clients can supply a per-job timeout;
|
|
162
|
+
`--execution-timeout` sets the default warning threshold (120 seconds).
|
|
163
|
+
Core is API-only and never
|
|
106
164
|
serves editor assets. Web and desktop clients own their GUI hosting and explicitly
|
|
107
165
|
allow their origin with `--allow-origin`. Native workflow code is **not sandboxed**.
|
|
108
166
|
See [Local server API and limitations](docs/local-server.md) for authentication,
|
|
@@ -119,14 +177,7 @@ uv build --out-dir dist/
|
|
|
119
177
|
The resulting wheel is compatible with all supported Python platforms. See
|
|
120
178
|
`packaging/README.md` for release details.
|
|
121
179
|
|
|
122
|
-
|
|
123
|
-
is distributed through the [`flowgraph` Anaconda channel](https://anaconda.org/channels/flowgraph):
|
|
124
|
-
|
|
125
|
-
```bash
|
|
126
|
-
conda install -c flowgraph flowgraph
|
|
127
|
-
```
|
|
128
|
-
|
|
129
|
-
Docker, operating-system package managers, and third-party mirrors are not
|
|
180
|
+
Conda, Docker, operating-system package managers, and third-party mirrors are not
|
|
130
181
|
supported release channels at this time. See
|
|
131
182
|
[`Release Channels`](docs/policies/release-channels.md) for the release policy.
|
|
132
183
|
|
|
@@ -168,6 +219,16 @@ behavior.
|
|
|
168
219
|
|
|
169
220
|
## Optional integrations
|
|
170
221
|
|
|
222
|
+
The `io` extra supplies meshio, Meshlane, pandas, h5py, Pillow, and openpyxl
|
|
223
|
+
for mesh, table, and image I/O and image processing. Install it when your
|
|
224
|
+
workflows use these libraries:
|
|
225
|
+
|
|
226
|
+
```bash
|
|
227
|
+
uv pip install 'flowgraph[io]'
|
|
228
|
+
# From a source checkout:
|
|
229
|
+
uv sync --extra io
|
|
230
|
+
```
|
|
231
|
+
|
|
171
232
|
The `ml` extra enables the PyPlaid adapter and the `cosapp` extra enables the
|
|
172
233
|
CoSApp adapter. Neither extra is part of the minimum core support guarantee.
|
|
173
234
|
Install an extra only when its upstream dependency, license terms, platform
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
[build-system]
|
|
2
|
-
requires = ["setuptools>=
|
|
2
|
+
requires = ["setuptools>=84.1.0"]
|
|
3
3
|
build-backend = "setuptools.build_meta"
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "flowgraph"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.9"
|
|
8
8
|
description = "Headless typed workflow engine and execution runtime"
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.11"
|
|
@@ -27,19 +27,21 @@ classifiers = [
|
|
|
27
27
|
"Topic :: Software Development :: Libraries :: Python Modules",
|
|
28
28
|
]
|
|
29
29
|
dependencies = [
|
|
30
|
+
"packaging>=24",
|
|
30
31
|
"vtk>=9.2",
|
|
31
|
-
"muscat>=2.
|
|
32
|
+
"muscat>=2.6.0",
|
|
33
|
+
]
|
|
34
|
+
|
|
35
|
+
[project.optional-dependencies]
|
|
36
|
+
server = ["uv>=0.6"]
|
|
37
|
+
io = [
|
|
32
38
|
"meshio>=5.3",
|
|
33
39
|
"meshlane>=5.5.0",
|
|
34
|
-
"scipy>=1.10",
|
|
35
40
|
"pandas",
|
|
36
41
|
"h5py",
|
|
37
42
|
"pillow>=10.0",
|
|
38
|
-
"numpy>=1.24",
|
|
39
43
|
"openpyxl>=3.1.5",
|
|
40
44
|
]
|
|
41
|
-
|
|
42
|
-
[project.optional-dependencies]
|
|
43
45
|
imagej = [
|
|
44
46
|
"pyimagej",
|
|
45
47
|
"scyjava",
|
|
@@ -63,6 +65,7 @@ ci = [
|
|
|
63
65
|
|
|
64
66
|
[project.urls]
|
|
65
67
|
Homepage = "https://github.com/FBW-Engineering-Solutions/FlowGraph"
|
|
68
|
+
Documentation = "https://flowgraph.readthedocs.io/en/latest/"
|
|
66
69
|
Repository = "https://github.com/FBW-Engineering-Solutions/FlowGraph.git"
|
|
67
70
|
Issues = "https://github.com/FBW-Engineering-Solutions/FlowGraph/issues"
|
|
68
71
|
|
|
@@ -87,17 +90,3 @@ pythonpath = [".", "src"]
|
|
|
87
90
|
[tool.ruff]
|
|
88
91
|
target-version = "py311"
|
|
89
92
|
line-length = 100
|
|
90
|
-
|
|
91
|
-
#[tool.uv.sources]
|
|
92
|
-
#muscat = { git = "https://gitlab.com/drti/muscat.git", rev = "ParMmg" }
|
|
93
|
-
##micromamba install -n uv_muscat_build_packages scotch mmgsuite=*=h* kokkos=*=h*
|
|
94
|
-
## uv pip install ipywidgets
|
|
95
|
-
## uv pip install jupyterlab
|
|
96
|
-
##export OMP_PROC_BIND=spread
|
|
97
|
-
##export OMP_PLACES=threads
|
|
98
|
-
##LD_LIBRARY_PATH=/home/fbw/.local/share/mamba/envs/uv_muscat_build_packages/lib/ uv run jupyter lab
|
|
99
|
-
|
|
100
|
-
#[tool.uv]
|
|
101
|
-
#config-settings-package = {muscat = {"cmake.args" = ["-DCMAKE_PREFIX_PATH=/home/fbw/.local/share/mamba/envs/uv_muscat_build_packages/lib/cmake/",
|
|
102
|
-
#"-DSCOTCH_ROOT=/home/fbw/.local/share/mamba/envs/uv_muscat_build_packages/"
|
|
103
|
-
#]}}
|
|
@@ -12,6 +12,7 @@ from flowgraph.adapters.files import (
|
|
|
12
12
|
READ_DIRECTORY_FILES,
|
|
13
13
|
SELECT_FILE,
|
|
14
14
|
SELECT_SERVER_FILE,
|
|
15
|
+
WORKSPACE,
|
|
15
16
|
)
|
|
16
17
|
from flowgraph.adapters.filters import (
|
|
17
18
|
CREATE_MUSCAT_ELEMENT_FILTER,
|
|
@@ -117,7 +118,13 @@ ADAPTERS = AdapterCatalog(
|
|
|
117
118
|
),
|
|
118
119
|
AdapterGroup(
|
|
119
120
|
"Files",
|
|
120
|
-
(
|
|
121
|
+
(
|
|
122
|
+
SELECT_FILE,
|
|
123
|
+
SELECT_SERVER_FILE,
|
|
124
|
+
WORKSPACE,
|
|
125
|
+
DOWNLOAD_URL,
|
|
126
|
+
READ_DIRECTORY_FILES,
|
|
127
|
+
),
|
|
121
128
|
),
|
|
122
129
|
),
|
|
123
130
|
),
|
|
@@ -109,6 +109,7 @@ TRANSFER_FIELDS_NODE = NodeDefinition(
|
|
|
109
109
|
"Interpolation",
|
|
110
110
|
"Interp/Clamp",
|
|
111
111
|
options=(
|
|
112
|
+
ParameterOption("Nearest/Nearest", "Nearest point"),
|
|
112
113
|
ParameterOption("Interp/Clamp", "Interpolation / Clamp"),
|
|
113
114
|
ParameterOption("Interp/Nearest", "Interpolation / Nearest"),
|
|
114
115
|
ParameterOption("Interp/Extrap", "Interpolation / Extrapolation"),
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import re
|
|
4
4
|
from collections.abc import Mapping
|
|
5
|
-
from pathlib import Path
|
|
5
|
+
from pathlib import Path, PureWindowsPath
|
|
6
6
|
from typing import Any
|
|
7
7
|
|
|
8
8
|
from flowgraph.application.workflow_core import (
|
|
@@ -13,7 +13,7 @@ from flowgraph.application.workflow_core import (
|
|
|
13
13
|
PortDirection,
|
|
14
14
|
)
|
|
15
15
|
|
|
16
|
-
from .data_types import LIST_STR, STRING, ParameterKind
|
|
16
|
+
from .data_types import DIRECTORY, LIST_STR, STRING, ParameterKind
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
def _select_file(
|
|
@@ -57,27 +57,39 @@ def _select_server_file(
|
|
|
57
57
|
parameters: Mapping[str, Any],
|
|
58
58
|
_exec_context: ExecContext | None = None,
|
|
59
59
|
) -> Mapping[str, Any]:
|
|
60
|
-
"""
|
|
60
|
+
"""Resolve a portable workspace file, preserving legacy absolute paths."""
|
|
61
61
|
path = parameters.get("file name", "")
|
|
62
62
|
if not isinstance(path, str):
|
|
63
63
|
raise TypeError("The selected file path parameter must be text")
|
|
64
64
|
if len(path) == 0:
|
|
65
65
|
raise ValueError("Path can't be empty")
|
|
66
|
-
|
|
66
|
+
source = Path(path).expanduser()
|
|
67
|
+
# Absolute paths from existing workflows remain external references.
|
|
68
|
+
if source.is_absolute():
|
|
69
|
+
return {"path": str(source)}
|
|
70
|
+
root = _exec_context.workspace if _exec_context is not None else None
|
|
71
|
+
if root is None:
|
|
72
|
+
raise ValueError("Workspace File requires a configured workspace directory")
|
|
73
|
+
source = (root / source).resolve()
|
|
74
|
+
if not source.is_relative_to(root):
|
|
75
|
+
raise ValueError("Workspace File path escapes the workspace directory")
|
|
76
|
+
if not source.is_file():
|
|
77
|
+
raise ValueError(f"Workspace file does not exist or is not a file: {path}")
|
|
78
|
+
return {"path": str(source)}
|
|
67
79
|
|
|
68
80
|
|
|
69
81
|
SELECT_SERVER_FILE = NodeDefinition(
|
|
70
82
|
cache_policy="pure",
|
|
71
|
-
id="
|
|
83
|
+
id="workspace-file",
|
|
72
84
|
requirements=(),
|
|
73
85
|
icon="mdi-cloud-upload-outline",
|
|
74
|
-
label="
|
|
75
|
-
description="
|
|
86
|
+
label="Workspace File",
|
|
87
|
+
description="Resolves a workspace-relative file path at runtime without reading the file. Legacy absolute paths remain external references.",
|
|
76
88
|
ports=(PortDefinition("path", PortDirection.OUTPUT, STRING, "File path"),),
|
|
77
89
|
executor=_select_server_file,
|
|
78
90
|
parameters=(
|
|
79
91
|
ParameterDefinition(
|
|
80
|
-
"file name", ParameterKind.SELECT_SERVER_FILENAME, "
|
|
92
|
+
"file name", ParameterKind.SELECT_SERVER_FILENAME, "Workspace file", "", port=False
|
|
81
93
|
),
|
|
82
94
|
),
|
|
83
95
|
)
|
|
@@ -87,6 +99,44 @@ class DirectoryReadError(ValueError):
|
|
|
87
99
|
"""Raised when a directory-file listing node receives an invalid directory path."""
|
|
88
100
|
|
|
89
101
|
|
|
102
|
+
def _workspace_directory(
|
|
103
|
+
_inputs: Mapping[str, Any],
|
|
104
|
+
parameters: Mapping[str, Any],
|
|
105
|
+
_exec_context: ExecContext | None = None,
|
|
106
|
+
) -> Mapping[str, Any]:
|
|
107
|
+
"""Resolve the selected relative folder within the host-configured workspace."""
|
|
108
|
+
root = _exec_context.workspace if _exec_context is not None else None
|
|
109
|
+
if root is None:
|
|
110
|
+
raise ValueError("Workspace Folder requires a configured workspace directory")
|
|
111
|
+
selected = parameters.get("folder", ".")
|
|
112
|
+
if not isinstance(selected, str):
|
|
113
|
+
raise TypeError("Workspace Folder selection must be text")
|
|
114
|
+
relative = Path(selected)
|
|
115
|
+
if relative.is_absolute() or PureWindowsPath(selected).anchor:
|
|
116
|
+
raise ValueError("Workspace Folder requires a workspace-relative folder path")
|
|
117
|
+
folder = (root / relative).resolve()
|
|
118
|
+
if not folder.is_relative_to(root):
|
|
119
|
+
raise ValueError("Workspace Folder path escapes the workspace directory")
|
|
120
|
+
if not folder.is_dir():
|
|
121
|
+
raise ValueError(f"Workspace folder does not exist or is not a directory: {selected}")
|
|
122
|
+
return {"path": folder}
|
|
123
|
+
|
|
124
|
+
|
|
125
|
+
WORKSPACE = NodeDefinition(
|
|
126
|
+
cache_policy="pure",
|
|
127
|
+
id="workspace-folder",
|
|
128
|
+
requirements=(),
|
|
129
|
+
icon="mdi-folder-outline",
|
|
130
|
+
label="Workspace Folder",
|
|
131
|
+
description="Resolves a selected workspace-relative folder as an absolute directory path. Defaults to the workspace root.",
|
|
132
|
+
ports=(PortDefinition("path", PortDirection.OUTPUT, DIRECTORY, "Directory path"),),
|
|
133
|
+
executor=_workspace_directory,
|
|
134
|
+
parameters=(
|
|
135
|
+
ParameterDefinition("folder", ParameterKind.TEXT, "Workspace folder", ".", port=False),
|
|
136
|
+
),
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
|
|
90
140
|
def _compile_filename_patterns(
|
|
91
141
|
pattern: object,
|
|
92
142
|
) -> re.Pattern[str] | None:
|
|
@@ -171,7 +221,7 @@ READ_DIRECTORY_FILES = NodeDefinition(
|
|
|
171
221
|
parameters=(
|
|
172
222
|
ParameterDefinition(
|
|
173
223
|
"path",
|
|
174
|
-
ParameterKind.
|
|
224
|
+
ParameterKind.DIRECTORY,
|
|
175
225
|
"Directory path",
|
|
176
226
|
"",
|
|
177
227
|
"/path/to/directory",
|
|
@@ -201,5 +251,6 @@ __all__ = [
|
|
|
201
251
|
"READ_DIRECTORY_FILES",
|
|
202
252
|
"SELECT_FILE",
|
|
203
253
|
"SELECT_SERVER_FILE",
|
|
254
|
+
"WORKSPACE",
|
|
204
255
|
"DirectoryReadError",
|
|
205
256
|
]
|
|
@@ -4,7 +4,6 @@ from collections.abc import Mapping, Sequence
|
|
|
4
4
|
from typing import Any
|
|
5
5
|
|
|
6
6
|
import Muscat.MeshContainers.ElementsDescription as ED
|
|
7
|
-
import numpy as np
|
|
8
7
|
from Muscat.MeshContainers.Filters.FilterObjects import ElementFilter, NodeFilter
|
|
9
8
|
from Muscat.MeshContainers.Filters.FilterOperators import (
|
|
10
9
|
ComplementaryFilter,
|
|
@@ -189,16 +188,6 @@ CREATE_MUSCAT_ELEMENT_FILTER = NodeDefinition(
|
|
|
189
188
|
)
|
|
190
189
|
|
|
191
190
|
|
|
192
|
-
class _ComposedNodeFilter(NodeFilter):
|
|
193
|
-
"""Honor nested nodal filters omitted by Muscat's NodeFilter implementation."""
|
|
194
|
-
|
|
195
|
-
def GetNodesIndices(self, mesh):
|
|
196
|
-
indices = super().GetNodesIndices(mesh)
|
|
197
|
-
if self.nFilter is None:
|
|
198
|
-
return indices
|
|
199
|
-
return np.intersect1d(indices, self.nFilter.GetNodesIndices(mesh))
|
|
200
|
-
|
|
201
|
-
|
|
202
191
|
def _create_node_filter(
|
|
203
192
|
inputs: Mapping[str, Any],
|
|
204
193
|
parameters: Mapping[str, Any],
|
|
@@ -206,7 +195,7 @@ def _create_node_filter(
|
|
|
206
195
|
) -> Mapping[str, Any]:
|
|
207
196
|
"""Create a Muscat nodal selector from tags, zones, and nested selectors."""
|
|
208
197
|
return {
|
|
209
|
-
"filter":
|
|
198
|
+
"filter": NodeFilter(
|
|
210
199
|
nTag=_tag_list(parameters, "ntag") or None,
|
|
211
200
|
eTag=_tag_list(parameters, "etag") or None,
|
|
212
201
|
zone=[value for name, value in inputs.items() if name.startswith("zone_")],
|
|
@@ -45,7 +45,7 @@ class ImageOperationError(RuntimeError):
|
|
|
45
45
|
|
|
46
46
|
|
|
47
47
|
class ImageJConversionError(RuntimeError):
|
|
48
|
-
"""Raised when
|
|
48
|
+
"""Raised when conversion between Pillow and ImageJ image values fails."""
|
|
49
49
|
|
|
50
50
|
|
|
51
51
|
class ImageFluencyError(RuntimeError):
|
|
@@ -72,6 +72,34 @@ def _pillow_to_imagej(
|
|
|
72
72
|
return {"image": np.array(image, copy=True)}
|
|
73
73
|
|
|
74
74
|
|
|
75
|
+
def _imagej_to_pillow(
|
|
76
|
+
inputs: Mapping[str, Any],
|
|
77
|
+
_parameters: Mapping[str, Any],
|
|
78
|
+
_exec_context: ExecContext | None = None,
|
|
79
|
+
) -> Mapping[str, Any]:
|
|
80
|
+
"""Convert a single ImageJ NumPy image using Pillow's native array modes."""
|
|
81
|
+
array = inputs["image"]
|
|
82
|
+
if not isinstance(array, np.ndarray):
|
|
83
|
+
raise ImageJConversionError("ImageJ input must be a NumPy array")
|
|
84
|
+
if array.ndim not in (2, 3) or (array.ndim == 3 and array.shape[2] not in (2, 3, 4)):
|
|
85
|
+
raise ImageJConversionError(
|
|
86
|
+
"ImageJ input must have shape (height, width) or (height, width, channels) "
|
|
87
|
+
"with 2, 3, or 4 channels; select a single plane from stacks or volumes"
|
|
88
|
+
)
|
|
89
|
+
if array.shape[0] == 0 or array.shape[1] == 0:
|
|
90
|
+
raise ImageJConversionError("Image dimensions must both be at least one pixel")
|
|
91
|
+
try:
|
|
92
|
+
image = PillowImage.fromarray(array)
|
|
93
|
+
except (TypeError, ValueError) as error:
|
|
94
|
+
raise ImageJConversionError(
|
|
95
|
+
f"Cannot convert ImageJ array with shape {array.shape} and dtype {array.dtype} "
|
|
96
|
+
"to Pillow; use a Pillow-supported grayscale dtype or uint8 color channels"
|
|
97
|
+
) from error
|
|
98
|
+
# Reuse Pillow's buffer sharing where supported; Pillow writes detach the buffer.
|
|
99
|
+
image.readonly = 1
|
|
100
|
+
return {"image": image}
|
|
101
|
+
|
|
102
|
+
|
|
75
103
|
def _metric_channels(image: Image) -> tuple[np.ndarray, ...]:
|
|
76
104
|
"""Return image channels as float arrays, ignoring alpha channels."""
|
|
77
105
|
if image.mode == "L":
|
|
@@ -556,6 +584,20 @@ PILLOW_TO_IMAGEJ = NodeDefinition(
|
|
|
556
584
|
)
|
|
557
585
|
|
|
558
586
|
|
|
587
|
+
IMAGEJ_TO_PILLOW = NodeDefinition(
|
|
588
|
+
id="imagej-to-pillow",
|
|
589
|
+
requirements=("py:pillow", "py:numpy"),
|
|
590
|
+
icon="mdi-image-sync-outline",
|
|
591
|
+
label="ImageJ To Pillow",
|
|
592
|
+
description="Converts a single ImageJ NumPy image to a Pillow image without intensity scaling.",
|
|
593
|
+
ports=(
|
|
594
|
+
PortDefinition("image", PortDirection.INPUT, IMAGEJ, "ImageJ NumPy array"),
|
|
595
|
+
PortDefinition("image", PortDirection.OUTPUT, IMAGE, "Pillow image"),
|
|
596
|
+
),
|
|
597
|
+
executor=_imagej_to_pillow,
|
|
598
|
+
)
|
|
599
|
+
|
|
600
|
+
|
|
559
601
|
WRITE_IMAGE = NodeDefinition(
|
|
560
602
|
cache_policy="pure",
|
|
561
603
|
id="write-image",
|
|
@@ -731,6 +773,7 @@ IMAGE_FLUENCY_METRICS = NodeDefinition(
|
|
|
731
773
|
AVAILABLE_NODES = (
|
|
732
774
|
READ_IMAGE,
|
|
733
775
|
PILLOW_TO_IMAGEJ,
|
|
776
|
+
IMAGEJ_TO_PILLOW,
|
|
734
777
|
WRITE_IMAGE,
|
|
735
778
|
RESIZE_IMAGE,
|
|
736
779
|
CROP_IMAGE,
|