q-alchemy-visualization 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.
- q_alchemy/visualization/__init__.py +19 -0
- q_alchemy/visualization/mpl.py +186 -0
- q_alchemy/visualization/py.typed +1 -0
- q_alchemy/visualization/schema.py +192 -0
- q_alchemy/visualization/text.py +271 -0
- q_alchemy_visualization-0.1.0.dist-info/METADATA +176 -0
- q_alchemy_visualization-0.1.0.dist-info/RECORD +10 -0
- q_alchemy_visualization-0.1.0.dist-info/WHEEL +5 -0
- q_alchemy_visualization-0.1.0.dist-info/licenses/LICENSE +202 -0
- q_alchemy_visualization-0.1.0.dist-info/top_level.txt +1 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
from .schema import (
|
|
2
|
+
DIAGRAM_SCHEMA_VERSION,
|
|
3
|
+
ExperimentConnection,
|
|
4
|
+
ExperimentDiagram,
|
|
5
|
+
ExperimentStep,
|
|
6
|
+
ExperimentStepStatus,
|
|
7
|
+
)
|
|
8
|
+
from .text import TextExperimentDrawer
|
|
9
|
+
from .mpl import MatplotlibExperimentDrawer
|
|
10
|
+
|
|
11
|
+
__all__ = [
|
|
12
|
+
"DIAGRAM_SCHEMA_VERSION",
|
|
13
|
+
"ExperimentConnection",
|
|
14
|
+
"ExperimentDiagram",
|
|
15
|
+
"ExperimentStep",
|
|
16
|
+
"ExperimentStepStatus",
|
|
17
|
+
"MatplotlibExperimentDrawer",
|
|
18
|
+
"TextExperimentDrawer",
|
|
19
|
+
]
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import textwrap
|
|
4
|
+
from typing import Any
|
|
5
|
+
|
|
6
|
+
from .schema import ExperimentDiagram, ExperimentStep
|
|
7
|
+
from .text import TextExperimentDrawer
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
class MatplotlibExperimentDrawer:
|
|
11
|
+
"""Simple Matplotlib renderer for an :class:`ExperimentDiagram`.
|
|
12
|
+
|
|
13
|
+
The graphical drawer intentionally shares the text drawer's graph-layer semantics:
|
|
14
|
+
linear diagrams remain linear, while explicit connections can form the one- and
|
|
15
|
+
two-column split/merge DAGs used by feasibility and state-estimation workflows.
|
|
16
|
+
Matplotlib is imported lazily so text-only users do not need the visualization extra.
|
|
17
|
+
"""
|
|
18
|
+
|
|
19
|
+
def __init__(self, diagram: ExperimentDiagram, *, show_title: bool = False) -> None:
|
|
20
|
+
self.diagram = diagram
|
|
21
|
+
self.show_title = show_title
|
|
22
|
+
|
|
23
|
+
@staticmethod
|
|
24
|
+
def _matplotlib():
|
|
25
|
+
try:
|
|
26
|
+
import matplotlib.pyplot as plt
|
|
27
|
+
from matplotlib.patches import FancyArrowPatch, FancyBboxPatch
|
|
28
|
+
except ImportError as exc: # pragma: no cover - exercised only without optional dep
|
|
29
|
+
raise ImportError(
|
|
30
|
+
"Matplotlib output requires the optional visualization dependency. "
|
|
31
|
+
"Install it with: pip install 'q-alchemy-visualization[mpl]'"
|
|
32
|
+
) from exc
|
|
33
|
+
return plt, FancyArrowPatch, FancyBboxPatch
|
|
34
|
+
|
|
35
|
+
def _layers(self) -> tuple[list[list[tuple[str, ExperimentStep]]], dict[str, set[str]]]:
|
|
36
|
+
if self.diagram.connections:
|
|
37
|
+
return TextExperimentDrawer(self.diagram)._graph_layers()
|
|
38
|
+
layers = [
|
|
39
|
+
[(step.key or f"step-{index}", step)]
|
|
40
|
+
for index, step in enumerate(self.diagram.steps)
|
|
41
|
+
]
|
|
42
|
+
outgoing: dict[str, set[str]] = {}
|
|
43
|
+
for index, layer in enumerate(layers):
|
|
44
|
+
key = layer[0][0]
|
|
45
|
+
outgoing.setdefault(key, set())
|
|
46
|
+
if index + 1 < len(layers):
|
|
47
|
+
outgoing[key].add(layers[index + 1][0][0])
|
|
48
|
+
return layers, outgoing
|
|
49
|
+
|
|
50
|
+
@staticmethod
|
|
51
|
+
def _node_lines(step: ExperimentStep, *, width: int) -> list[str]:
|
|
52
|
+
status = f" [{step.status.value}]" if step.status is not None else ""
|
|
53
|
+
lines = [step.title + status]
|
|
54
|
+
for detail in step.details:
|
|
55
|
+
lines.extend(
|
|
56
|
+
textwrap.wrap(
|
|
57
|
+
str(detail),
|
|
58
|
+
width=width,
|
|
59
|
+
break_long_words=False,
|
|
60
|
+
break_on_hyphens=False,
|
|
61
|
+
) or [""]
|
|
62
|
+
)
|
|
63
|
+
return lines
|
|
64
|
+
|
|
65
|
+
def draw(self) -> Any:
|
|
66
|
+
plt, FancyArrowPatch, FancyBboxPatch = self._matplotlib()
|
|
67
|
+
layers, outgoing = self._layers()
|
|
68
|
+
|
|
69
|
+
has_branch = any(len(layer) == 2 for layer in layers)
|
|
70
|
+
single_width = 7.8
|
|
71
|
+
branch_width = 5.2
|
|
72
|
+
branch_x = 3.15
|
|
73
|
+
vertical_gap = 1.0
|
|
74
|
+
|
|
75
|
+
nodes: dict[str, dict[str, Any]] = {}
|
|
76
|
+
layer_heights: list[float] = []
|
|
77
|
+
for layer in layers:
|
|
78
|
+
layer_height = 0.0
|
|
79
|
+
for key, step in layer:
|
|
80
|
+
wrap_width = 46 if len(layer) == 2 else 70
|
|
81
|
+
lines = self._node_lines(step, width=wrap_width)
|
|
82
|
+
height = max(1.15, 0.46 + 0.29 * len(lines))
|
|
83
|
+
width = branch_width if len(layer) == 2 else single_width
|
|
84
|
+
nodes[key] = {"step": step, "lines": lines, "width": width, "height": height}
|
|
85
|
+
layer_height = max(layer_height, height)
|
|
86
|
+
layer_heights.append(layer_height)
|
|
87
|
+
|
|
88
|
+
layer_centers: list[float] = []
|
|
89
|
+
top = 0.0
|
|
90
|
+
for height in layer_heights:
|
|
91
|
+
center = top - height / 2
|
|
92
|
+
layer_centers.append(center)
|
|
93
|
+
top = center - height / 2 - vertical_gap
|
|
94
|
+
|
|
95
|
+
for layer_index, layer in enumerate(layers):
|
|
96
|
+
if len(layer) == 1:
|
|
97
|
+
xs = [0.0]
|
|
98
|
+
else:
|
|
99
|
+
xs = [-branch_x, branch_x]
|
|
100
|
+
for (key, _), x in zip(layer, xs):
|
|
101
|
+
nodes[key]["x"] = x
|
|
102
|
+
nodes[key]["y"] = layer_centers[layer_index]
|
|
103
|
+
nodes[key]["layer"] = layer_index
|
|
104
|
+
|
|
105
|
+
fig_width = 13.0 if has_branch else 9.5
|
|
106
|
+
fig_height = max(5.0, abs(top) * 0.78 + 1.4)
|
|
107
|
+
fig, ax = plt.subplots(figsize=(fig_width, fig_height))
|
|
108
|
+
|
|
109
|
+
# Draw orthogonal connectors behind the nodes. All currently supported DAG
|
|
110
|
+
# edges connect adjacent layers, matching the text renderer's invariant.
|
|
111
|
+
for layer_index in range(len(layers) - 1):
|
|
112
|
+
source_keys = [key for key, _ in layers[layer_index]]
|
|
113
|
+
target_keys = [key for key, _ in layers[layer_index + 1]]
|
|
114
|
+
edges = [
|
|
115
|
+
(source, target)
|
|
116
|
+
for source in source_keys
|
|
117
|
+
for target in outgoing.get(source, set())
|
|
118
|
+
if target in target_keys
|
|
119
|
+
]
|
|
120
|
+
if not edges:
|
|
121
|
+
continue
|
|
122
|
+
source_bottoms = {
|
|
123
|
+
key: nodes[key]["y"] - nodes[key]["height"] / 2 for key in source_keys
|
|
124
|
+
}
|
|
125
|
+
target_tops = {
|
|
126
|
+
key: nodes[key]["y"] + nodes[key]["height"] / 2 for key in target_keys
|
|
127
|
+
}
|
|
128
|
+
mid_y = (min(source_bottoms.values()) + max(target_tops.values())) / 2
|
|
129
|
+
|
|
130
|
+
for source in {source for source, _ in edges}:
|
|
131
|
+
x = nodes[source]["x"]
|
|
132
|
+
ax.plot([x, x], [source_bottoms[source], mid_y], linewidth=1.2, color="black")
|
|
133
|
+
|
|
134
|
+
for source, target in edges:
|
|
135
|
+
sx = nodes[source]["x"]
|
|
136
|
+
tx = nodes[target]["x"]
|
|
137
|
+
if sx != tx:
|
|
138
|
+
ax.plot([sx, tx], [mid_y, mid_y], linewidth=1.2, color="black")
|
|
139
|
+
|
|
140
|
+
for target in {target for _, target in edges}:
|
|
141
|
+
tx = nodes[target]["x"]
|
|
142
|
+
arrow = FancyArrowPatch(
|
|
143
|
+
(tx, mid_y),
|
|
144
|
+
(tx, target_tops[target]),
|
|
145
|
+
arrowstyle="-|>",
|
|
146
|
+
mutation_scale=12,
|
|
147
|
+
linewidth=1.2,
|
|
148
|
+
color="black",
|
|
149
|
+
shrinkA=0,
|
|
150
|
+
shrinkB=2,
|
|
151
|
+
)
|
|
152
|
+
ax.add_patch(arrow)
|
|
153
|
+
|
|
154
|
+
for key, node in nodes.items():
|
|
155
|
+
x = node["x"]
|
|
156
|
+
y = node["y"]
|
|
157
|
+
width = node["width"]
|
|
158
|
+
height = node["height"]
|
|
159
|
+
box = FancyBboxPatch(
|
|
160
|
+
(x - width / 2, y - height / 2),
|
|
161
|
+
width,
|
|
162
|
+
height,
|
|
163
|
+
boxstyle="round,pad=0.04,rounding_size=0.08",
|
|
164
|
+
fill=False,
|
|
165
|
+
edgecolor="black",
|
|
166
|
+
linewidth=1.2,
|
|
167
|
+
)
|
|
168
|
+
ax.add_patch(box)
|
|
169
|
+
ax.text(
|
|
170
|
+
x,
|
|
171
|
+
y,
|
|
172
|
+
"\n".join(node["lines"]),
|
|
173
|
+
ha="center",
|
|
174
|
+
va="center",
|
|
175
|
+
fontsize=9.5,
|
|
176
|
+
linespacing=1.25,
|
|
177
|
+
)
|
|
178
|
+
|
|
179
|
+
if self.show_title:
|
|
180
|
+
ax.set_title(self.diagram.title, fontsize=13, pad=14)
|
|
181
|
+
x_limit = branch_x + branch_width / 2 + 0.6 if has_branch else single_width / 2 + 0.6
|
|
182
|
+
ax.set_xlim(-x_limit, x_limit)
|
|
183
|
+
ax.set_ylim(top + 0.15, 0.55)
|
|
184
|
+
ax.axis("off")
|
|
185
|
+
fig.tight_layout()
|
|
186
|
+
return fig
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1,192 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from dataclasses import dataclass
|
|
4
|
+
from enum import Enum
|
|
5
|
+
import json
|
|
6
|
+
from typing import Any, Mapping
|
|
7
|
+
|
|
8
|
+
DIAGRAM_SCHEMA_VERSION = 1
|
|
9
|
+
|
|
10
|
+
class ExperimentStepStatus(str, Enum):
|
|
11
|
+
"""Execution state displayed by experiment diagram renderers."""
|
|
12
|
+
|
|
13
|
+
RUN = "RUN"
|
|
14
|
+
SKIPPED = "SKIPPED"
|
|
15
|
+
NOT_NEEDED = "NOT NEEDED"
|
|
16
|
+
UNAVAILABLE = "UNAVAILABLE"
|
|
17
|
+
FAILED = "FAILED"
|
|
18
|
+
PENDING = "PENDING"
|
|
19
|
+
NOT_RUN = "NOT RUN"
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
@dataclass(frozen=True)
|
|
23
|
+
class ExperimentStep:
|
|
24
|
+
title: str
|
|
25
|
+
details: tuple[str, ...] = ()
|
|
26
|
+
status: ExperimentStepStatus | None = None
|
|
27
|
+
key: str | None = None
|
|
28
|
+
|
|
29
|
+
def to_dict(self, *, fallback_key: str | None = None) -> dict[str, Any]:
|
|
30
|
+
key = self.key if self.key is not None else fallback_key
|
|
31
|
+
if key is None:
|
|
32
|
+
raise ValueError("an experiment step needs a key for wire serialization")
|
|
33
|
+
return {
|
|
34
|
+
"id": key,
|
|
35
|
+
"title": self.title,
|
|
36
|
+
"details": list(self.details),
|
|
37
|
+
"status": (
|
|
38
|
+
self.status.name.lower().replace("_", "-")
|
|
39
|
+
if self.status is not None
|
|
40
|
+
else None
|
|
41
|
+
),
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
@classmethod
|
|
45
|
+
def from_dict(cls, data: Mapping[str, Any]) -> "ExperimentStep":
|
|
46
|
+
status = data.get("status")
|
|
47
|
+
parsed_status = None
|
|
48
|
+
if status is not None:
|
|
49
|
+
raw_status = str(status)
|
|
50
|
+
member_name = raw_status.upper().replace("-", "_").replace(" ", "_")
|
|
51
|
+
try:
|
|
52
|
+
parsed_status = ExperimentStepStatus[member_name]
|
|
53
|
+
except KeyError:
|
|
54
|
+
# Accept the pre-wire display values for compatibility with callers
|
|
55
|
+
# that may have persisted an early local ExperimentDiagram payload.
|
|
56
|
+
parsed_status = ExperimentStepStatus(raw_status)
|
|
57
|
+
return cls(
|
|
58
|
+
title=str(data["title"]),
|
|
59
|
+
details=tuple(str(item) for item in data.get("details", ())),
|
|
60
|
+
status=parsed_status,
|
|
61
|
+
key=str(data["id"]),
|
|
62
|
+
)
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
@dataclass(frozen=True)
|
|
66
|
+
class ExperimentConnection:
|
|
67
|
+
"""Directed data/control-flow connection between two named experiment steps."""
|
|
68
|
+
|
|
69
|
+
source: str
|
|
70
|
+
target: str
|
|
71
|
+
label: str | None = None
|
|
72
|
+
|
|
73
|
+
def to_dict(self) -> dict[str, Any]:
|
|
74
|
+
return {
|
|
75
|
+
"source": self.source,
|
|
76
|
+
"target": self.target,
|
|
77
|
+
"label": self.label,
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
@classmethod
|
|
81
|
+
def from_dict(cls, data: Mapping[str, Any]) -> "ExperimentConnection":
|
|
82
|
+
label = data.get("label")
|
|
83
|
+
return cls(
|
|
84
|
+
source=str(data["source"]),
|
|
85
|
+
target=str(data["target"]),
|
|
86
|
+
label=str(label) if label is not None else None,
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
|
|
90
|
+
@dataclass(frozen=True)
|
|
91
|
+
class ExperimentDiagram:
|
|
92
|
+
"""Renderer-neutral experiment flow shared by text and graphical renderers.
|
|
93
|
+
|
|
94
|
+
With no ``connections`` the steps are rendered as the original vertical sequence.
|
|
95
|
+
Supplying connections turns the diagram into an explicit directed acyclic graph. The
|
|
96
|
+
first text renderer supports one- and two-column layers, which is enough to show the
|
|
97
|
+
principal feasibility and state-estimation branches without baking workflow semantics
|
|
98
|
+
into the renderer.
|
|
99
|
+
"""
|
|
100
|
+
|
|
101
|
+
title: str
|
|
102
|
+
steps: tuple[ExperimentStep, ...]
|
|
103
|
+
connections: tuple[ExperimentConnection, ...] = ()
|
|
104
|
+
|
|
105
|
+
def __post_init__(self) -> None:
|
|
106
|
+
explicit_keys = [step.key for step in self.steps if step.key is not None]
|
|
107
|
+
if len(explicit_keys) != len(set(explicit_keys)):
|
|
108
|
+
raise ValueError("experiment step keys must be unique")
|
|
109
|
+
known = set(explicit_keys)
|
|
110
|
+
outgoing = {key: set() for key in known}
|
|
111
|
+
incoming_count = {key: 0 for key in known}
|
|
112
|
+
for connection in self.connections:
|
|
113
|
+
if connection.source not in known:
|
|
114
|
+
raise ValueError(f"unknown connection source: {connection.source!r}")
|
|
115
|
+
if connection.target not in known:
|
|
116
|
+
raise ValueError(f"unknown connection target: {connection.target!r}")
|
|
117
|
+
if connection.target not in outgoing[connection.source]:
|
|
118
|
+
outgoing[connection.source].add(connection.target)
|
|
119
|
+
incoming_count[connection.target] += 1
|
|
120
|
+
|
|
121
|
+
if self.connections:
|
|
122
|
+
ready = [key for key, count in incoming_count.items() if count == 0]
|
|
123
|
+
visited = 0
|
|
124
|
+
while ready:
|
|
125
|
+
key = ready.pop()
|
|
126
|
+
visited += 1
|
|
127
|
+
for target in outgoing[key]:
|
|
128
|
+
incoming_count[target] -= 1
|
|
129
|
+
if incoming_count[target] == 0:
|
|
130
|
+
ready.append(target)
|
|
131
|
+
if visited != len(known):
|
|
132
|
+
raise ValueError("experiment diagram connections must form a directed acyclic graph")
|
|
133
|
+
|
|
134
|
+
def to_dict(self) -> dict[str, Any]:
|
|
135
|
+
used_ids = {step.key for step in self.steps if step.key is not None}
|
|
136
|
+
node_payloads: list[dict[str, Any]] = []
|
|
137
|
+
for index, step in enumerate(self.steps):
|
|
138
|
+
fallback = None
|
|
139
|
+
if step.key is None:
|
|
140
|
+
fallback = f"step-{index}"
|
|
141
|
+
suffix = 1
|
|
142
|
+
while fallback in used_ids:
|
|
143
|
+
fallback = f"step-{index}-{suffix}"
|
|
144
|
+
suffix += 1
|
|
145
|
+
used_ids.add(fallback)
|
|
146
|
+
node_payloads.append(step.to_dict(fallback_key=fallback))
|
|
147
|
+
return {
|
|
148
|
+
"schema_version": DIAGRAM_SCHEMA_VERSION,
|
|
149
|
+
"kind": "experiment-diagram",
|
|
150
|
+
"title": self.title,
|
|
151
|
+
"nodes": node_payloads,
|
|
152
|
+
"edges": [connection.to_dict() for connection in self.connections],
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
@classmethod
|
|
156
|
+
def from_dict(cls, data: Mapping[str, Any]) -> "ExperimentDiagram":
|
|
157
|
+
schema_version = int(data.get("schema_version", 0))
|
|
158
|
+
if schema_version != DIAGRAM_SCHEMA_VERSION:
|
|
159
|
+
raise ValueError(
|
|
160
|
+
f"unsupported experiment diagram schema_version: {schema_version}"
|
|
161
|
+
)
|
|
162
|
+
kind = str(data.get("kind", ""))
|
|
163
|
+
if kind != "experiment-diagram":
|
|
164
|
+
raise ValueError(f"unsupported diagram kind: {kind!r}")
|
|
165
|
+
return cls(
|
|
166
|
+
title=str(data.get("title", "")),
|
|
167
|
+
steps=tuple(ExperimentStep.from_dict(item) for item in data.get("nodes", ())),
|
|
168
|
+
connections=tuple(
|
|
169
|
+
ExperimentConnection.from_dict(item) for item in data.get("edges", ())
|
|
170
|
+
),
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
def to_json(self, *, indent: int | None = None) -> str:
|
|
174
|
+
return json.dumps(self.to_dict(), indent=indent, sort_keys=True)
|
|
175
|
+
|
|
176
|
+
@classmethod
|
|
177
|
+
def from_json(cls, payload: str) -> "ExperimentDiagram":
|
|
178
|
+
data = json.loads(payload)
|
|
179
|
+
if not isinstance(data, Mapping):
|
|
180
|
+
raise TypeError("experiment diagram JSON must decode to an object")
|
|
181
|
+
return cls.from_dict(data)
|
|
182
|
+
|
|
183
|
+
def draw(self, *, output: str = "text", show_title: bool = False) -> Any:
|
|
184
|
+
if output == "text":
|
|
185
|
+
from .text import TextExperimentDrawer
|
|
186
|
+
|
|
187
|
+
return TextExperimentDrawer(self, show_title=show_title).draw()
|
|
188
|
+
if output == "mpl":
|
|
189
|
+
from .mpl import MatplotlibExperimentDrawer
|
|
190
|
+
|
|
191
|
+
return MatplotlibExperimentDrawer(self, show_title=show_title).draw()
|
|
192
|
+
raise ValueError("supported outputs are 'text' and 'mpl'")
|
|
@@ -0,0 +1,271 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import textwrap
|
|
4
|
+
|
|
5
|
+
from .schema import ExperimentConnection, ExperimentDiagram, ExperimentStep
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
class TextExperimentDrawer:
|
|
9
|
+
"""Unicode box-and-arrow renderer inspired by Qiskit's terminal drawings."""
|
|
10
|
+
|
|
11
|
+
def __init__(
|
|
12
|
+
self,
|
|
13
|
+
diagram: ExperimentDiagram,
|
|
14
|
+
*,
|
|
15
|
+
width: int = 76,
|
|
16
|
+
show_title: bool = False,
|
|
17
|
+
) -> None:
|
|
18
|
+
self.diagram = diagram
|
|
19
|
+
self.width = max(48, int(width))
|
|
20
|
+
self.show_title = show_title
|
|
21
|
+
|
|
22
|
+
@staticmethod
|
|
23
|
+
def _put(chars: list[str], position: int, value: str) -> None:
|
|
24
|
+
if 0 <= position < len(chars):
|
|
25
|
+
chars[position] = value
|
|
26
|
+
|
|
27
|
+
def _box(self, step: ExperimentStep, *, width: int | None = None) -> list[str]:
|
|
28
|
+
width = self.width if width is None else max(32, int(width))
|
|
29
|
+
inner = width - 2
|
|
30
|
+
status = f" [{step.status.value}]" if step.status is not None else ""
|
|
31
|
+
title_width = max(8, inner - len(status) - 1)
|
|
32
|
+
title = step.title[:title_width]
|
|
33
|
+
header = title + status.rjust(inner - len(title))
|
|
34
|
+
|
|
35
|
+
lines = ["┌" + "─" * inner + "┐", "│" + header.ljust(inner) + "│"]
|
|
36
|
+
for detail in step.details:
|
|
37
|
+
wrapped = textwrap.wrap(
|
|
38
|
+
str(detail),
|
|
39
|
+
width=max(8, inner - 2),
|
|
40
|
+
break_long_words=False,
|
|
41
|
+
break_on_hyphens=False,
|
|
42
|
+
) or [""]
|
|
43
|
+
for item in wrapped:
|
|
44
|
+
lines.append("│ " + item.ljust(inner - 1) + "│")
|
|
45
|
+
lines.append("└" + "─" * inner + "┘")
|
|
46
|
+
return lines
|
|
47
|
+
|
|
48
|
+
def _draw_linear(self) -> str:
|
|
49
|
+
lines: list[str] = []
|
|
50
|
+
if self.show_title:
|
|
51
|
+
lines.extend([self.diagram.title, "=" * len(self.diagram.title), ""])
|
|
52
|
+
center = self.width // 2
|
|
53
|
+
for index, step in enumerate(self.diagram.steps):
|
|
54
|
+
lines.extend(self._box(step))
|
|
55
|
+
if index != len(self.diagram.steps) - 1:
|
|
56
|
+
lines.append(" " * center + "│")
|
|
57
|
+
lines.append(" " * center + "▼")
|
|
58
|
+
return "\n".join(lines)
|
|
59
|
+
|
|
60
|
+
def _graph_layers(self) -> tuple[list[list[tuple[str, ExperimentStep]]], dict[str, set[str]]]:
|
|
61
|
+
keyed: list[tuple[str, ExperimentStep]] = []
|
|
62
|
+
steps_by_key: dict[str, ExperimentStep] = {}
|
|
63
|
+
for index, step in enumerate(self.diagram.steps):
|
|
64
|
+
key = step.key or f"step-{index}"
|
|
65
|
+
if key in steps_by_key:
|
|
66
|
+
raise ValueError(f"duplicate experiment step key: {key!r}")
|
|
67
|
+
steps_by_key[key] = step
|
|
68
|
+
keyed.append((key, step))
|
|
69
|
+
|
|
70
|
+
outgoing = {key: set() for key in steps_by_key}
|
|
71
|
+
incoming = {key: set() for key in steps_by_key}
|
|
72
|
+
for connection in self.diagram.connections:
|
|
73
|
+
if connection.source not in steps_by_key:
|
|
74
|
+
raise ValueError(f"unknown connection source: {connection.source!r}")
|
|
75
|
+
if connection.target not in steps_by_key:
|
|
76
|
+
raise ValueError(f"unknown connection target: {connection.target!r}")
|
|
77
|
+
outgoing[connection.source].add(connection.target)
|
|
78
|
+
incoming[connection.target].add(connection.source)
|
|
79
|
+
|
|
80
|
+
order = {key: index for index, (key, _) in enumerate(keyed)}
|
|
81
|
+
ready = sorted((key for key in steps_by_key if not incoming[key]), key=order.get)
|
|
82
|
+
levels: dict[str, int] = {}
|
|
83
|
+
visited: list[str] = []
|
|
84
|
+
remaining_incoming = {key: set(values) for key, values in incoming.items()}
|
|
85
|
+
while ready:
|
|
86
|
+
key = ready.pop(0)
|
|
87
|
+
visited.append(key)
|
|
88
|
+
levels[key] = max((levels[parent] + 1 for parent in incoming[key]), default=0)
|
|
89
|
+
for target in sorted(outgoing[key], key=order.get):
|
|
90
|
+
remaining_incoming[target].discard(key)
|
|
91
|
+
if not remaining_incoming[target] and target not in visited and target not in ready:
|
|
92
|
+
ready.append(target)
|
|
93
|
+
ready.sort(key=order.get)
|
|
94
|
+
|
|
95
|
+
if len(visited) != len(steps_by_key):
|
|
96
|
+
raise ValueError("experiment diagram connections must form a directed acyclic graph")
|
|
97
|
+
|
|
98
|
+
layer_count = max(levels.values(), default=0) + 1
|
|
99
|
+
layers: list[list[tuple[str, ExperimentStep]]] = [[] for _ in range(layer_count)]
|
|
100
|
+
for key, step in keyed:
|
|
101
|
+
layers[levels[key]].append((key, step))
|
|
102
|
+
if any(len(layer) > 2 for layer in layers):
|
|
103
|
+
raise ValueError("the text experiment drawer currently supports at most two steps per graph layer")
|
|
104
|
+
|
|
105
|
+
# The compact split/merge drawer deliberately handles connections only between
|
|
106
|
+
# adjacent layers. Model a branch that must remain visible by carrying it through
|
|
107
|
+
# an explicit step (for example, HELD OUT FROM FIT).
|
|
108
|
+
for source, targets in outgoing.items():
|
|
109
|
+
for target in targets:
|
|
110
|
+
if levels[target] != levels[source] + 1:
|
|
111
|
+
raise ValueError(
|
|
112
|
+
"the text experiment drawer requires graph connections between adjacent layers"
|
|
113
|
+
)
|
|
114
|
+
return layers, outgoing
|
|
115
|
+
|
|
116
|
+
@staticmethod
|
|
117
|
+
def _row_layout(
|
|
118
|
+
layer: list[tuple[str, ExperimentStep]],
|
|
119
|
+
*,
|
|
120
|
+
canvas_width: int,
|
|
121
|
+
gap: int,
|
|
122
|
+
) -> tuple[int, list[int], int]:
|
|
123
|
+
if len(layer) == 1:
|
|
124
|
+
box_width = min(76, canvas_width)
|
|
125
|
+
lefts = [(canvas_width - box_width) // 2]
|
|
126
|
+
else:
|
|
127
|
+
box_width = (canvas_width - gap) // 2
|
|
128
|
+
lefts = [0, box_width + gap]
|
|
129
|
+
centers = [left + box_width // 2 for left in lefts]
|
|
130
|
+
return box_width, centers, gap
|
|
131
|
+
|
|
132
|
+
def _render_layer(
|
|
133
|
+
self,
|
|
134
|
+
layer: list[tuple[str, ExperimentStep]],
|
|
135
|
+
*,
|
|
136
|
+
canvas_width: int,
|
|
137
|
+
gap: int,
|
|
138
|
+
) -> tuple[list[str], dict[str, int]]:
|
|
139
|
+
box_width, centers, _ = self._row_layout(layer, canvas_width=canvas_width, gap=gap)
|
|
140
|
+
boxes = [self._box(step, width=box_width) for _, step in layer]
|
|
141
|
+
height = max(len(box) for box in boxes)
|
|
142
|
+
rendered: list[str] = []
|
|
143
|
+
if len(layer) == 1:
|
|
144
|
+
left = (canvas_width - box_width) // 2
|
|
145
|
+
for row in range(height):
|
|
146
|
+
rendered.append(" " * left + boxes[0][row] + " " * (canvas_width - left - box_width))
|
|
147
|
+
else:
|
|
148
|
+
for row in range(height):
|
|
149
|
+
left_line = boxes[0][row] if row < len(boxes[0]) else " " * box_width
|
|
150
|
+
right_line = boxes[1][row] if row < len(boxes[1]) else " " * box_width
|
|
151
|
+
rendered.append(left_line + " " * gap + right_line)
|
|
152
|
+
return rendered, {key: center for (key, _), center in zip(layer, centers)}
|
|
153
|
+
|
|
154
|
+
def _render_connector(
|
|
155
|
+
self,
|
|
156
|
+
source_layer: list[tuple[str, ExperimentStep]],
|
|
157
|
+
target_layer: list[tuple[str, ExperimentStep]],
|
|
158
|
+
source_centers: dict[str, int],
|
|
159
|
+
target_centers: dict[str, int],
|
|
160
|
+
outgoing: dict[str, set[str]],
|
|
161
|
+
*,
|
|
162
|
+
canvas_width: int,
|
|
163
|
+
) -> list[str]:
|
|
164
|
+
edges = {
|
|
165
|
+
(source, target)
|
|
166
|
+
for source, _ in source_layer
|
|
167
|
+
for target in outgoing[source]
|
|
168
|
+
if target in target_centers
|
|
169
|
+
}
|
|
170
|
+
sources = [key for key, _ in source_layer]
|
|
171
|
+
targets = [key for key, _ in target_layer]
|
|
172
|
+
|
|
173
|
+
def blank() -> list[str]:
|
|
174
|
+
return [" " for _ in range(canvas_width)]
|
|
175
|
+
|
|
176
|
+
if len(sources) == 1 and len(targets) == 1:
|
|
177
|
+
source = source_centers[sources[0]]
|
|
178
|
+
target = target_centers[targets[0]]
|
|
179
|
+
if (sources[0], targets[0]) not in edges:
|
|
180
|
+
return []
|
|
181
|
+
if source != target:
|
|
182
|
+
raise ValueError("unsupported offset single-edge layout in text experiment drawer")
|
|
183
|
+
line1, line2 = blank(), blank()
|
|
184
|
+
self._put(line1, source, "│")
|
|
185
|
+
self._put(line2, target, "▼")
|
|
186
|
+
return ["".join(line1).rstrip(), "".join(line2).rstrip()]
|
|
187
|
+
|
|
188
|
+
if len(sources) == 1 and len(targets) == 2:
|
|
189
|
+
source_key = sources[0]
|
|
190
|
+
if edges != {(source_key, targets[0]), (source_key, targets[1])}:
|
|
191
|
+
raise ValueError("unsupported partial split in text experiment drawer")
|
|
192
|
+
source = source_centers[source_key]
|
|
193
|
+
left, right = sorted(target_centers.values())
|
|
194
|
+
line1, line2, line3 = blank(), blank(), blank()
|
|
195
|
+
self._put(line1, source, "│")
|
|
196
|
+
for pos in range(left + 1, right):
|
|
197
|
+
self._put(line2, pos, "─")
|
|
198
|
+
self._put(line2, left, "┌")
|
|
199
|
+
self._put(line2, right, "┐")
|
|
200
|
+
self._put(line2, source, "┴")
|
|
201
|
+
self._put(line3, left, "▼")
|
|
202
|
+
self._put(line3, right, "▼")
|
|
203
|
+
return ["".join(line1).rstrip(), "".join(line2).rstrip(), "".join(line3).rstrip()]
|
|
204
|
+
|
|
205
|
+
if len(sources) == 2 and len(targets) == 2:
|
|
206
|
+
expected = {(sources[0], targets[0]), (sources[1], targets[1])}
|
|
207
|
+
if edges != expected:
|
|
208
|
+
raise ValueError("the two-column text drawer currently supports aligned branch continuation only")
|
|
209
|
+
line1, line2 = blank(), blank()
|
|
210
|
+
for source_key, target_key in expected:
|
|
211
|
+
source = source_centers[source_key]
|
|
212
|
+
target = target_centers[target_key]
|
|
213
|
+
if source != target:
|
|
214
|
+
raise ValueError("unaligned branch continuation is not supported")
|
|
215
|
+
self._put(line1, source, "│")
|
|
216
|
+
self._put(line2, target, "▼")
|
|
217
|
+
return ["".join(line1).rstrip(), "".join(line2).rstrip()]
|
|
218
|
+
|
|
219
|
+
if len(sources) == 2 and len(targets) == 1:
|
|
220
|
+
target_key = targets[0]
|
|
221
|
+
expected = {(sources[0], target_key), (sources[1], target_key)}
|
|
222
|
+
if edges != expected:
|
|
223
|
+
raise ValueError("unsupported partial merge in text experiment drawer")
|
|
224
|
+
left, right = sorted(source_centers.values())
|
|
225
|
+
target = target_centers[target_key]
|
|
226
|
+
line1, line2, line3 = blank(), blank(), blank()
|
|
227
|
+
self._put(line1, left, "│")
|
|
228
|
+
self._put(line1, right, "│")
|
|
229
|
+
for pos in range(left + 1, right):
|
|
230
|
+
self._put(line2, pos, "─")
|
|
231
|
+
self._put(line2, left, "└")
|
|
232
|
+
self._put(line2, right, "┘")
|
|
233
|
+
self._put(line2, target, "┬")
|
|
234
|
+
self._put(line3, target, "▼")
|
|
235
|
+
return ["".join(line1).rstrip(), "".join(line2).rstrip(), "".join(line3).rstrip()]
|
|
236
|
+
|
|
237
|
+
raise ValueError("unsupported experiment graph shape for the initial text drawer")
|
|
238
|
+
|
|
239
|
+
def _draw_graph(self) -> str:
|
|
240
|
+
layers, outgoing = self._graph_layers()
|
|
241
|
+
canvas_width = max(108, self.width)
|
|
242
|
+
gap = 4
|
|
243
|
+
lines: list[str] = []
|
|
244
|
+
if self.show_title:
|
|
245
|
+
lines.extend([self.diagram.title, "=" * len(self.diagram.title), ""])
|
|
246
|
+
previous_layer = None
|
|
247
|
+
previous_centers = None
|
|
248
|
+
for layer in layers:
|
|
249
|
+
rendered, centers = self._render_layer(
|
|
250
|
+
layer, canvas_width=canvas_width, gap=gap
|
|
251
|
+
)
|
|
252
|
+
if previous_layer is not None and previous_centers is not None:
|
|
253
|
+
lines.extend(
|
|
254
|
+
self._render_connector(
|
|
255
|
+
previous_layer,
|
|
256
|
+
layer,
|
|
257
|
+
previous_centers,
|
|
258
|
+
centers,
|
|
259
|
+
outgoing,
|
|
260
|
+
canvas_width=canvas_width,
|
|
261
|
+
)
|
|
262
|
+
)
|
|
263
|
+
lines.extend(line.rstrip() for line in rendered)
|
|
264
|
+
previous_layer = layer
|
|
265
|
+
previous_centers = centers
|
|
266
|
+
return "\n".join(lines)
|
|
267
|
+
|
|
268
|
+
def draw(self) -> str:
|
|
269
|
+
if self.diagram.connections:
|
|
270
|
+
return self._draw_graph()
|
|
271
|
+
return self._draw_linear()
|
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: q-alchemy-visualization
|
|
3
|
+
Version: 0.1.0
|
|
4
|
+
Summary: Renderer-neutral experiment diagrams and text and Matplotlib renderers for Q-Alchemy
|
|
5
|
+
Author: data cybernetics ssc GmbH
|
|
6
|
+
License-Expression: Apache-2.0
|
|
7
|
+
Project-URL: Homepage, https://github.com/data-cybernetics/q-alchemy-visualization
|
|
8
|
+
Project-URL: Documentation, https://github.com/data-cybernetics/q-alchemy-visualization#readme
|
|
9
|
+
Project-URL: Repository, https://github.com/data-cybernetics/q-alchemy-visualization.git
|
|
10
|
+
Project-URL: Issues, https://github.com/data-cybernetics/q-alchemy-visualization/issues
|
|
11
|
+
Keywords: quantum-computing,visualization,experiment-diagrams,matplotlib,q-alchemy
|
|
12
|
+
Classifier: Development Status :: 3 - Alpha
|
|
13
|
+
Classifier: Intended Audience :: Developers
|
|
14
|
+
Classifier: Intended Audience :: Science/Research
|
|
15
|
+
Classifier: Programming Language :: Python :: 3
|
|
16
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
20
|
+
Classifier: Topic :: Scientific/Engineering :: Visualization
|
|
21
|
+
Classifier: Typing :: Typed
|
|
22
|
+
Requires-Python: >=3.11
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
License-File: LICENSE
|
|
25
|
+
Provides-Extra: mpl
|
|
26
|
+
Requires-Dist: matplotlib>=3.8; extra == "mpl"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: build>=1.2; extra == "dev"
|
|
29
|
+
Requires-Dist: matplotlib>=3.8; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
31
|
+
Requires-Dist: twine>=5.0; extra == "dev"
|
|
32
|
+
Dynamic: license-file
|
|
33
|
+
|
|
34
|
+
# Q-Alchemy Visualization
|
|
35
|
+
|
|
36
|
+
`q-alchemy-visualization` provides a small, renderer-neutral model for experiment
|
|
37
|
+
flow diagrams, plus text and Matplotlib renderers. It is designed for reports
|
|
38
|
+
produced by Q-Alchemy libraries, but the diagram model can be used independently.
|
|
39
|
+
|
|
40
|
+
The package contains no service client, credentials, feasibility decisions, or
|
|
41
|
+
quantum execution logic. Text rendering has no runtime dependencies. Matplotlib
|
|
42
|
+
is optional and imported only when graphical output is requested.
|
|
43
|
+
|
|
44
|
+
> **Project status:** Alpha. The versioned wire format is stable within schema
|
|
45
|
+
> version 1, but renderer features may expand in later releases.
|
|
46
|
+
|
|
47
|
+
## Installation
|
|
48
|
+
|
|
49
|
+
Install the dependency-free text renderer from PyPI:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
python -m pip install q-alchemy-visualization
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
Install graphical rendering support with:
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
python -m pip install "q-alchemy-visualization[mpl]"
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
Python 3.11 and newer are supported.
|
|
62
|
+
|
|
63
|
+
## Quick start
|
|
64
|
+
|
|
65
|
+
```python
|
|
66
|
+
from q_alchemy.visualization import (
|
|
67
|
+
ExperimentConnection,
|
|
68
|
+
ExperimentDiagram,
|
|
69
|
+
ExperimentStep,
|
|
70
|
+
ExperimentStepStatus,
|
|
71
|
+
)
|
|
72
|
+
|
|
73
|
+
diagram = ExperimentDiagram(
|
|
74
|
+
title="EXPERIMENT EXECUTION",
|
|
75
|
+
steps=(
|
|
76
|
+
ExperimentStep("PREPARE", status=ExperimentStepStatus.RUN, key="prepare"),
|
|
77
|
+
ExperimentStep(
|
|
78
|
+
"CLASSICAL",
|
|
79
|
+
details=("Assessment: feasible",),
|
|
80
|
+
status=ExperimentStepStatus.RUN,
|
|
81
|
+
key="classical",
|
|
82
|
+
),
|
|
83
|
+
ExperimentStep(
|
|
84
|
+
"QUANTUM",
|
|
85
|
+
details=("Assessment: compared",),
|
|
86
|
+
status=ExperimentStepStatus.RUN,
|
|
87
|
+
key="quantum",
|
|
88
|
+
),
|
|
89
|
+
),
|
|
90
|
+
connections=(
|
|
91
|
+
ExperimentConnection("prepare", "classical"),
|
|
92
|
+
ExperimentConnection("classical", "quantum"),
|
|
93
|
+
),
|
|
94
|
+
)
|
|
95
|
+
|
|
96
|
+
print(diagram.draw(output="text", show_title=True))
|
|
97
|
+
|
|
98
|
+
# Requires the `mpl` extra. The caller owns the returned Figure.
|
|
99
|
+
figure = diagram.draw(output="mpl", show_title=True)
|
|
100
|
+
figure.savefig("experiment.png", bbox_inches="tight")
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
## Wire format
|
|
104
|
+
|
|
105
|
+
Diagrams serialize to a versioned JSON-compatible representation so producers
|
|
106
|
+
and renderers do not need to share workflow-specific code:
|
|
107
|
+
|
|
108
|
+
```python
|
|
109
|
+
payload = diagram.to_dict()
|
|
110
|
+
restored = ExperimentDiagram.from_dict(payload)
|
|
111
|
+
|
|
112
|
+
encoded = diagram.to_json(indent=2)
|
|
113
|
+
restored_from_json = ExperimentDiagram.from_json(encoded)
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Schema version 1 uses this structure:
|
|
117
|
+
|
|
118
|
+
```json
|
|
119
|
+
{
|
|
120
|
+
"schema_version": 1,
|
|
121
|
+
"kind": "experiment-diagram",
|
|
122
|
+
"title": "EXPERIMENT EXECUTION",
|
|
123
|
+
"nodes": [
|
|
124
|
+
{
|
|
125
|
+
"id": "classical",
|
|
126
|
+
"title": "CLASSICAL",
|
|
127
|
+
"details": ["Assessment: feasible"],
|
|
128
|
+
"status": "run"
|
|
129
|
+
}
|
|
130
|
+
],
|
|
131
|
+
"edges": []
|
|
132
|
+
}
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
The wire representation contains no renderer coordinates, Matplotlib objects,
|
|
136
|
+
ASCII layout, or Q-Alchemy feasibility rules. Explicit connections must form a
|
|
137
|
+
directed acyclic graph. The current compact text layout supports at most two
|
|
138
|
+
nodes per layer and connections between adjacent layers.
|
|
139
|
+
|
|
140
|
+
Titles are hidden by default. Pass `show_title=True` to either renderer to show
|
|
141
|
+
the diagram title.
|
|
142
|
+
|
|
143
|
+
## Public API
|
|
144
|
+
|
|
145
|
+
The top-level package exports:
|
|
146
|
+
|
|
147
|
+
- `ExperimentDiagram`
|
|
148
|
+
- `ExperimentStep`
|
|
149
|
+
- `ExperimentStepStatus`
|
|
150
|
+
- `ExperimentConnection`
|
|
151
|
+
- `TextExperimentDrawer`
|
|
152
|
+
- `MatplotlibExperimentDrawer`
|
|
153
|
+
- `DIAGRAM_SCHEMA_VERSION`
|
|
154
|
+
|
|
155
|
+
## Development
|
|
156
|
+
|
|
157
|
+
Clone the repository, create an environment, and run the tests:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
python -m venv .venv
|
|
161
|
+
.venv/bin/python -m pip install -e ".[dev]"
|
|
162
|
+
.venv/bin/python -m pytest
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
Build and validate the distributions before proposing a release:
|
|
166
|
+
|
|
167
|
+
```bash
|
|
168
|
+
.venv/bin/python -m build
|
|
169
|
+
.venv/bin/python -m twine check dist/*
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md) for contribution and release guidance.
|
|
173
|
+
|
|
174
|
+
## License
|
|
175
|
+
|
|
176
|
+
Licensed under the [Apache License 2.0](LICENSE).
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
q_alchemy/visualization/__init__.py,sha256=fVedZE226TUp9joMqOKkrI7UEY2NYSQfFKymmeYhoac,440
|
|
2
|
+
q_alchemy/visualization/mpl.py,sha256=nq6OF8YGMm8w5WRkr1XaXuSoLHJqyZEAPMmUY9upX4I,7114
|
|
3
|
+
q_alchemy/visualization/py.typed,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
q_alchemy/visualization/schema.py,sha256=xrSQfqdFeAY_LpXtQ_0LjFNUiJP_1E_0mChdiY05ElQ,7267
|
|
5
|
+
q_alchemy/visualization/text.py,sha256=wvY4wSalh_H4HCm_aLMHhmKWGXA9Lw8RMrK_grHRQY0,11715
|
|
6
|
+
q_alchemy_visualization-0.1.0.dist-info/licenses/LICENSE,sha256=z8d0m5b2O9McPEK1xHG_dWgUBT6EfBDz6wA0F7xSPTA,11358
|
|
7
|
+
q_alchemy_visualization-0.1.0.dist-info/METADATA,sha256=rflLAEolLOPiBQ4Pgod3HjCX6s1vwRwXcFLMAbPTKuA,5215
|
|
8
|
+
q_alchemy_visualization-0.1.0.dist-info/WHEEL,sha256=YVMoNqKzERt-wjUZwJ33xBGAwnFl-4cqbYkTtWa4itE,91
|
|
9
|
+
q_alchemy_visualization-0.1.0.dist-info/top_level.txt,sha256=rnl7K84rjxOhAk8IKBGPsku8LzMzYty_HYdeKo5o79A,10
|
|
10
|
+
q_alchemy_visualization-0.1.0.dist-info/RECORD,,
|
|
@@ -0,0 +1,202 @@
|
|
|
1
|
+
|
|
2
|
+
Apache License
|
|
3
|
+
Version 2.0, January 2004
|
|
4
|
+
http://www.apache.org/licenses/
|
|
5
|
+
|
|
6
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
7
|
+
|
|
8
|
+
1. Definitions.
|
|
9
|
+
|
|
10
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
11
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
12
|
+
|
|
13
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
14
|
+
the copyright owner that is granting the License.
|
|
15
|
+
|
|
16
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
17
|
+
other entities that control, are controlled by, or are under common
|
|
18
|
+
control with that entity. For the purposes of this definition,
|
|
19
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
20
|
+
direction or management of such entity, whether by contract or
|
|
21
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
22
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
23
|
+
|
|
24
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
25
|
+
exercising permissions granted by this License.
|
|
26
|
+
|
|
27
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
28
|
+
including but not limited to software source code, documentation
|
|
29
|
+
source, and configuration files.
|
|
30
|
+
|
|
31
|
+
"Object" form shall mean any form resulting from mechanical
|
|
32
|
+
transformation or translation of a Source form, including but
|
|
33
|
+
not limited to compiled object code, generated documentation,
|
|
34
|
+
and conversions to other media types.
|
|
35
|
+
|
|
36
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
37
|
+
Object form, made available under the License, as indicated by a
|
|
38
|
+
copyright notice that is included in or attached to the work
|
|
39
|
+
(an example is provided in the Appendix below).
|
|
40
|
+
|
|
41
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
42
|
+
form, that is based on (or derived from) the Work and for which the
|
|
43
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
44
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
45
|
+
of this License, Derivative Works shall not include works that remain
|
|
46
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
47
|
+
the Work and Derivative Works thereof.
|
|
48
|
+
|
|
49
|
+
"Contribution" shall mean any work of authorship, including
|
|
50
|
+
the original version of the Work and any modifications or additions
|
|
51
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
52
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
53
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
54
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
55
|
+
means any form of electronic, verbal, or written communication sent
|
|
56
|
+
to the Licensor or its representatives, including but not limited to
|
|
57
|
+
communication on electronic mailing lists, source code control systems,
|
|
58
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
59
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
60
|
+
excluding communication that is conspicuously marked or otherwise
|
|
61
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
62
|
+
|
|
63
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
64
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
65
|
+
subsequently incorporated within the Work.
|
|
66
|
+
|
|
67
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
68
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
69
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
70
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
71
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
72
|
+
Work and such Derivative Works in Source or Object form.
|
|
73
|
+
|
|
74
|
+
3. Grant of Patent 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
|
+
(except as stated in this section) patent license to make, have made,
|
|
78
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
79
|
+
where such license applies only to those patent claims licensable
|
|
80
|
+
by such Contributor that are necessarily infringed by their
|
|
81
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
82
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
83
|
+
institute patent litigation against any entity (including a
|
|
84
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
85
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
86
|
+
or contributory patent infringement, then any patent licenses
|
|
87
|
+
granted to You under this License for that Work shall terminate
|
|
88
|
+
as of the date such litigation is filed.
|
|
89
|
+
|
|
90
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
91
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
92
|
+
modifications, and in Source or Object form, provided that You
|
|
93
|
+
meet the following conditions:
|
|
94
|
+
|
|
95
|
+
(a) You must give any other recipients of the Work or
|
|
96
|
+
Derivative Works a copy of this License; and
|
|
97
|
+
|
|
98
|
+
(b) You must cause any modified files to carry prominent notices
|
|
99
|
+
stating that You changed the files; and
|
|
100
|
+
|
|
101
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
102
|
+
that You distribute, all copyright, patent, trademark, and
|
|
103
|
+
attribution notices from the Source form of the Work,
|
|
104
|
+
excluding those notices that do not pertain to any part of
|
|
105
|
+
the Derivative Works; and
|
|
106
|
+
|
|
107
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
108
|
+
distribution, then any Derivative Works that You distribute must
|
|
109
|
+
include a readable copy of the attribution notices contained
|
|
110
|
+
within such NOTICE file, excluding those notices that do not
|
|
111
|
+
pertain to any part of the Derivative Works, in at least one
|
|
112
|
+
of the following places: within a NOTICE text file distributed
|
|
113
|
+
as part of the Derivative Works; within the Source form or
|
|
114
|
+
documentation, if provided along with the Derivative Works; or,
|
|
115
|
+
within a display generated by the Derivative Works, if and
|
|
116
|
+
wherever such third-party notices normally appear. The contents
|
|
117
|
+
of the NOTICE file are for informational purposes only and
|
|
118
|
+
do not modify the License. You may add Your own attribution
|
|
119
|
+
notices within Derivative Works that You distribute, alongside
|
|
120
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
121
|
+
that such additional attribution notices cannot be construed
|
|
122
|
+
as modifying the License.
|
|
123
|
+
|
|
124
|
+
You may add Your own copyright statement to Your modifications and
|
|
125
|
+
may provide additional or different license terms and conditions
|
|
126
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
127
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
128
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
129
|
+
the conditions stated in this License.
|
|
130
|
+
|
|
131
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
132
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
133
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
134
|
+
this License, without any additional terms or conditions.
|
|
135
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
136
|
+
the terms of any separate license agreement you may have executed
|
|
137
|
+
with Licensor regarding such Contributions.
|
|
138
|
+
|
|
139
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
140
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
141
|
+
except as required for reasonable and customary use in describing the
|
|
142
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
143
|
+
|
|
144
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
145
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
146
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
147
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
148
|
+
implied, including, without limitation, any warranties or conditions
|
|
149
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
150
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
151
|
+
appropriateness of using or redistributing the Work and assume any
|
|
152
|
+
risks associated with Your exercise of permissions under this License.
|
|
153
|
+
|
|
154
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
155
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
156
|
+
unless required by applicable law (such as deliberate and grossly
|
|
157
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
158
|
+
liable to You for damages, including any direct, indirect, special,
|
|
159
|
+
incidental, or consequential damages of any character arising as a
|
|
160
|
+
result of this License or out of the use or inability to use the
|
|
161
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
162
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
163
|
+
other commercial damages or losses), even if such Contributor
|
|
164
|
+
has been advised of the possibility of such damages.
|
|
165
|
+
|
|
166
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
167
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
168
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
169
|
+
or other liability obligations and/or rights consistent with this
|
|
170
|
+
License. However, in accepting such obligations, You may act only
|
|
171
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
172
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
173
|
+
defend, and hold each Contributor harmless for any liability
|
|
174
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
175
|
+
of your accepting any such warranty or additional liability.
|
|
176
|
+
|
|
177
|
+
END OF TERMS AND CONDITIONS
|
|
178
|
+
|
|
179
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
180
|
+
|
|
181
|
+
To apply the Apache License to your work, attach the following
|
|
182
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
183
|
+
replaced with your own identifying information. (Don't include
|
|
184
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
185
|
+
comment syntax for the file format. We also recommend that a
|
|
186
|
+
file or class name and description of purpose be included on the
|
|
187
|
+
same "printed page" as the copyright notice for easier
|
|
188
|
+
identification within third-party archives.
|
|
189
|
+
|
|
190
|
+
Copyright [yyyy] [name of copyright owner]
|
|
191
|
+
|
|
192
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
193
|
+
you may not use this file except in compliance with the License.
|
|
194
|
+
You may obtain a copy of the License at
|
|
195
|
+
|
|
196
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
197
|
+
|
|
198
|
+
Unless required by applicable law or agreed to in writing, software
|
|
199
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
200
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
201
|
+
See the License for the specific language governing permissions and
|
|
202
|
+
limitations under the License.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
q_alchemy
|