py-data-engine 0.1.0__py3-none-any.whl
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.
- data_engine/__init__.py +37 -0
- data_engine/application/__init__.py +39 -0
- data_engine/application/actions.py +42 -0
- data_engine/application/catalog.py +151 -0
- data_engine/application/control.py +213 -0
- data_engine/application/details.py +73 -0
- data_engine/application/runtime.py +449 -0
- data_engine/application/workspace.py +62 -0
- data_engine/authoring/__init__.py +14 -0
- data_engine/authoring/builder.py +31 -0
- data_engine/authoring/execution/__init__.py +6 -0
- data_engine/authoring/execution/app.py +6 -0
- data_engine/authoring/execution/context.py +82 -0
- data_engine/authoring/execution/continuous.py +176 -0
- data_engine/authoring/execution/grouped.py +106 -0
- data_engine/authoring/execution/logging.py +83 -0
- data_engine/authoring/execution/polling.py +135 -0
- data_engine/authoring/execution/runner.py +210 -0
- data_engine/authoring/execution/single.py +171 -0
- data_engine/authoring/flow.py +361 -0
- data_engine/authoring/helpers.py +160 -0
- data_engine/authoring/model.py +59 -0
- data_engine/authoring/primitives.py +430 -0
- data_engine/authoring/services.py +42 -0
- data_engine/devtools/__init__.py +3 -0
- data_engine/devtools/project_ast_map.py +503 -0
- data_engine/docs/__init__.py +1 -0
- data_engine/docs/sphinx_source/_static/custom.css +13 -0
- data_engine/docs/sphinx_source/api.rst +42 -0
- data_engine/docs/sphinx_source/conf.py +37 -0
- data_engine/docs/sphinx_source/guides/app-runtime-and-workspaces.md +397 -0
- data_engine/docs/sphinx_source/guides/authoring-flow-modules.md +215 -0
- data_engine/docs/sphinx_source/guides/configuring-flows.md +185 -0
- data_engine/docs/sphinx_source/guides/core-concepts.md +208 -0
- data_engine/docs/sphinx_source/guides/database-methods.md +107 -0
- data_engine/docs/sphinx_source/guides/duckdb-helpers.md +462 -0
- data_engine/docs/sphinx_source/guides/flow-context.md +538 -0
- data_engine/docs/sphinx_source/guides/flow-methods.md +206 -0
- data_engine/docs/sphinx_source/guides/getting-started.md +271 -0
- data_engine/docs/sphinx_source/guides/project-inventory.md +5683 -0
- data_engine/docs/sphinx_source/guides/project-map.md +118 -0
- data_engine/docs/sphinx_source/guides/recipes.md +268 -0
- data_engine/docs/sphinx_source/index.rst +22 -0
- data_engine/domain/__init__.py +92 -0
- data_engine/domain/actions.py +69 -0
- data_engine/domain/catalog.py +128 -0
- data_engine/domain/details.py +214 -0
- data_engine/domain/diagnostics.py +56 -0
- data_engine/domain/errors.py +104 -0
- data_engine/domain/inspection.py +99 -0
- data_engine/domain/logs.py +118 -0
- data_engine/domain/operations.py +172 -0
- data_engine/domain/operator.py +72 -0
- data_engine/domain/runs.py +155 -0
- data_engine/domain/runtime.py +279 -0
- data_engine/domain/source_state.py +17 -0
- data_engine/domain/support.py +54 -0
- data_engine/domain/time.py +23 -0
- data_engine/domain/workspace.py +159 -0
- data_engine/flow_modules/__init__.py +1 -0
- data_engine/flow_modules/flow_module_compiler.py +179 -0
- data_engine/flow_modules/flow_module_loader.py +201 -0
- data_engine/helpers/__init__.py +25 -0
- data_engine/helpers/duckdb.py +705 -0
- data_engine/hosts/__init__.py +1 -0
- data_engine/hosts/daemon/__init__.py +23 -0
- data_engine/hosts/daemon/app.py +221 -0
- data_engine/hosts/daemon/bootstrap.py +69 -0
- data_engine/hosts/daemon/client.py +465 -0
- data_engine/hosts/daemon/commands.py +64 -0
- data_engine/hosts/daemon/composition.py +310 -0
- data_engine/hosts/daemon/constants.py +15 -0
- data_engine/hosts/daemon/entrypoints.py +97 -0
- data_engine/hosts/daemon/lifecycle.py +191 -0
- data_engine/hosts/daemon/manager.py +272 -0
- data_engine/hosts/daemon/ownership.py +126 -0
- data_engine/hosts/daemon/runtime_commands.py +188 -0
- data_engine/hosts/daemon/runtime_control.py +31 -0
- data_engine/hosts/daemon/server.py +84 -0
- data_engine/hosts/daemon/shared_state.py +147 -0
- data_engine/hosts/daemon/state_sync.py +101 -0
- data_engine/platform/__init__.py +1 -0
- data_engine/platform/identity.py +35 -0
- data_engine/platform/local_settings.py +146 -0
- data_engine/platform/theme.py +259 -0
- data_engine/platform/workspace_models.py +190 -0
- data_engine/platform/workspace_policy.py +333 -0
- data_engine/runtime/__init__.py +1 -0
- data_engine/runtime/file_watch.py +185 -0
- data_engine/runtime/ledger_models.py +116 -0
- data_engine/runtime/runtime_db.py +938 -0
- data_engine/runtime/shared_state.py +523 -0
- data_engine/services/__init__.py +49 -0
- data_engine/services/daemon.py +64 -0
- data_engine/services/daemon_state.py +40 -0
- data_engine/services/flow_catalog.py +102 -0
- data_engine/services/flow_execution.py +48 -0
- data_engine/services/ledger.py +85 -0
- data_engine/services/logs.py +65 -0
- data_engine/services/runtime_binding.py +105 -0
- data_engine/services/runtime_execution.py +126 -0
- data_engine/services/runtime_history.py +62 -0
- data_engine/services/settings.py +58 -0
- data_engine/services/shared_state.py +28 -0
- data_engine/services/theme.py +59 -0
- data_engine/services/workspace_provisioning.py +224 -0
- data_engine/services/workspaces.py +74 -0
- data_engine/ui/__init__.py +3 -0
- data_engine/ui/cli/__init__.py +19 -0
- data_engine/ui/cli/app.py +161 -0
- data_engine/ui/cli/commands_doctor.py +178 -0
- data_engine/ui/cli/commands_run.py +80 -0
- data_engine/ui/cli/commands_start.py +100 -0
- data_engine/ui/cli/commands_workspace.py +97 -0
- data_engine/ui/cli/dependencies.py +44 -0
- data_engine/ui/cli/parser.py +56 -0
- data_engine/ui/gui/__init__.py +25 -0
- data_engine/ui/gui/app.py +116 -0
- data_engine/ui/gui/bootstrap.py +487 -0
- data_engine/ui/gui/bootstrapper.py +140 -0
- data_engine/ui/gui/cache_models.py +23 -0
- data_engine/ui/gui/control_support.py +185 -0
- data_engine/ui/gui/controllers/__init__.py +6 -0
- data_engine/ui/gui/controllers/flows.py +439 -0
- data_engine/ui/gui/controllers/runtime.py +245 -0
- data_engine/ui/gui/dialogs/__init__.py +12 -0
- data_engine/ui/gui/dialogs/messages.py +88 -0
- data_engine/ui/gui/dialogs/previews.py +222 -0
- data_engine/ui/gui/helpers/__init__.py +62 -0
- data_engine/ui/gui/helpers/inspection.py +81 -0
- data_engine/ui/gui/helpers/lifecycle.py +112 -0
- data_engine/ui/gui/helpers/scroll.py +28 -0
- data_engine/ui/gui/helpers/theming.py +87 -0
- data_engine/ui/gui/icons/dark_light.svg +12 -0
- data_engine/ui/gui/icons/documentation.svg +1 -0
- data_engine/ui/gui/icons/failed.svg +3 -0
- data_engine/ui/gui/icons/group.svg +4 -0
- data_engine/ui/gui/icons/home.svg +2 -0
- data_engine/ui/gui/icons/manual.svg +2 -0
- data_engine/ui/gui/icons/poll.svg +2 -0
- data_engine/ui/gui/icons/schedule.svg +4 -0
- data_engine/ui/gui/icons/settings.svg +2 -0
- data_engine/ui/gui/icons/started.svg +3 -0
- data_engine/ui/gui/icons/success.svg +3 -0
- data_engine/ui/gui/icons/view-log.svg +3 -0
- data_engine/ui/gui/icons.py +50 -0
- data_engine/ui/gui/launcher.py +48 -0
- data_engine/ui/gui/presenters/__init__.py +72 -0
- data_engine/ui/gui/presenters/docs.py +140 -0
- data_engine/ui/gui/presenters/logs.py +58 -0
- data_engine/ui/gui/presenters/runtime_projection.py +29 -0
- data_engine/ui/gui/presenters/sidebar.py +88 -0
- data_engine/ui/gui/presenters/steps.py +148 -0
- data_engine/ui/gui/presenters/workspace.py +39 -0
- data_engine/ui/gui/presenters/workspace_binding.py +75 -0
- data_engine/ui/gui/presenters/workspace_settings.py +182 -0
- data_engine/ui/gui/preview_models.py +37 -0
- data_engine/ui/gui/render_support.py +241 -0
- data_engine/ui/gui/rendering/__init__.py +12 -0
- data_engine/ui/gui/rendering/artifacts.py +95 -0
- data_engine/ui/gui/rendering/icons.py +50 -0
- data_engine/ui/gui/runtime.py +47 -0
- data_engine/ui/gui/state_support.py +193 -0
- data_engine/ui/gui/support.py +214 -0
- data_engine/ui/gui/surface.py +209 -0
- data_engine/ui/gui/theme.py +720 -0
- data_engine/ui/gui/widgets/__init__.py +34 -0
- data_engine/ui/gui/widgets/config.py +41 -0
- data_engine/ui/gui/widgets/logs.py +62 -0
- data_engine/ui/gui/widgets/panels.py +507 -0
- data_engine/ui/gui/widgets/sidebar.py +130 -0
- data_engine/ui/gui/widgets/steps.py +84 -0
- data_engine/ui/tui/__init__.py +5 -0
- data_engine/ui/tui/app.py +222 -0
- data_engine/ui/tui/bootstrap.py +475 -0
- data_engine/ui/tui/bootstrapper.py +117 -0
- data_engine/ui/tui/controllers/__init__.py +6 -0
- data_engine/ui/tui/controllers/flows.py +349 -0
- data_engine/ui/tui/controllers/runtime.py +167 -0
- data_engine/ui/tui/runtime.py +34 -0
- data_engine/ui/tui/state_support.py +141 -0
- data_engine/ui/tui/support.py +63 -0
- data_engine/ui/tui/theme.py +204 -0
- data_engine/ui/tui/widgets.py +123 -0
- data_engine/views/__init__.py +109 -0
- data_engine/views/actions.py +80 -0
- data_engine/views/artifacts.py +58 -0
- data_engine/views/flow_display.py +69 -0
- data_engine/views/logs.py +54 -0
- data_engine/views/models.py +96 -0
- data_engine/views/presentation.py +133 -0
- data_engine/views/runs.py +62 -0
- data_engine/views/state.py +39 -0
- data_engine/views/status.py +13 -0
- data_engine/views/text.py +109 -0
- py_data_engine-0.1.0.dist-info/METADATA +330 -0
- py_data_engine-0.1.0.dist-info/RECORD +200 -0
- py_data_engine-0.1.0.dist-info/WHEEL +5 -0
- py_data_engine-0.1.0.dist-info/entry_points.txt +2 -0
- py_data_engine-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,116 @@
|
|
|
1
|
+
"""GUI application surface for the Data Engine PySide6 operator UI."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
import polars as pl
|
|
6
|
+
from PySide6.QtWidgets import (
|
|
7
|
+
QApplication,
|
|
8
|
+
QFileDialog,
|
|
9
|
+
QHBoxLayout,
|
|
10
|
+
QLabel,
|
|
11
|
+
QMainWindow,
|
|
12
|
+
QTabWidget,
|
|
13
|
+
QVBoxLayout,
|
|
14
|
+
QWidget,
|
|
15
|
+
)
|
|
16
|
+
|
|
17
|
+
from data_engine.ui.gui.bootstrap import GuiServices
|
|
18
|
+
from data_engine.ui.gui.bootstrapper import bootstrap_gui_window
|
|
19
|
+
from data_engine.ui.gui.control_support import GuiControlMixin
|
|
20
|
+
from data_engine.ui.gui.helpers import is_last_process_ui_window as helper_is_last_process_ui_window
|
|
21
|
+
from data_engine.ui.gui.render_support import GuiRenderingMixin
|
|
22
|
+
from data_engine.ui.gui.state_support import GuiStateMixin
|
|
23
|
+
from data_engine.ui.gui.surface import handle_close_event, handle_show_event
|
|
24
|
+
from data_engine.ui.gui.support import GuiWindowSupportMixin
|
|
25
|
+
from data_engine.ui.gui.theme import DEFAULT_THEME
|
|
26
|
+
from data_engine.ui.gui.widgets import (
|
|
27
|
+
build_docs_view,
|
|
28
|
+
build_nav_rail,
|
|
29
|
+
build_operator_view,
|
|
30
|
+
build_settings_view,
|
|
31
|
+
)
|
|
32
|
+
|
|
33
|
+
|
|
34
|
+
class DataEngineWindow(GuiWindowSupportMixin, GuiRenderingMixin, GuiControlMixin, GuiStateMixin, QMainWindow):
|
|
35
|
+
"""Main PySide6 operator window."""
|
|
36
|
+
|
|
37
|
+
_MAX_LOG_EVENTS_PER_TICK = 100
|
|
38
|
+
_MAX_VISIBLE_LOG_RUNS = 100
|
|
39
|
+
_MAX_DAEMON_SYNC_MISSES = 3
|
|
40
|
+
_DOCS_HOME_PAGE = "index.html"
|
|
41
|
+
_ACTIVE_FLOW_STATES = {"running", "polling", "scheduled", "stopping flow", "stopping runtime"}
|
|
42
|
+
_VIEW_RAIL_ICON_NAMES = {
|
|
43
|
+
"home": "home",
|
|
44
|
+
"docs": "documentation",
|
|
45
|
+
"settings": "settings",
|
|
46
|
+
}
|
|
47
|
+
_ACTION_ICON_NAMES = {
|
|
48
|
+
"refresh": "started",
|
|
49
|
+
"theme_toggle": "dark_light",
|
|
50
|
+
}
|
|
51
|
+
_LOG_ICON_NAMES = {
|
|
52
|
+
"started": "started",
|
|
53
|
+
"failed": "failed",
|
|
54
|
+
"finished": "success",
|
|
55
|
+
"view_log": "view-log",
|
|
56
|
+
}
|
|
57
|
+
_LOG_ICON_COLORS = {
|
|
58
|
+
"started": "#0969da",
|
|
59
|
+
"finished": "#1f883d",
|
|
60
|
+
"failed": "#cf222e",
|
|
61
|
+
}
|
|
62
|
+
def __init__(self, *, theme_name: str = DEFAULT_THEME, services: GuiServices | None = None) -> None:
|
|
63
|
+
"""Build the operator window, timers, and runtime state containers."""
|
|
64
|
+
super().__init__()
|
|
65
|
+
bootstrap_gui_window(self, theme_name=theme_name, services=services)
|
|
66
|
+
|
|
67
|
+
def showEvent(self, event) -> None: # type: ignore[override]
|
|
68
|
+
"""Start daemon observation only after the window is actually shown."""
|
|
69
|
+
handle_show_event(self, event)
|
|
70
|
+
|
|
71
|
+
def closeEvent(self, event) -> None: # type: ignore[override]
|
|
72
|
+
"""Stop active runtimes and timers before the Qt window closes."""
|
|
73
|
+
handle_close_event(self, event)
|
|
74
|
+
|
|
75
|
+
def _build_window(self) -> None:
|
|
76
|
+
root = QWidget()
|
|
77
|
+
self.setCentralWidget(root)
|
|
78
|
+
root_layout = QVBoxLayout(root)
|
|
79
|
+
root_layout.setContentsMargins(20, 20, 20, 18)
|
|
80
|
+
root_layout.setSpacing(8)
|
|
81
|
+
|
|
82
|
+
shell = QHBoxLayout()
|
|
83
|
+
shell.setContentsMargins(0, 0, 0, 0)
|
|
84
|
+
shell.setSpacing(14)
|
|
85
|
+
|
|
86
|
+
shell.addWidget(build_nav_rail(self), 0)
|
|
87
|
+
|
|
88
|
+
content = QWidget()
|
|
89
|
+
content_layout = QVBoxLayout(content)
|
|
90
|
+
content_layout.setContentsMargins(0, 0, 0, 0)
|
|
91
|
+
content_layout.setSpacing(14)
|
|
92
|
+
|
|
93
|
+
self.workspace_counts_footer_label = QLabel("")
|
|
94
|
+
self.workspace_counts_footer_label.setObjectName("workspaceCountsFooter")
|
|
95
|
+
|
|
96
|
+
self.view_stack = QTabWidget()
|
|
97
|
+
self.view_stack.setObjectName("viewStack")
|
|
98
|
+
self.view_stack.tabBar().hide()
|
|
99
|
+
self.view_stack.addTab(build_operator_view(self), "Home")
|
|
100
|
+
self.view_stack.addTab(build_docs_view(self), "Docs")
|
|
101
|
+
self.view_stack.addTab(build_settings_view(self), "Settings")
|
|
102
|
+
content_layout.addWidget(self.view_stack, 1)
|
|
103
|
+
|
|
104
|
+
shell.addWidget(content, 1)
|
|
105
|
+
|
|
106
|
+
footer_row = QHBoxLayout()
|
|
107
|
+
footer_row.setContentsMargins(0, 0, 0, 0)
|
|
108
|
+
footer_row.setSpacing(0)
|
|
109
|
+
footer_row.addWidget(self.workspace_counts_footer_label, 0)
|
|
110
|
+
footer_row.addStretch(1)
|
|
111
|
+
|
|
112
|
+
root_layout.addLayout(shell, 1)
|
|
113
|
+
root_layout.addLayout(footer_row, 0)
|
|
114
|
+
self.workspace_counts_footer_label.setVisible(True)
|
|
115
|
+
|
|
116
|
+
__all__ = ["DataEngineWindow"]
|
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
"""GUI composition helpers for default service wiring."""
|
|
2
|
+
|
|
3
|
+
from __future__ import annotations
|
|
4
|
+
|
|
5
|
+
from dataclasses import dataclass
|
|
6
|
+
from pathlib import Path
|
|
7
|
+
from typing import Any, Callable
|
|
8
|
+
|
|
9
|
+
from data_engine.application import (
|
|
10
|
+
ActionStateApplication,
|
|
11
|
+
DetailApplication,
|
|
12
|
+
FlowCatalogApplication,
|
|
13
|
+
OperatorControlApplication,
|
|
14
|
+
RuntimeApplication,
|
|
15
|
+
WorkspaceSessionApplication,
|
|
16
|
+
)
|
|
17
|
+
from data_engine.authoring.builder import load_flow
|
|
18
|
+
from data_engine.flow_modules.flow_module_loader import discover_flow_module_definitions
|
|
19
|
+
from data_engine.hosts.daemon.app import DaemonClientError
|
|
20
|
+
from data_engine.hosts.daemon.app import daemon_request, is_daemon_live, spawn_daemon_process
|
|
21
|
+
from data_engine.platform.local_settings import LocalSettingsStore
|
|
22
|
+
from data_engine.platform.theme import (
|
|
23
|
+
DEFAULT_THEME,
|
|
24
|
+
THEMES,
|
|
25
|
+
resolve_theme_name,
|
|
26
|
+
system_theme_name,
|
|
27
|
+
theme_button_text,
|
|
28
|
+
toggle_theme_name,
|
|
29
|
+
)
|
|
30
|
+
from data_engine.services import (
|
|
31
|
+
DaemonService,
|
|
32
|
+
DaemonStateService,
|
|
33
|
+
FlowCatalogService,
|
|
34
|
+
FlowExecutionService,
|
|
35
|
+
LedgerService,
|
|
36
|
+
LogService,
|
|
37
|
+
RuntimeHistoryService,
|
|
38
|
+
WorkspaceRuntimeBindingService,
|
|
39
|
+
SettingsService,
|
|
40
|
+
SharedStateService,
|
|
41
|
+
ThemeService,
|
|
42
|
+
WorkspaceProvisioningService,
|
|
43
|
+
WorkspaceService,
|
|
44
|
+
)
|
|
45
|
+
|
|
46
|
+
|
|
47
|
+
@dataclass(frozen=True)
|
|
48
|
+
class GuiServices:
|
|
49
|
+
"""Concrete service set for the desktop GUI surface."""
|
|
50
|
+
|
|
51
|
+
settings_service: SettingsService
|
|
52
|
+
workspace_service: WorkspaceService
|
|
53
|
+
workspace_session_application: WorkspaceSessionApplication
|
|
54
|
+
action_state_application: ActionStateApplication
|
|
55
|
+
detail_application: DetailApplication
|
|
56
|
+
flow_catalog_service: FlowCatalogService
|
|
57
|
+
flow_catalog_application: FlowCatalogApplication
|
|
58
|
+
flow_execution_service: FlowExecutionService
|
|
59
|
+
daemon_service: DaemonService
|
|
60
|
+
daemon_state_service: DaemonStateService
|
|
61
|
+
runtime_application: RuntimeApplication
|
|
62
|
+
control_application: OperatorControlApplication
|
|
63
|
+
ledger_service: LedgerService
|
|
64
|
+
log_service: LogService
|
|
65
|
+
runtime_binding_service: WorkspaceRuntimeBindingService
|
|
66
|
+
runtime_history_service: RuntimeHistoryService
|
|
67
|
+
shared_state_service: SharedStateService
|
|
68
|
+
theme_service: ThemeService
|
|
69
|
+
workspace_provisioning_service: WorkspaceProvisioningService
|
|
70
|
+
|
|
71
|
+
|
|
72
|
+
@dataclass(frozen=True)
|
|
73
|
+
class GuiDependencyFactories:
|
|
74
|
+
"""Factories used to build the default GUI dependency bundle."""
|
|
75
|
+
|
|
76
|
+
settings_store_factory: Callable[[Path | None], LocalSettingsStore]
|
|
77
|
+
settings_service_factory: Callable[[LocalSettingsStore], SettingsService]
|
|
78
|
+
workspace_service_factory: Callable[[object | None, object | None], WorkspaceService]
|
|
79
|
+
workspace_session_application_factory: Callable[[WorkspaceService], WorkspaceSessionApplication]
|
|
80
|
+
action_state_application_factory: Callable[[], ActionStateApplication]
|
|
81
|
+
detail_application_factory: Callable[[], DetailApplication]
|
|
82
|
+
flow_catalog_service_factory: Callable[[object], FlowCatalogService]
|
|
83
|
+
flow_catalog_application_factory: Callable[[FlowCatalogService], FlowCatalogApplication]
|
|
84
|
+
flow_execution_service_factory: Callable[[object], FlowExecutionService]
|
|
85
|
+
daemon_service_factory: Callable[[object, object, object, type[Exception]], DaemonService]
|
|
86
|
+
daemon_state_service_factory: Callable[[], DaemonStateService]
|
|
87
|
+
ledger_service_factory: Callable[[], LedgerService]
|
|
88
|
+
log_service_factory: Callable[[], LogService]
|
|
89
|
+
runtime_binding_service_factory: Callable[[LedgerService, LogService, DaemonStateService], WorkspaceRuntimeBindingService]
|
|
90
|
+
runtime_history_service_factory: Callable[[], RuntimeHistoryService]
|
|
91
|
+
shared_state_service_factory: Callable[[], SharedStateService]
|
|
92
|
+
runtime_application_factory: Callable[[DaemonService, DaemonStateService, SharedStateService], RuntimeApplication]
|
|
93
|
+
control_application_factory: Callable[[RuntimeApplication, DaemonStateService], OperatorControlApplication]
|
|
94
|
+
theme_service_factory: Callable[[object, str, object, object, object, object], ThemeService]
|
|
95
|
+
workspace_provisioning_service_factory: Callable[[], WorkspaceProvisioningService]
|
|
96
|
+
|
|
97
|
+
|
|
98
|
+
def default_gui_dependency_factories() -> GuiDependencyFactories:
|
|
99
|
+
"""Return the default constructor bundle for GUI bootstrap objects."""
|
|
100
|
+
return GuiDependencyFactories(
|
|
101
|
+
settings_store_factory=lambda app_root: LocalSettingsStore.open_default(app_root=app_root),
|
|
102
|
+
settings_service_factory=SettingsService,
|
|
103
|
+
workspace_service_factory=lambda discover, resolve: WorkspaceService(
|
|
104
|
+
discover_workspaces_func=discover,
|
|
105
|
+
resolve_workspace_paths_func=resolve,
|
|
106
|
+
)
|
|
107
|
+
if discover is not None or resolve is not None
|
|
108
|
+
else WorkspaceService(),
|
|
109
|
+
workspace_session_application_factory=lambda workspace_service: WorkspaceSessionApplication(
|
|
110
|
+
workspace_service=workspace_service,
|
|
111
|
+
),
|
|
112
|
+
action_state_application_factory=ActionStateApplication,
|
|
113
|
+
detail_application_factory=DetailApplication,
|
|
114
|
+
flow_catalog_service_factory=lambda discover_definitions: FlowCatalogService(
|
|
115
|
+
discover_definitions_func=discover_definitions,
|
|
116
|
+
),
|
|
117
|
+
flow_catalog_application_factory=lambda flow_catalog_service: FlowCatalogApplication(
|
|
118
|
+
flow_catalog_service=flow_catalog_service,
|
|
119
|
+
),
|
|
120
|
+
flow_execution_service_factory=lambda load_flow_func: FlowExecutionService(
|
|
121
|
+
load_flow_func=load_flow_func,
|
|
122
|
+
),
|
|
123
|
+
daemon_service_factory=lambda spawn, request, is_live, error_type: DaemonService(
|
|
124
|
+
spawn_process_func=spawn,
|
|
125
|
+
request_func=request,
|
|
126
|
+
is_live_func=is_live,
|
|
127
|
+
client_error_type=error_type,
|
|
128
|
+
),
|
|
129
|
+
daemon_state_service_factory=DaemonStateService,
|
|
130
|
+
ledger_service_factory=LedgerService,
|
|
131
|
+
log_service_factory=LogService,
|
|
132
|
+
runtime_binding_service_factory=lambda ledger_service, log_service, daemon_state_service: WorkspaceRuntimeBindingService(
|
|
133
|
+
ledger_service=ledger_service,
|
|
134
|
+
log_service=log_service,
|
|
135
|
+
daemon_state_service=daemon_state_service,
|
|
136
|
+
),
|
|
137
|
+
runtime_history_service_factory=RuntimeHistoryService,
|
|
138
|
+
shared_state_service_factory=SharedStateService,
|
|
139
|
+
runtime_application_factory=lambda daemon_service, daemon_state_service, shared_state_service: RuntimeApplication(
|
|
140
|
+
daemon_service=daemon_service,
|
|
141
|
+
daemon_state_service=daemon_state_service,
|
|
142
|
+
shared_state_service=shared_state_service,
|
|
143
|
+
),
|
|
144
|
+
control_application_factory=lambda runtime_application, daemon_state_service: OperatorControlApplication(
|
|
145
|
+
runtime_application=runtime_application,
|
|
146
|
+
daemon_state_service=daemon_state_service,
|
|
147
|
+
),
|
|
148
|
+
theme_service_factory=lambda themes, default_theme_name, resolve, system, toggle, button_text: ThemeService(
|
|
149
|
+
themes=themes,
|
|
150
|
+
default_theme_name=default_theme_name,
|
|
151
|
+
resolve_theme_name_func=resolve,
|
|
152
|
+
system_theme_name_func=system,
|
|
153
|
+
toggle_theme_name_func=toggle,
|
|
154
|
+
theme_button_text_func=button_text,
|
|
155
|
+
),
|
|
156
|
+
workspace_provisioning_service_factory=WorkspaceProvisioningService,
|
|
157
|
+
)
|
|
158
|
+
|
|
159
|
+
|
|
160
|
+
def default_gui_service_kwargs(theme_name: str) -> dict[str, object]:
|
|
161
|
+
"""Return the shared default seam kwargs used by the GUI surface."""
|
|
162
|
+
del theme_name
|
|
163
|
+
return {
|
|
164
|
+
"discover_definitions_func": discover_flow_module_definitions,
|
|
165
|
+
"load_flow_func": load_flow,
|
|
166
|
+
"spawn_process_func": spawn_daemon_process,
|
|
167
|
+
"request_func": daemon_request,
|
|
168
|
+
"is_live_func": is_daemon_live,
|
|
169
|
+
"resolve_theme_name_func": resolve_theme_name,
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def _gui_services_from_kwargs(service_kwargs: dict[str, object]) -> GuiServices:
|
|
174
|
+
"""Convert shared surface service kwargs into GUI-specific services."""
|
|
175
|
+
return GuiServices(
|
|
176
|
+
settings_service=service_kwargs["settings_service"],
|
|
177
|
+
workspace_service=service_kwargs["workspace_service"],
|
|
178
|
+
workspace_session_application=service_kwargs["workspace_session_application"],
|
|
179
|
+
action_state_application=service_kwargs["action_state_application"],
|
|
180
|
+
detail_application=service_kwargs["detail_application"],
|
|
181
|
+
flow_catalog_service=service_kwargs["flow_catalog_service"],
|
|
182
|
+
flow_catalog_application=service_kwargs["flow_catalog_application"],
|
|
183
|
+
flow_execution_service=service_kwargs["flow_execution_service"],
|
|
184
|
+
daemon_service=service_kwargs["daemon_service"],
|
|
185
|
+
daemon_state_service=service_kwargs["daemon_state_service"],
|
|
186
|
+
runtime_application=service_kwargs["runtime_application"],
|
|
187
|
+
control_application=service_kwargs["control_application"],
|
|
188
|
+
ledger_service=service_kwargs["ledger_service"],
|
|
189
|
+
log_service=service_kwargs["log_service"],
|
|
190
|
+
runtime_binding_service=service_kwargs["runtime_binding_service"],
|
|
191
|
+
runtime_history_service=service_kwargs["runtime_history_service"],
|
|
192
|
+
shared_state_service=service_kwargs["shared_state_service"],
|
|
193
|
+
theme_service=service_kwargs["theme_service"],
|
|
194
|
+
workspace_provisioning_service=service_kwargs["workspace_provisioning_service"],
|
|
195
|
+
)
|
|
196
|
+
|
|
197
|
+
|
|
198
|
+
def build_gui_service_kwargs(
|
|
199
|
+
*,
|
|
200
|
+
settings_service: SettingsService | None = None,
|
|
201
|
+
workspace_service: WorkspaceService | None = None,
|
|
202
|
+
workspace_session_application: WorkspaceSessionApplication | None = None,
|
|
203
|
+
action_state_application: ActionStateApplication | None = None,
|
|
204
|
+
detail_application: DetailApplication | None = None,
|
|
205
|
+
flow_catalog_service: FlowCatalogService | None = None,
|
|
206
|
+
flow_catalog_application: FlowCatalogApplication | None = None,
|
|
207
|
+
flow_execution_service: FlowExecutionService | None = None,
|
|
208
|
+
daemon_service: DaemonService | None = None,
|
|
209
|
+
daemon_state_service: DaemonStateService | None = None,
|
|
210
|
+
runtime_application: RuntimeApplication | None = None,
|
|
211
|
+
control_application: OperatorControlApplication | None = None,
|
|
212
|
+
ledger_service: LedgerService | None = None,
|
|
213
|
+
log_service: LogService | None = None,
|
|
214
|
+
runtime_binding_service: WorkspaceRuntimeBindingService | None = None,
|
|
215
|
+
runtime_history_service: RuntimeHistoryService | None = None,
|
|
216
|
+
shared_state_service: SharedStateService | None = None,
|
|
217
|
+
theme_service: ThemeService | None = None,
|
|
218
|
+
workspace_provisioning_service: WorkspaceProvisioningService | None = None,
|
|
219
|
+
settings_store: LocalSettingsStore | None = None,
|
|
220
|
+
factories: GuiDependencyFactories | None = None,
|
|
221
|
+
app_root: Path | None = None,
|
|
222
|
+
discover_workspaces_func=None,
|
|
223
|
+
resolve_workspace_paths_func=None,
|
|
224
|
+
discover_definitions_func=discover_flow_module_definitions,
|
|
225
|
+
load_flow_func=load_flow,
|
|
226
|
+
spawn_process_func=spawn_daemon_process,
|
|
227
|
+
request_func=daemon_request,
|
|
228
|
+
is_live_func=is_daemon_live,
|
|
229
|
+
client_error_type: type[Exception] = DaemonClientError,
|
|
230
|
+
resolve_theme_name_func=resolve_theme_name,
|
|
231
|
+
system_theme_name_func=system_theme_name,
|
|
232
|
+
toggle_theme_name_func=toggle_theme_name,
|
|
233
|
+
theme_button_text_func=theme_button_text,
|
|
234
|
+
themes=THEMES,
|
|
235
|
+
default_theme_name: str | None = None,
|
|
236
|
+
) -> dict[str, Any]:
|
|
237
|
+
"""Build the common service bundle used by the GUI bootstrap module."""
|
|
238
|
+
factories = factories or default_gui_dependency_factories()
|
|
239
|
+
discover_definitions_func = discover_definitions_func or discover_flow_module_definitions
|
|
240
|
+
load_flow_func = load_flow_func or load_flow
|
|
241
|
+
spawn_process_func = spawn_process_func or spawn_daemon_process
|
|
242
|
+
request_func = request_func or daemon_request
|
|
243
|
+
is_live_func = is_live_func or is_daemon_live
|
|
244
|
+
resolve_theme_name_func = resolve_theme_name_func or resolve_theme_name
|
|
245
|
+
system_theme_name_func = system_theme_name_func or system_theme_name
|
|
246
|
+
toggle_theme_name_func = toggle_theme_name_func or toggle_theme_name
|
|
247
|
+
theme_button_text_func = theme_button_text_func or theme_button_text
|
|
248
|
+
themes = themes or THEMES
|
|
249
|
+
default_theme_name = default_theme_name or DEFAULT_THEME
|
|
250
|
+
settings_store = settings_store or factories.settings_store_factory(app_root)
|
|
251
|
+
settings_service = settings_service or factories.settings_service_factory(settings_store)
|
|
252
|
+
workspace_service = workspace_service or factories.workspace_service_factory(
|
|
253
|
+
discover_workspaces_func,
|
|
254
|
+
resolve_workspace_paths_func,
|
|
255
|
+
)
|
|
256
|
+
workspace_session_application = workspace_session_application or factories.workspace_session_application_factory(
|
|
257
|
+
workspace_service,
|
|
258
|
+
)
|
|
259
|
+
action_state_application = action_state_application or factories.action_state_application_factory()
|
|
260
|
+
detail_application = detail_application or factories.detail_application_factory()
|
|
261
|
+
flow_catalog_service = flow_catalog_service or factories.flow_catalog_service_factory(discover_definitions_func)
|
|
262
|
+
flow_catalog_application = flow_catalog_application or factories.flow_catalog_application_factory(flow_catalog_service)
|
|
263
|
+
flow_execution_service = flow_execution_service or factories.flow_execution_service_factory(load_flow_func)
|
|
264
|
+
daemon_service = daemon_service or factories.daemon_service_factory(
|
|
265
|
+
spawn_process_func,
|
|
266
|
+
request_func,
|
|
267
|
+
is_live_func,
|
|
268
|
+
client_error_type,
|
|
269
|
+
)
|
|
270
|
+
daemon_state_service = daemon_state_service or factories.daemon_state_service_factory()
|
|
271
|
+
ledger_service = ledger_service or factories.ledger_service_factory()
|
|
272
|
+
log_service = log_service or factories.log_service_factory()
|
|
273
|
+
runtime_binding_service = runtime_binding_service or factories.runtime_binding_service_factory(
|
|
274
|
+
ledger_service,
|
|
275
|
+
log_service,
|
|
276
|
+
daemon_state_service,
|
|
277
|
+
)
|
|
278
|
+
runtime_history_service = runtime_history_service or factories.runtime_history_service_factory()
|
|
279
|
+
shared_state_service = shared_state_service or factories.shared_state_service_factory()
|
|
280
|
+
workspace_provisioning_service = workspace_provisioning_service or factories.workspace_provisioning_service_factory()
|
|
281
|
+
runtime_application = runtime_application or factories.runtime_application_factory(
|
|
282
|
+
daemon_service,
|
|
283
|
+
daemon_state_service,
|
|
284
|
+
shared_state_service,
|
|
285
|
+
)
|
|
286
|
+
control_application = control_application or factories.control_application_factory(
|
|
287
|
+
runtime_application,
|
|
288
|
+
daemon_state_service,
|
|
289
|
+
)
|
|
290
|
+
theme_service = theme_service or factories.theme_service_factory(
|
|
291
|
+
themes,
|
|
292
|
+
default_theme_name,
|
|
293
|
+
resolve_theme_name_func,
|
|
294
|
+
system_theme_name_func,
|
|
295
|
+
toggle_theme_name_func,
|
|
296
|
+
theme_button_text_func,
|
|
297
|
+
)
|
|
298
|
+
return {
|
|
299
|
+
"settings_service": settings_service,
|
|
300
|
+
"workspace_service": workspace_service,
|
|
301
|
+
"workspace_session_application": workspace_session_application,
|
|
302
|
+
"action_state_application": action_state_application,
|
|
303
|
+
"detail_application": detail_application,
|
|
304
|
+
"flow_catalog_service": flow_catalog_service,
|
|
305
|
+
"flow_catalog_application": flow_catalog_application,
|
|
306
|
+
"flow_execution_service": flow_execution_service,
|
|
307
|
+
"daemon_service": daemon_service,
|
|
308
|
+
"daemon_state_service": daemon_state_service,
|
|
309
|
+
"runtime_application": runtime_application,
|
|
310
|
+
"control_application": control_application,
|
|
311
|
+
"ledger_service": ledger_service,
|
|
312
|
+
"log_service": log_service,
|
|
313
|
+
"runtime_binding_service": runtime_binding_service,
|
|
314
|
+
"runtime_history_service": runtime_history_service,
|
|
315
|
+
"shared_state_service": shared_state_service,
|
|
316
|
+
"theme_service": theme_service,
|
|
317
|
+
"workspace_provisioning_service": workspace_provisioning_service,
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
|
|
321
|
+
def build_default_gui_services(
|
|
322
|
+
*,
|
|
323
|
+
settings_service: SettingsService | None = None,
|
|
324
|
+
workspace_service: WorkspaceService | None = None,
|
|
325
|
+
workspace_session_application: WorkspaceSessionApplication | None = None,
|
|
326
|
+
action_state_application: ActionStateApplication | None = None,
|
|
327
|
+
detail_application: DetailApplication | None = None,
|
|
328
|
+
flow_catalog_service: FlowCatalogService | None = None,
|
|
329
|
+
flow_catalog_application: FlowCatalogApplication | None = None,
|
|
330
|
+
flow_execution_service: FlowExecutionService | None = None,
|
|
331
|
+
daemon_service: DaemonService | None = None,
|
|
332
|
+
daemon_state_service: DaemonStateService | None = None,
|
|
333
|
+
runtime_application: RuntimeApplication | None = None,
|
|
334
|
+
control_application: OperatorControlApplication | None = None,
|
|
335
|
+
ledger_service: LedgerService | None = None,
|
|
336
|
+
log_service: LogService | None = None,
|
|
337
|
+
runtime_binding_service: WorkspaceRuntimeBindingService | None = None,
|
|
338
|
+
runtime_history_service: RuntimeHistoryService | None = None,
|
|
339
|
+
shared_state_service: SharedStateService | None = None,
|
|
340
|
+
theme_service: ThemeService | None = None,
|
|
341
|
+
workspace_provisioning_service: WorkspaceProvisioningService | None = None,
|
|
342
|
+
settings_store: LocalSettingsStore | None = None,
|
|
343
|
+
factories: GuiDependencyFactories | None = None,
|
|
344
|
+
app_root: Path | None = None,
|
|
345
|
+
discover_workspaces_func=None,
|
|
346
|
+
resolve_workspace_paths_func=None,
|
|
347
|
+
discover_definitions_func=None,
|
|
348
|
+
load_flow_func=None,
|
|
349
|
+
spawn_process_func=None,
|
|
350
|
+
request_func=None,
|
|
351
|
+
is_live_func=None,
|
|
352
|
+
client_error_type: type[Exception] = DaemonClientError,
|
|
353
|
+
resolve_theme_name_func=None,
|
|
354
|
+
system_theme_name_func=None,
|
|
355
|
+
toggle_theme_name_func=None,
|
|
356
|
+
theme_button_text_func=None,
|
|
357
|
+
themes=None,
|
|
358
|
+
default_theme_name: str | None = None,
|
|
359
|
+
) -> GuiServices:
|
|
360
|
+
"""Build the default desktop GUI service set."""
|
|
361
|
+
service_kwargs = build_gui_service_kwargs(
|
|
362
|
+
settings_service=settings_service,
|
|
363
|
+
workspace_service=workspace_service,
|
|
364
|
+
workspace_session_application=workspace_session_application,
|
|
365
|
+
action_state_application=action_state_application,
|
|
366
|
+
detail_application=detail_application,
|
|
367
|
+
flow_catalog_service=flow_catalog_service,
|
|
368
|
+
flow_catalog_application=flow_catalog_application,
|
|
369
|
+
flow_execution_service=flow_execution_service,
|
|
370
|
+
daemon_service=daemon_service,
|
|
371
|
+
daemon_state_service=daemon_state_service,
|
|
372
|
+
runtime_application=runtime_application,
|
|
373
|
+
control_application=control_application,
|
|
374
|
+
ledger_service=ledger_service,
|
|
375
|
+
log_service=log_service,
|
|
376
|
+
runtime_binding_service=runtime_binding_service,
|
|
377
|
+
runtime_history_service=runtime_history_service,
|
|
378
|
+
shared_state_service=shared_state_service,
|
|
379
|
+
theme_service=theme_service,
|
|
380
|
+
workspace_provisioning_service=workspace_provisioning_service,
|
|
381
|
+
settings_store=settings_store,
|
|
382
|
+
factories=factories,
|
|
383
|
+
app_root=app_root,
|
|
384
|
+
discover_workspaces_func=discover_workspaces_func,
|
|
385
|
+
resolve_workspace_paths_func=resolve_workspace_paths_func,
|
|
386
|
+
discover_definitions_func=discover_definitions_func,
|
|
387
|
+
load_flow_func=load_flow_func,
|
|
388
|
+
spawn_process_func=spawn_process_func,
|
|
389
|
+
request_func=request_func,
|
|
390
|
+
is_live_func=is_live_func,
|
|
391
|
+
client_error_type=client_error_type,
|
|
392
|
+
resolve_theme_name_func=resolve_theme_name_func,
|
|
393
|
+
system_theme_name_func=system_theme_name_func,
|
|
394
|
+
toggle_theme_name_func=toggle_theme_name_func,
|
|
395
|
+
theme_button_text_func=theme_button_text_func,
|
|
396
|
+
themes=themes,
|
|
397
|
+
default_theme_name=default_theme_name,
|
|
398
|
+
)
|
|
399
|
+
return _gui_services_from_kwargs(service_kwargs)
|
|
400
|
+
|
|
401
|
+
|
|
402
|
+
def build_gui_services(
|
|
403
|
+
*,
|
|
404
|
+
settings_service: SettingsService | None = None,
|
|
405
|
+
workspace_service: WorkspaceService | None = None,
|
|
406
|
+
workspace_session_application: WorkspaceSessionApplication | None = None,
|
|
407
|
+
action_state_application: ActionStateApplication | None = None,
|
|
408
|
+
detail_application: DetailApplication | None = None,
|
|
409
|
+
flow_catalog_service: FlowCatalogService | None = None,
|
|
410
|
+
flow_catalog_application: FlowCatalogApplication | None = None,
|
|
411
|
+
flow_execution_service: FlowExecutionService | None = None,
|
|
412
|
+
daemon_service: DaemonService | None = None,
|
|
413
|
+
daemon_state_service: DaemonStateService | None = None,
|
|
414
|
+
runtime_application: RuntimeApplication | None = None,
|
|
415
|
+
control_application: OperatorControlApplication | None = None,
|
|
416
|
+
ledger_service: LedgerService | None = None,
|
|
417
|
+
log_service: LogService | None = None,
|
|
418
|
+
runtime_history_service: RuntimeHistoryService | None = None,
|
|
419
|
+
shared_state_service: SharedStateService | None = None,
|
|
420
|
+
theme_service: ThemeService | None = None,
|
|
421
|
+
workspace_provisioning_service: WorkspaceProvisioningService | None = None,
|
|
422
|
+
settings_store: LocalSettingsStore | None = None,
|
|
423
|
+
factories: GuiDependencyFactories | None = None,
|
|
424
|
+
app_root: Path | None = None,
|
|
425
|
+
discover_workspaces_func=None,
|
|
426
|
+
resolve_workspace_paths_func=None,
|
|
427
|
+
discover_definitions_func=None,
|
|
428
|
+
load_flow_func=None,
|
|
429
|
+
spawn_process_func=None,
|
|
430
|
+
request_func=None,
|
|
431
|
+
is_live_func=None,
|
|
432
|
+
client_error_type: type[Exception] = DaemonClientError,
|
|
433
|
+
resolve_theme_name_func=None,
|
|
434
|
+
system_theme_name_func=None,
|
|
435
|
+
toggle_theme_name_func=None,
|
|
436
|
+
theme_button_text_func=None,
|
|
437
|
+
themes=None,
|
|
438
|
+
default_theme_name: str | None = None,
|
|
439
|
+
) -> GuiServices:
|
|
440
|
+
"""Compatibility wrapper around the GUI default composition root."""
|
|
441
|
+
return build_default_gui_services(
|
|
442
|
+
settings_service=settings_service,
|
|
443
|
+
workspace_service=workspace_service,
|
|
444
|
+
workspace_session_application=workspace_session_application,
|
|
445
|
+
action_state_application=action_state_application,
|
|
446
|
+
detail_application=detail_application,
|
|
447
|
+
flow_catalog_service=flow_catalog_service,
|
|
448
|
+
flow_catalog_application=flow_catalog_application,
|
|
449
|
+
flow_execution_service=flow_execution_service,
|
|
450
|
+
daemon_service=daemon_service,
|
|
451
|
+
daemon_state_service=daemon_state_service,
|
|
452
|
+
runtime_application=runtime_application,
|
|
453
|
+
control_application=control_application,
|
|
454
|
+
ledger_service=ledger_service,
|
|
455
|
+
log_service=log_service,
|
|
456
|
+
runtime_history_service=runtime_history_service,
|
|
457
|
+
shared_state_service=shared_state_service,
|
|
458
|
+
theme_service=theme_service,
|
|
459
|
+
workspace_provisioning_service=workspace_provisioning_service,
|
|
460
|
+
settings_store=settings_store,
|
|
461
|
+
factories=factories,
|
|
462
|
+
app_root=app_root,
|
|
463
|
+
discover_workspaces_func=discover_workspaces_func,
|
|
464
|
+
resolve_workspace_paths_func=resolve_workspace_paths_func,
|
|
465
|
+
discover_definitions_func=discover_definitions_func,
|
|
466
|
+
load_flow_func=load_flow_func,
|
|
467
|
+
spawn_process_func=spawn_process_func,
|
|
468
|
+
request_func=request_func,
|
|
469
|
+
is_live_func=is_live_func,
|
|
470
|
+
client_error_type=client_error_type,
|
|
471
|
+
resolve_theme_name_func=resolve_theme_name_func,
|
|
472
|
+
system_theme_name_func=system_theme_name_func,
|
|
473
|
+
toggle_theme_name_func=toggle_theme_name_func,
|
|
474
|
+
theme_button_text_func=theme_button_text_func,
|
|
475
|
+
themes=themes,
|
|
476
|
+
default_theme_name=default_theme_name,
|
|
477
|
+
)
|
|
478
|
+
|
|
479
|
+
__all__ = [
|
|
480
|
+
"GuiDependencyFactories",
|
|
481
|
+
"GuiServices",
|
|
482
|
+
"build_default_gui_services",
|
|
483
|
+
"build_gui_service_kwargs",
|
|
484
|
+
"build_gui_services",
|
|
485
|
+
"default_gui_dependency_factories",
|
|
486
|
+
"default_gui_service_kwargs",
|
|
487
|
+
]
|