sayou-visualizer 0.0.3__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.
@@ -0,0 +1,5 @@
1
+ from sayou.core.exceptions import SayouCoreError
2
+
3
+
4
+ class VisualizerError(SayouCoreError):
5
+ pass
@@ -0,0 +1,17 @@
1
+ from dataclasses import dataclass, field
2
+ from typing import Any, Dict, Optional
3
+
4
+
5
+ @dataclass
6
+ class VisualizationTask:
7
+ data: Any
8
+ data_type: str
9
+ meta: Dict[str, Any] = field(default_factory=dict)
10
+ recommended_renderer: Optional[str] = None
11
+
12
+
13
+ @dataclass
14
+ class VisualizationResult:
15
+ success: bool
16
+ output_path: Optional[str] = None
17
+ error: Optional[str] = None
@@ -0,0 +1,24 @@
1
+ from abc import abstractmethod
2
+
3
+ from sayou.core.base_component import BaseComponent
4
+
5
+ from ..core.schemas import VisualizationResult, VisualizationTask
6
+
7
+
8
+ class BaseRenderer(BaseComponent):
9
+ component_name = "BaseRenderer"
10
+
11
+ def render(
12
+ self, task: VisualizationTask, output_path: str, **kwargs
13
+ ) -> VisualizationResult:
14
+ self._log(f"[{self.component_name}] Rendering to {output_path}...")
15
+ try:
16
+ return self._do_render(task, output_path, **kwargs)
17
+ except Exception as e:
18
+ return VisualizationResult(success=False, error=str(e))
19
+
20
+ @abstractmethod
21
+ def _do_render(
22
+ self, task: VisualizationTask, output_path: str, **kwargs
23
+ ) -> VisualizationResult:
24
+ raise NotImplementedError
@@ -0,0 +1,68 @@
1
+ from sayou.core.base_component import BaseComponent
2
+
3
+ from .renderer.pyvis_renderer import PyVisRenderer
4
+ from .tracer.graph_tracer import GraphTracer
5
+ from .tracer.rich_tracer import RichConsoleTracer
6
+ from .tracer.websocket_tracer import WebSocketTracer
7
+
8
+
9
+ class VisualizerPipeline(BaseComponent):
10
+ """
11
+ The main facade for Sayou Visualization.
12
+
13
+ It manages the internal Tracer (recording events) and Renderer (drawing graphs),
14
+ providing a simple interface for the user.
15
+ """
16
+
17
+ component_name = "VisualizerPipeline"
18
+
19
+ def __init__(self):
20
+ super().__init__()
21
+ self._graph_tracer = None
22
+ self._rich_tracer = None
23
+ self._ws_tracer = None
24
+ self._renderer = None
25
+
26
+ def attach_to(self, target_pipeline: BaseComponent, mode: str = "report", **kwargs):
27
+ """
28
+ Connects this visualizer to a target pipeline (Connector, Refinery, etc.).
29
+ """
30
+ if mode == "report":
31
+ self._graph_tracer = GraphTracer()
32
+ target_pipeline.add_callback(self._graph_tracer)
33
+ self._log("Attached GraphTracer for HTML reporting.")
34
+
35
+ elif mode == "live":
36
+ self._rich_tracer = RichConsoleTracer()
37
+ target_pipeline.add_callback(self._rich_tracer)
38
+ self._log("Attached RichConsoleTracer for live monitoring.")
39
+
40
+ elif mode == "websocket":
41
+ url = kwargs.get("url")
42
+ if not url:
43
+ raise ValueError("WebSocket mode requires a 'url' parameter.")
44
+
45
+ self._ws_tracer = WebSocketTracer(server_url=url)
46
+ target_pipeline.add_callback(self._ws_tracer)
47
+ self._log(f"Attached WebSocketTracer to {url}")
48
+
49
+ def report(self, output_path: str = "report.html", **kwargs):
50
+ if self._graph_tracer.graph.number_of_nodes() == 0:
51
+ self._log("No events recorded. The graph is empty.", level="warning")
52
+ return
53
+
54
+ self._log(
55
+ f"Generating report with {self._graph_tracer.graph.number_of_nodes()} nodes..."
56
+ )
57
+ self._renderer = PyVisRenderer()
58
+ self._renderer.render(self._graph_tracer.graph, output_path, **kwargs)
59
+
60
+ def save_live_log(self, output_path="live_status.html"):
61
+ if self._rich_tracer:
62
+ self._rich_tracer.save_html(output_path)
63
+ self._log(f"Live log saved to: {output_path}")
64
+ else:
65
+ self._log(
66
+ "RichTracer is not active. Use attach_to(..., mode='live')",
67
+ level="warning",
68
+ )
@@ -0,0 +1,80 @@
1
+ from pyvis.network import Network
2
+ from sayou.core.base_component import BaseComponent
3
+
4
+
5
+ class PyVisRenderer(BaseComponent):
6
+ component_name = "PyVisRenderer"
7
+
8
+ def render(self, graph, output_path="pipeline_report.html"):
9
+ net = Network(
10
+ height="100vh",
11
+ width="100%",
12
+ bgcolor="#1e1e1e",
13
+ font_color="#c7c7c7",
14
+ directed=True,
15
+ )
16
+ net.from_nx(graph)
17
+
18
+ net.set_options(
19
+ """
20
+ var options = {
21
+ "nodes": {
22
+ "borderWidth": 0,
23
+ "borderWidthSelected": 2,
24
+ "shadow": {
25
+ "enabled": true,
26
+ "color": "rgba(0,0,0,0.5)",
27
+ "size": 10,
28
+ "x": 5,
29
+ "y": 5
30
+ },
31
+ "font": {
32
+ "face": "Roboto, Helvetica, Arial",
33
+ "size": 14,
34
+ "color": "#ffffff",
35
+ "strokeWidth": 0,
36
+ "strokeColor": "#ffffff"
37
+ }
38
+ },F
39
+ "edges": {
40
+ "color": {
41
+ "color": "#505050",
42
+ "highlight": "#ffffff",
43
+ "hover": "#ffffff",
44
+ "opacity": 0.5
45
+ },
46
+ "arrows": {
47
+ "to": { "enabled": true, "scaleFactor": 0.5 }
48
+ },
49
+ "smooth": {
50
+ "type": "continuous",
51
+ "roundness": 0.5
52
+ }
53
+ },
54
+ "physics": {
55
+ "forceAtlas2Based": {
56
+ "gravitationalConstant": -80,
57
+ "centralGravity": 0.005,
58
+ "springLength": 150,
59
+ "springConstant": 0.18,
60
+ "damping": 0.9
61
+ },
62
+ "maxVelocity": 40,
63
+ "minVelocity": 0.75,
64
+ "solver": "forceAtlas2Based",
65
+ "stabilization": {
66
+ "enabled": true,
67
+ "iterations": 1000,
68
+ "updateInterval": 25
69
+ }
70
+ },
71
+ "interaction": {
72
+ "hover": true,
73
+ "tooltipDelay": 200
74
+ }
75
+ }
76
+ """
77
+ )
78
+
79
+ net.save_graph(output_path)
80
+ self._log(f"Visualization saved to: {output_path}")
@@ -0,0 +1,94 @@
1
+ import networkx as nx
2
+ from sayou.core.callbacks import BaseCallback
3
+
4
+
5
+ class GraphTracer(BaseCallback):
6
+ def __init__(self):
7
+ self.graph = nx.DiGraph()
8
+ self.graph.add_node(
9
+ "Root",
10
+ label="Sayou Pipeline",
11
+ color="#ffffff",
12
+ shape="dot",
13
+ size=25,
14
+ font={"size": 20, "color": "black"},
15
+ )
16
+
17
+ def on_start(self, component_name, input_data, **kwargs):
18
+ try:
19
+ comp_node = f"Comp:{component_name}"
20
+
21
+ color = "#a5b1c2"
22
+ size = 15
23
+
24
+ if "ConnectorPipeline" in component_name:
25
+ color = "#ffffff"
26
+ size = 20
27
+ elif "Generator" in component_name:
28
+ color = "#00d2d3"
29
+ size = 15
30
+ elif "Fetcher" in component_name:
31
+ color = "#ff9f43"
32
+ size = 15
33
+
34
+ if not self.graph.has_node(comp_node):
35
+ self.graph.add_node(
36
+ comp_node, label=component_name, shape="dot", color=color, size=size
37
+ )
38
+
39
+ if "Pipeline" in component_name:
40
+ self.graph.add_edge("Root", comp_node)
41
+ else:
42
+ parent = "Comp:ConnectorPipeline"
43
+ if not self.graph.has_node(parent):
44
+ parent = "Root"
45
+ self.graph.add_edge(parent, comp_node)
46
+
47
+ data_id = self._get_data_id(input_data)
48
+ if data_id:
49
+ label_text = str(data_id)
50
+ if len(label_text) > 25:
51
+ label_text = label_text[:22] + "..."
52
+
53
+ node_id = f"Data:{data_id}"
54
+ if not self.graph.has_node(node_id):
55
+ self.graph.add_node(
56
+ node_id,
57
+ label=label_text,
58
+ title=str(data_id),
59
+ shape="dot",
60
+ size=8,
61
+ color={"background": "#57606f", "border": "#57606f"},
62
+ )
63
+
64
+ self.graph.add_edge(comp_node, node_id)
65
+
66
+ except Exception as e:
67
+ print(f"!!! TRACER ERROR: {e}")
68
+
69
+ def on_finish(self, component_name, result_data, success, **kwargs):
70
+ try:
71
+ data_id = self._get_data_id_from_result(result_data)
72
+ if data_id:
73
+ node_id = f"Data:{data_id}"
74
+ if self.graph.has_node(node_id):
75
+ color = "#54a0ff" if success else "#ff6b6b"
76
+ self.graph.nodes[node_id]["color"] = color
77
+ self.graph.nodes[node_id]["size"] = 10
78
+ except Exception as e:
79
+ print(f"!!! TRACER ERROR in on_finish: {e}")
80
+ pass
81
+
82
+ def _get_data_id(self, data):
83
+ if isinstance(data, dict):
84
+ return data.get("source") or data.get("uri")
85
+ if hasattr(data, "uri"):
86
+ return data.uri
87
+ if hasattr(data, "source"):
88
+ return data.source
89
+ return None
90
+
91
+ def _get_data_id_from_result(self, data):
92
+ if hasattr(data, "task") and hasattr(data.task, "uri"):
93
+ return data.task.uri
94
+ return None
@@ -0,0 +1,65 @@
1
+ from rich.console import Console
2
+ from rich.live import Live
3
+ from rich.panel import Panel
4
+ from rich.spinner import Spinner
5
+ from rich.tree import Tree
6
+ from sayou.core.callbacks import BaseCallback
7
+
8
+
9
+ class RichConsoleTracer(BaseCallback):
10
+ def __init__(self):
11
+ self.root_tree = Tree("🚀 [bold white]Pipeline Started[/]")
12
+ self.comp_branches = {}
13
+ self.live = Live(self.render_panel(), refresh_per_second=4)
14
+ self.record_console = Console(record=True)
15
+
16
+ def render_panel(self):
17
+ return Panel(
18
+ self.root_tree, title="Sayou Fabric - Live Status", border_style="blue"
19
+ )
20
+
21
+ def on_start(self, component_name, input_data, **kwargs):
22
+ if not self.live.is_started:
23
+ self.live.start()
24
+
25
+ if component_name not in self.comp_branches:
26
+ if "ConnectorPipeline" in component_name:
27
+ branch = self.root_tree
28
+ else:
29
+ icon = "💎" if "Generator" in component_name else "⚡"
30
+ branch = self.root_tree.add(f"{icon} [bold cyan]{component_name}[/]")
31
+
32
+ self.comp_branches[component_name] = branch
33
+
34
+ branch = self.comp_branches[component_name]
35
+ data_id = self._get_simple_id(input_data)
36
+
37
+ if data_id:
38
+ branch.add(f"[yellow]Processing:[/] {data_id}")
39
+ self.live.refresh()
40
+
41
+ def on_finish(self, component_name, result_data, success, **kwargs):
42
+ # 완료 시점 처리 (여기서는 단순화를 위해 색상 변경 등은 생략하고 로그처럼 쌓이게 둠)
43
+ # 고도화 시: Tree의 마지막 노드를 찾아서 아이콘을 ✅로 변경 가능
44
+ pass
45
+
46
+ def on_error(self, component_name, error, **kwargs):
47
+ branch = self.comp_branches.get(component_name, self.root_tree)
48
+ branch.add(f"❌ [bold red]Error:[/] {str(error)}")
49
+ self.live.refresh()
50
+
51
+ def stop(self):
52
+ self.root_tree.add("✅ [bold green]Finished[/]")
53
+ self.live.stop()
54
+
55
+ def _get_simple_id(self, data):
56
+ if isinstance(data, dict):
57
+ return data.get("source")
58
+ if hasattr(data, "uri"):
59
+ return data.uri
60
+ return None
61
+
62
+ def save_html(self, filename="live_log.html"):
63
+ self.record_console.print(self.render_panel())
64
+ self.record_console.save_html(filename)
65
+ self.record_console.save_svg(filename.replace(".html", ".svg"))
@@ -0,0 +1,60 @@
1
+ import json
2
+ import queue
3
+ import threading
4
+
5
+ import websocket
6
+ from sayou.core.callbacks import BaseCallback
7
+
8
+
9
+ class WebSocketTracer(BaseCallback):
10
+
11
+ def __init__(self, server_url: str):
12
+ self.server_url = server_url
13
+ self.queue = queue.Queue()
14
+ self.running = True
15
+
16
+ self.worker_thread = threading.Thread(target=self._sender_loop, daemon=True)
17
+ self.worker_thread.start()
18
+
19
+ def on_start(self, component_name, input_data, **kwargs):
20
+ payload = {
21
+ "type": "START",
22
+ "component": component_name,
23
+ "data": self._serialize(input_data),
24
+ }
25
+ self.queue.put(payload)
26
+
27
+ def on_finish(self, component_name, result_data, success, **kwargs):
28
+ payload = {
29
+ "type": "FINISH",
30
+ "component": component_name,
31
+ "success": success,
32
+ "data": self._serialize(result_data),
33
+ }
34
+ self.queue.put(payload)
35
+
36
+ def _sender_loop(self):
37
+ ws = None
38
+ try:
39
+ ws = websocket.create_connection(self.server_url)
40
+
41
+ while self.running:
42
+ try:
43
+ payload = self.queue.get(timeout=1.0)
44
+
45
+ ws.send(json.dumps(payload))
46
+
47
+ except queue.Empty:
48
+ continue
49
+ except Exception as e:
50
+ print(f"!!! WebSocket Connection Error: {e}")
51
+ finally:
52
+ if ws:
53
+ ws.close()
54
+
55
+ def _serialize(self, data):
56
+ if hasattr(data, "uri"):
57
+ return data.uri
58
+ if isinstance(data, dict):
59
+ return str(data)
60
+ return str(data)
@@ -0,0 +1,294 @@
1
+ Metadata-Version: 2.4
2
+ Name: sayou-visualizer
3
+ Version: 0.0.3
4
+ Summary: Connector components for the Sayou Data Platform
5
+ Project-URL: Homepage, https://www.sayouzone.com/
6
+ Project-URL: Documentation, https://sayouzone.github.io/sayou-fabric/
7
+ Project-URL: Repository, https://github.com/sayouzone/sayou-fabric
8
+ Author-email: Sayouzone <contact@sayouzone.com>
9
+ License: Apache License
10
+ Version 2.0, January 2004
11
+ http://www.apache.org/licenses/
12
+
13
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
14
+
15
+ 1. Definitions.
16
+
17
+ "License" shall mean the terms and conditions for use, reproduction,
18
+ and distribution as defined by Sections 1 through 9 of this document.
19
+
20
+ "Licensor" shall mean the copyright owner or entity authorized by
21
+ the copyright owner that is granting the License.
22
+
23
+ "Legal Entity" shall mean the union of the acting entity and all
24
+ other entities that control, are controlled by, or are under common
25
+ control with that entity. For the purposes of this definition,
26
+ "control" means (i) the power, direct or indirect, to cause the
27
+ direction or management of such entity, whether by contract or
28
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
29
+ outstanding shares, or (iii) beneficial ownership of such entity.
30
+
31
+ "You" (or "Your") shall mean an individual or Legal Entity
32
+ exercising permissions granted by this License.
33
+
34
+ "Source" form shall mean the preferred form for making modifications,
35
+ including but not limited to software source code, documentation
36
+ source, and configuration files.
37
+
38
+ "Object" form shall mean any form resulting from mechanical
39
+ transformation or translation of a Source form, including but
40
+ not limited to compiled object code, generated documentation,
41
+ and conversions to other media types.
42
+
43
+ "Work" shall mean the work of authorship, whether in Source or
44
+ Object form, made available under the License, as indicated by a
45
+ copyright notice that is included in or attached to the work
46
+ (an example is provided in the Appendix below).
47
+
48
+ "Derivative Works" shall mean any work, whether in Source or Object
49
+ form, that is based on (or derived from) the Work and for which the
50
+ editorial revisions, annotations, elaborations, or other modifications
51
+ represent, as a whole, an original work of authorship. For the purposes
52
+ of this License, Derivative Works shall not include works that remain
53
+ separable from, or merely link (or bind by name) to the interfaces of,
54
+ the Work and Derivative Works thereof.
55
+
56
+ "Contribution" shall mean any work of authorship, including
57
+ the original version of the Work and any modifications or additions
58
+ to that Work or Derivative Works thereof, that is intentionally
59
+ submitted to Licensor for inclusion in the Work by the copyright owner
60
+ or by an individual or Legal Entity authorized to submit on behalf of
61
+ the copyright owner. For the purposes of this definition, "submitted"
62
+ means any form of electronic, verbal, or written communication sent
63
+ to the Licensor or its representatives, including but not limited to
64
+ communication on electronic mailing lists, source code control systems,
65
+ and issue tracking systems that are managed by, or on behalf of, the
66
+ Licensor for the purpose of discussing and improving the Work, but
67
+ excluding communication that is conspicuously marked or otherwise
68
+ designated in writing by the copyright owner as "Not a Contribution."
69
+
70
+ "Contributor" shall mean Licensor and any individual or Legal Entity
71
+ on behalf of whom a Contribution has been received by Licensor and
72
+ subsequently incorporated within the Work.
73
+
74
+ 2. Grant of Copyright License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ copyright license to reproduce, prepare Derivative Works of,
78
+ publicly display, publicly perform, sublicense, and distribute the
79
+ Work and such Derivative Works in Source or Object form.
80
+
81
+ 3. Grant of Patent License. Subject to the terms and conditions of
82
+ this License, each Contributor hereby grants to You a perpetual,
83
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
84
+ (except as stated in this section) patent license to make, have made,
85
+ use, offer to sell, sell, import, and otherwise transfer the Work,
86
+ where such license applies only to those patent claims licensable
87
+ by such Contributor that are necessarily infringed by their
88
+ Contribution(s) alone or by combination of their Contribution(s)
89
+ with the Work to which such Contribution(s) was submitted. If You
90
+ institute patent litigation against any entity (including a
91
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
92
+ or a Contribution incorporated within the Work constitutes direct
93
+ or contributory patent infringement, then any patent licenses
94
+ granted to You under this License for that Work shall terminate
95
+ as of the date such litigation is filed.
96
+
97
+ 4. Redistribution. You may reproduce and distribute copies of the
98
+ Work or Derivative Works thereof in any medium, with or without
99
+ modifications, and in Source or Object form, provided that You
100
+ meet the following conditions:
101
+
102
+ (a) You must give any other recipients of the Work or
103
+ Derivative Works a copy of this License; and
104
+
105
+ (b) You must cause any modified files to carry prominent notices
106
+ stating that You changed the files; and
107
+
108
+ (c) You must retain, in the Source form of any Derivative Works
109
+ that You distribute, all copyright, patent, trademark, and
110
+ attribution notices from the Source form of the Work,
111
+ excluding those notices that do not pertain to any part of
112
+ the Derivative Works; and
113
+
114
+ (d) If the Work includes a "NOTICE" text file as part of its
115
+ distribution, then any Derivative Works that You distribute must
116
+ include a readable copy of the attribution notices contained
117
+ within such NOTICE file, excluding those notices that do not
118
+ pertain to any part of the Derivative Works, in at least one
119
+ of the following places: within a NOTICE text file distributed
120
+ as part of the Derivative Works; within the Source form or
121
+ documentation, if provided along with the Derivative Works; or,
122
+ within a display generated by the Derivative Works, if and
123
+ wherever such third-party notices normally appear. The contents
124
+ of the NOTICE file are for informational purposes only and
125
+ do not modify the License. You may add Your own attribution
126
+ notices within Derivative Works that You distribute, alongside
127
+ or as an addendum to the NOTICE text from the Work, provided
128
+ that such additional attribution notices cannot be construed
129
+ as modifying the License.
130
+
131
+ You may add Your own copyright statement to Your modifications and
132
+ may provide additional or different license terms and conditions
133
+ for use, reproduction, or distribution of Your modifications, or
134
+ for any such Derivative Works as a whole, provided Your use,
135
+ reproduction, and distribution of the Work otherwise complies with
136
+ the conditions stated in this License.
137
+
138
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
139
+ any Contribution intentionally submitted for inclusion in the Work
140
+ by You to the Licensor shall be under the terms and conditions of
141
+ this License, without any additional terms or conditions.
142
+ Notwithstanding the above, nothing herein shall supersede or modify
143
+ the terms of any separate license agreement you may have executed
144
+ with Licensor regarding such Contributions.
145
+
146
+ 6. Trademarks. This License does not grant permission to use the trade
147
+ names, trademarks, service marks, or product names of the Licensor,
148
+ except as required for reasonable and customary use in describing the
149
+ origin of the Work and reproducing the content of the NOTICE file.
150
+
151
+ 7. Disclaimer of Warranty. Unless required by applicable law or
152
+ agreed to in writing, Licensor provides the Work (and each
153
+ Contributor provides its Contributions) on an "AS IS" BASIS,
154
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
155
+ implied, including, without limitation, any warranties or conditions
156
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
157
+ PARTICULAR PURPOSE. You are solely responsible for determining the
158
+ appropriateness of using or redistributing the Work and assume any
159
+ risks associated with Your exercise of permissions under this License.
160
+
161
+ 8. Limitation of Liability. In no event and under no legal theory,
162
+ whether in tort (including negligence), contract, or otherwise,
163
+ unless required by applicable law (such as deliberate and grossly
164
+ negligent acts) or agreed to in writing, shall any Contributor be
165
+ liable to You for damages, including any direct, indirect, special,
166
+ incidental, or consequential damages of any character arising as a
167
+ result of this License or out of the use or inability to use the
168
+ Work (including but not limited to damages for loss of goodwill,
169
+ work stoppage, computer failure or malfunction, or any and all
170
+ other commercial damages or losses), even if such Contributor
171
+ has been advised of the possibility of such damages.
172
+
173
+ 9. Accepting Warranty or Additional Liability. While redistributing
174
+ the Work or Derivative Works thereof, You may choose to offer,
175
+ and charge a fee for, acceptance of support, warranty, indemnity,
176
+ or other liability obligations and/or rights consistent with this
177
+ License. However, in accepting such obligations, You may act only
178
+ on Your own behalf and on Your sole responsibility, not on behalf
179
+ of any other Contributor, and only if You agree to indemnify,
180
+ defend, and hold each Contributor harmless for any liability
181
+ incurred by, or claims asserted against, such Contributor by reason
182
+ of your accepting any such warranty or additional liability.
183
+
184
+ END OF TERMS AND CONDITIONS
185
+
186
+ APPENDIX: How to apply the Apache License to your work.
187
+
188
+ To apply the Apache License to your work, attach the following
189
+ boilerplate notice, with the fields enclosed by brackets "[]"
190
+ replaced with your own identifying information. (Don't include
191
+ the brackets!) The text should be enclosed in the appropriate
192
+ comment syntax for the file format. We also recommend that a
193
+ file or class name and description of purpose be included on the
194
+ same "printed page" as the copyright notice for easier
195
+ identification within third-party archives.
196
+
197
+ Copyright [yyyy] [name of copyright owner]
198
+
199
+ Licensed under the Apache License, Version 2.0 (the "License");
200
+ you may not use this file except in compliance with the License.
201
+ You may obtain a copy of the License at
202
+
203
+ http://www.apache.org/licenses/LICENSE-2.0
204
+
205
+ Unless required by applicable law or agreed to in writing, software
206
+ distributed under the License is distributed on an "AS IS" BASIS,
207
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
208
+ See the License for the specific language governing permissions and
209
+ limitations under the License.
210
+ Classifier: License :: OSI Approved :: Apache Software License
211
+ Classifier: Operating System :: OS Independent
212
+ Classifier: Programming Language :: Python :: 3.9
213
+ Classifier: Programming Language :: Python :: 3.10
214
+ Classifier: Programming Language :: Python :: 3.11
215
+ Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
216
+ Requires-Python: >=3.9
217
+ Requires-Dist: networkx~=3.4.2
218
+ Requires-Dist: pyvis~=0.3.2
219
+ Requires-Dist: rich~=14.2.0
220
+ Requires-Dist: sayou-core~=0.2.2
221
+ Requires-Dist: websocket-client~=1.9.0
222
+ Description-Content-Type: text/markdown
223
+
224
+ # sayou-visualizer
225
+
226
+ [![PyPI version](https://img.shields.io/pypi/v/sayou-visualizer.svg?color=blue)](https://pypi.org/project/sayou-visualizer/)
227
+ [![License](https://img.shields.io/badge/License-Apache%202.0-red.svg)](https://www.apache.org/licenses/LICENSE-2.0)
228
+
229
+ **The Interactive Observability Engine for Sayou Fabric.**
230
+
231
+ `sayou-visualizer` provides a transparent layer to monitor and visualize the execution flow of Sayou components. By attaching to any pipeline, it transforms invisible execution logs into intuitive, interactive **HTML Knowledge Graphs**.
232
+
233
+ It separates the logic of **Observation** (Tracer) from **Presentation** (Renderer), allowing you to debug complex pipelines and visualize data lineage without modifying your core logic.
234
+
235
+ ## 💡 Core Philosophy
236
+
237
+ **"Trace the Process, Render the Insight."**
238
+
239
+ Observability should not be an afterthought. We decouple the responsibility into two roles:
240
+
241
+ 1. **Tracer (Recorder)**: The "Camera". It silently observes events (`on_start`, `on_finish`) from the pipeline via the Callback system and builds an internal graph structure.
242
+
243
+ 2. **Renderer (Painter)**: The "Canvas". It takes the recorded graph and generates human-readable artifacts (e.g., Interactive HTML, Static Images).
244
+
245
+ This separation enables a Non-intrusive Monitoring experience, where visualization is just a plug-and-play feature.
246
+
247
+ ## 📦 Installation
248
+
249
+ ```bash
250
+ pip install sayou-visualizer
251
+ ```
252
+
253
+ ## ⚡ Quick Start
254
+
255
+ The `VisualizerPipeline` acts as a facade, easily attaching to other pipelines to generate reports.
256
+
257
+ ```python
258
+ from sayou.connector.pipeline import ConnectorPipeline
259
+ from sayou.visualizer.pipeline import VisualizerPipeline
260
+
261
+ def main():
262
+ connector = ConnectorPipeline()
263
+
264
+ viz = VisualizerPipeline()
265
+ viz.attach_to(connector)
266
+
267
+ print("🚀 Running Pipeline...")
268
+ iterator = connector.run("http://example.com")
269
+ for packet in iterator:
270
+ print(f"Processed: {packet.task.uri}")
271
+
272
+ print("🎨 Generating Report...")
273
+ viz.report("examples/pipeline_flow.html")
274
+
275
+ if __name__ == "__main__":
276
+ main()
277
+ ```
278
+
279
+ ## 🔑 Key Concepts
280
+
281
+ ### Tracers
282
+ * **`GraphTracer`**: Listens to pipeline events and constructs a `NetworkX` Directed Acyclic Graph (DAG) in real-time. It distinguishes between Components (Generator/Fetcher) and Data (Tasks).
283
+
284
+ ### Renderers
285
+ * **`PyVisRenderer`**: Converts the internal graph into an interactive HTML file powered by `Vis.js`. Features physics-based layout and modern dark UI.
286
+ * **`RichRenderer`** (_Planned_): Displays a tree-structure summary directly in the console using the `Rich` library.
287
+
288
+ ## 🤝 Contributing
289
+
290
+ We welcome contributions for new Renderers (e.g., `MatplotlibRenderer`, `StreamlitRenderer`) or specialized Tracers for new components!
291
+
292
+ ## 📜 License
293
+
294
+ Apache 2.0 License © 2025 Sayouzone
@@ -0,0 +1,11 @@
1
+ sayou/visualizer/pipeline.py,sha256=vEpI3MniDU3wokFEDScoVXl7xPiAAU1eHO-Mv5FlSNY,2517
2
+ sayou/visualizer/core/exceptions.py,sha256=Mk5UtIfim7i9688c4qAKP7kB1GpLPM29t94HbQM9fhw,99
3
+ sayou/visualizer/core/schemas.py,sha256=qn44BINevFZF_ALBhh20DS4GyMo5HV3UzqY4UTh_p3A,381
4
+ sayou/visualizer/interfaces/base_renderer.py,sha256=orllTXlqM4-wDemOWbcZX8zF708KOdWFgoqZh8MeAzE,760
5
+ sayou/visualizer/renderer/pyvis_renderer.py,sha256=5lDM27i5KXJXh8X6H4NDCGZYUJJPggQ8wjN2ut02mzQ,2409
6
+ sayou/visualizer/tracer/graph_tracer.py,sha256=QYztzA8sbW5hPOEnLU_rqNo3nZWt_RijahMg8IKmF0U,3199
7
+ sayou/visualizer/tracer/rich_tracer.py,sha256=ik7J1P7AMTN47lkjMLE7iTlRuksUpwSKluvWdpY6kdQ,2406
8
+ sayou/visualizer/tracer/websocket_tracer.py,sha256=OZLg4jTfuxp6IwDacmAACKZ_0FirZFhyLysqh9QyrJA,1626
9
+ sayou_visualizer-0.0.3.dist-info/METADATA,sha256=6VGBaS8G9K4Bf5uihM1ySOwRlqlEPHd75-Ip3Kx5EIA,16679
10
+ sayou_visualizer-0.0.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
11
+ sayou_visualizer-0.0.3.dist-info/RECORD,,
@@ -0,0 +1,4 @@
1
+ Wheel-Version: 1.0
2
+ Generator: hatchling 1.28.0
3
+ Root-Is-Purelib: true
4
+ Tag: py3-none-any