scitex 2.7.3__py3-none-any.whl → 2.8.1__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.
- scitex/__version__.py +1 -1
- scitex/dev/plt/__init__.py +0 -0
- scitex/dev/plt/plot_mpl_axhline.py +0 -0
- scitex/dev/plt/plot_mpl_axhspan.py +0 -0
- scitex/dev/plt/plot_mpl_axvline.py +0 -0
- scitex/dev/plt/plot_mpl_axvspan.py +0 -0
- scitex/dev/plt/plot_mpl_bar.py +0 -0
- scitex/dev/plt/plot_mpl_barh.py +0 -0
- scitex/dev/plt/plot_mpl_boxplot.py +0 -0
- scitex/dev/plt/plot_mpl_contour.py +0 -0
- scitex/dev/plt/plot_mpl_contourf.py +0 -0
- scitex/dev/plt/plot_mpl_errorbar.py +0 -0
- scitex/dev/plt/plot_mpl_eventplot.py +0 -0
- scitex/dev/plt/plot_mpl_fill.py +0 -0
- scitex/dev/plt/plot_mpl_fill_between.py +0 -0
- scitex/dev/plt/plot_mpl_hexbin.py +0 -0
- scitex/dev/plt/plot_mpl_hist.py +0 -0
- scitex/dev/plt/plot_mpl_hist2d.py +0 -0
- scitex/dev/plt/plot_mpl_imshow.py +0 -0
- scitex/dev/plt/plot_mpl_pcolormesh.py +0 -0
- scitex/dev/plt/plot_mpl_pie.py +0 -0
- scitex/dev/plt/plot_mpl_plot.py +0 -0
- scitex/dev/plt/plot_mpl_quiver.py +0 -0
- scitex/dev/plt/plot_mpl_scatter.py +0 -0
- scitex/dev/plt/plot_mpl_stackplot.py +0 -0
- scitex/dev/plt/plot_mpl_stem.py +0 -0
- scitex/dev/plt/plot_mpl_step.py +0 -0
- scitex/dev/plt/plot_mpl_violinplot.py +0 -0
- scitex/dev/plt/plot_sns_barplot.py +0 -0
- scitex/dev/plt/plot_sns_boxplot.py +0 -0
- scitex/dev/plt/plot_sns_heatmap.py +0 -0
- scitex/dev/plt/plot_sns_histplot.py +0 -0
- scitex/dev/plt/plot_sns_kdeplot.py +0 -0
- scitex/dev/plt/plot_sns_lineplot.py +0 -0
- scitex/dev/plt/plot_sns_scatterplot.py +0 -0
- scitex/dev/plt/plot_sns_stripplot.py +0 -0
- scitex/dev/plt/plot_sns_swarmplot.py +0 -0
- scitex/dev/plt/plot_sns_violinplot.py +0 -0
- scitex/dev/plt/plot_stx_bar.py +0 -0
- scitex/dev/plt/plot_stx_barh.py +0 -0
- scitex/dev/plt/plot_stx_box.py +0 -0
- scitex/dev/plt/plot_stx_boxplot.py +0 -0
- scitex/dev/plt/plot_stx_conf_mat.py +0 -0
- scitex/dev/plt/plot_stx_contour.py +0 -0
- scitex/dev/plt/plot_stx_ecdf.py +0 -0
- scitex/dev/plt/plot_stx_errorbar.py +0 -0
- scitex/dev/plt/plot_stx_fill_between.py +0 -0
- scitex/dev/plt/plot_stx_fillv.py +0 -0
- scitex/dev/plt/plot_stx_heatmap.py +0 -0
- scitex/dev/plt/plot_stx_image.py +0 -0
- scitex/dev/plt/plot_stx_imshow.py +0 -0
- scitex/dev/plt/plot_stx_joyplot.py +0 -0
- scitex/dev/plt/plot_stx_kde.py +0 -0
- scitex/dev/plt/plot_stx_line.py +0 -0
- scitex/dev/plt/plot_stx_mean_ci.py +0 -0
- scitex/dev/plt/plot_stx_mean_std.py +0 -0
- scitex/dev/plt/plot_stx_median_iqr.py +0 -0
- scitex/dev/plt/plot_stx_raster.py +0 -0
- scitex/dev/plt/plot_stx_rectangle.py +0 -0
- scitex/dev/plt/plot_stx_scatter.py +0 -0
- scitex/dev/plt/plot_stx_shaded_line.py +0 -0
- scitex/dev/plt/plot_stx_violin.py +0 -0
- scitex/dev/plt/plot_stx_violinplot.py +0 -0
- scitex/diagram/README.md +197 -0
- scitex/diagram/__init__.py +48 -0
- scitex/diagram/_compile.py +312 -0
- scitex/diagram/_diagram.py +355 -0
- scitex/diagram/_presets.py +173 -0
- scitex/diagram/_schema.py +182 -0
- scitex/diagram/_split.py +278 -0
- scitex/fig/editor/__init__.py +5 -2
- scitex/fig/editor/_dearpygui_editor.py +1 -1
- scitex/fig/editor/_mpl_editor.py +1 -1
- scitex/fig/editor/_qt_editor.py +1 -1
- scitex/fig/editor/_tkinter_editor.py +1 -1
- scitex/fig/editor/edit/__init__.py +50 -0
- scitex/fig/editor/edit/backend_detector.py +109 -0
- scitex/fig/editor/edit/bundle_resolver.py +240 -0
- scitex/fig/editor/edit/editor_launcher.py +239 -0
- scitex/fig/editor/edit/manual_handler.py +53 -0
- scitex/fig/editor/edit/panel_loader.py +232 -0
- scitex/fig/editor/edit/path_resolver.py +67 -0
- scitex/fig/editor/flask_editor/_bbox.py +23 -0
- scitex/fig/editor/flask_editor/_core.py +908 -103
- scitex/fig/editor/flask_editor/_renderer.py +74 -0
- scitex/fig/editor/flask_editor/static/css/base/reset.css +41 -0
- scitex/fig/editor/flask_editor/static/css/base/typography.css +16 -0
- scitex/fig/editor/flask_editor/static/css/base/variables.css +85 -0
- scitex/fig/editor/flask_editor/static/css/components/buttons.css +217 -0
- scitex/fig/editor/flask_editor/static/css/components/context-menu.css +93 -0
- scitex/fig/editor/flask_editor/static/css/components/dropdown.css +57 -0
- scitex/fig/editor/flask_editor/static/css/components/forms.css +112 -0
- scitex/fig/editor/flask_editor/static/css/components/modal.css +59 -0
- scitex/fig/editor/flask_editor/static/css/components/sections.css +212 -0
- scitex/fig/editor/flask_editor/static/css/features/canvas.css +176 -0
- scitex/fig/editor/flask_editor/static/css/features/element-inspector.css +190 -0
- scitex/fig/editor/flask_editor/static/css/features/loading.css +59 -0
- scitex/fig/editor/flask_editor/static/css/features/overlay.css +45 -0
- scitex/fig/editor/flask_editor/static/css/features/panel-grid.css +95 -0
- scitex/fig/editor/flask_editor/static/css/features/selection.css +101 -0
- scitex/fig/editor/flask_editor/static/css/features/statistics.css +138 -0
- scitex/fig/editor/flask_editor/static/css/index.css +31 -0
- scitex/fig/editor/flask_editor/static/css/layout/container.css +7 -0
- scitex/fig/editor/flask_editor/static/css/layout/controls.css +56 -0
- scitex/fig/editor/flask_editor/static/css/layout/preview.css +78 -0
- scitex/fig/editor/flask_editor/static/js/alignment/axis.js +314 -0
- scitex/fig/editor/flask_editor/static/js/alignment/basic.js +107 -0
- scitex/fig/editor/flask_editor/static/js/alignment/distribute.js +54 -0
- scitex/fig/editor/flask_editor/static/js/canvas/canvas.js +172 -0
- scitex/fig/editor/flask_editor/static/js/canvas/dragging.js +258 -0
- scitex/fig/editor/flask_editor/static/js/canvas/resize.js +48 -0
- scitex/fig/editor/flask_editor/static/js/canvas/selection.js +71 -0
- scitex/fig/editor/flask_editor/static/js/core/api.js +288 -0
- scitex/fig/editor/flask_editor/static/js/core/state.js +143 -0
- scitex/fig/editor/flask_editor/static/js/core/utils.js +245 -0
- scitex/fig/editor/flask_editor/static/js/dev/element-inspector.js +992 -0
- scitex/fig/editor/flask_editor/static/js/editor/bbox.js +339 -0
- scitex/fig/editor/flask_editor/static/js/editor/element-drag.js +286 -0
- scitex/fig/editor/flask_editor/static/js/editor/overlay.js +371 -0
- scitex/fig/editor/flask_editor/static/js/editor/preview.js +293 -0
- scitex/fig/editor/flask_editor/static/js/main.js +426 -0
- scitex/fig/editor/flask_editor/static/js/shortcuts/context-menu.js +152 -0
- scitex/fig/editor/flask_editor/static/js/shortcuts/keyboard.js +265 -0
- scitex/fig/editor/flask_editor/static/js/ui/controls.js +184 -0
- scitex/fig/editor/flask_editor/static/js/ui/download.js +57 -0
- scitex/fig/editor/flask_editor/static/js/ui/help.js +100 -0
- scitex/fig/editor/flask_editor/static/js/ui/theme.js +34 -0
- scitex/fig/editor/flask_editor/templates/__init__.py +95 -5
- scitex/fig/editor/flask_editor/templates/_html.py +27 -9
- scitex/fig/editor/flask_editor/templates/_scripts.py +1928 -131
- scitex/fig/editor/flask_editor/templates/_styles.py +363 -51
- scitex/fig/io/_bundle.py +97 -12
- scitex/io/__init__.py +12 -0
- scitex/io/_bundle.py +69 -10
- scitex/io/_zip_bundle.py +439 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_AdjustmentMixin/__init__.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_AdjustmentMixin/_labels.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_AdjustmentMixin/_metadata.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_AdjustmentMixin/_visual.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin/__init__.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin/_base.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin/_scientific.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin/_statistical.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_MatplotlibPlotMixin/_stx_aliases.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_RawMatplotlibMixin.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin/__init__.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin/_base.py +0 -0
- scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin/_wrappers.py +0 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_stx_bar.py +0 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_stx_barh.py +0 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_stx_errorbar.py +0 -0
- scitex/plt/_subplots/_export_as_csv_formatters/_format_stx_scatter.py +0 -0
- scitex/plt/io/_layered_bundle.py +0 -0
- scitex/schema/_plot.py +0 -0
- {scitex-2.7.3.dist-info → scitex-2.8.1.dist-info}/METADATA +1 -1
- {scitex-2.7.3.dist-info → scitex-2.8.1.dist-info}/RECORD +78 -22
- scitex/fig/editor/_edit.py +0 -751
- {scitex-2.7.3.dist-info → scitex-2.8.1.dist-info}/WHEEL +0 -0
- {scitex-2.7.3.dist-info → scitex-2.8.1.dist-info}/entry_points.txt +0 -0
- {scitex-2.7.3.dist-info → scitex-2.8.1.dist-info}/licenses/LICENSE +0 -0
scitex/__version__.py
CHANGED
scitex/dev/plt/__init__.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_mpl_bar.py
CHANGED
|
File without changes
|
scitex/dev/plt/plot_mpl_barh.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_mpl_fill.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_mpl_hist.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_mpl_pie.py
CHANGED
|
File without changes
|
scitex/dev/plt/plot_mpl_plot.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_mpl_stem.py
CHANGED
|
File without changes
|
scitex/dev/plt/plot_mpl_step.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_stx_bar.py
CHANGED
|
File without changes
|
scitex/dev/plt/plot_stx_barh.py
CHANGED
|
File without changes
|
scitex/dev/plt/plot_stx_box.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_stx_ecdf.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_stx_fillv.py
CHANGED
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_stx_image.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/dev/plt/plot_stx_kde.py
CHANGED
|
File without changes
|
scitex/dev/plt/plot_stx_line.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
scitex/diagram/README.md
ADDED
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
# SciTeX Diagram
|
|
2
|
+
|
|
3
|
+
Paper-optimized diagram generation with semantic constraints.
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
SciTeX Diagram provides a **semantic layer** above Mermaid/Graphviz that understands paper constraints:
|
|
8
|
+
- Column width (single/double)
|
|
9
|
+
- Reading direction
|
|
10
|
+
- Node emphasis for scientific communication
|
|
11
|
+
- Automatic splitting of large diagrams
|
|
12
|
+
|
|
13
|
+
**Key insight**: LLMs are good at generating *constraints*, not pixel layouts. SciTeX Diagram defines "what this diagram means for a paper" and compiles that to backend-specific layout directives.
|
|
14
|
+
|
|
15
|
+
## Architecture
|
|
16
|
+
|
|
17
|
+
```
|
|
18
|
+
scitex-diagram.yaml ← Semantic layer (human/LLM readable)
|
|
19
|
+
↓
|
|
20
|
+
Compiler (applies paper constraints)
|
|
21
|
+
↓
|
|
22
|
+
workflow.mmd / workflow.dot ← Backend output
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Quick Start
|
|
26
|
+
|
|
27
|
+
```python
|
|
28
|
+
from scitex.diagram import Diagram
|
|
29
|
+
|
|
30
|
+
# Create programmatically
|
|
31
|
+
d = Diagram(type="workflow", title="Data Pipeline")
|
|
32
|
+
d.add_node("input", "Raw Data", shape="stadium")
|
|
33
|
+
d.add_node("process", "Transform", emphasis="primary")
|
|
34
|
+
d.add_node("output", "Results", shape="stadium")
|
|
35
|
+
d.add_edge("input", "process")
|
|
36
|
+
d.add_edge("process", "output")
|
|
37
|
+
|
|
38
|
+
# Export
|
|
39
|
+
d.to_mermaid("pipeline.mmd")
|
|
40
|
+
d.to_graphviz("pipeline.dot")
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
## From YAML Specification
|
|
44
|
+
|
|
45
|
+
```yaml
|
|
46
|
+
# workflow.diagram.yaml
|
|
47
|
+
type: workflow
|
|
48
|
+
title: SciTeX Figure Lifecycle
|
|
49
|
+
|
|
50
|
+
paper:
|
|
51
|
+
column: single
|
|
52
|
+
mode: publication # draft | publication
|
|
53
|
+
emphasize: [figz_bundle, editor]
|
|
54
|
+
return_edges: # Hide in publication mode
|
|
55
|
+
- [editor, figz_bundle]
|
|
56
|
+
|
|
57
|
+
layout:
|
|
58
|
+
layer_gap: tight
|
|
59
|
+
layers: # rank=same constraints
|
|
60
|
+
- [python, savefig]
|
|
61
|
+
- [figz_bundle]
|
|
62
|
+
- [editor, ai_review]
|
|
63
|
+
|
|
64
|
+
nodes:
|
|
65
|
+
- id: python
|
|
66
|
+
label: Python
|
|
67
|
+
shape: rounded
|
|
68
|
+
- id: figz_bundle
|
|
69
|
+
label: .figz Bundle
|
|
70
|
+
shape: stadium
|
|
71
|
+
emphasis: primary
|
|
72
|
+
|
|
73
|
+
edges:
|
|
74
|
+
- from: python
|
|
75
|
+
to: savefig
|
|
76
|
+
- from: savefig
|
|
77
|
+
to: figz_bundle
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```python
|
|
81
|
+
d = Diagram.from_yaml("workflow.diagram.yaml")
|
|
82
|
+
d.to_mermaid("workflow.mmd")
|
|
83
|
+
```
|
|
84
|
+
|
|
85
|
+
## Paper Modes
|
|
86
|
+
|
|
87
|
+
### Draft Mode (default)
|
|
88
|
+
- Full arrows and labels
|
|
89
|
+
- Medium spacing
|
|
90
|
+
- All edges visible
|
|
91
|
+
|
|
92
|
+
### Publication Mode
|
|
93
|
+
- Tight spacing (`ranksep=0.3, nodesep=0.2`)
|
|
94
|
+
- Return edges hidden (invisible but constrain layout)
|
|
95
|
+
- No clusters in Graphviz (uses `rank=same` only)
|
|
96
|
+
|
|
97
|
+
```yaml
|
|
98
|
+
paper:
|
|
99
|
+
mode: publication
|
|
100
|
+
return_edges:
|
|
101
|
+
- [editor, figz_bundle] # Will be invisible
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
## Auto-Split Large Diagrams
|
|
105
|
+
|
|
106
|
+
```python
|
|
107
|
+
d = Diagram.from_yaml("large_workflow.yaml")
|
|
108
|
+
|
|
109
|
+
# Split if > 8 nodes per figure
|
|
110
|
+
parts = d.split(max_nodes=8, strategy="by_groups")
|
|
111
|
+
|
|
112
|
+
for i, part in enumerate(parts):
|
|
113
|
+
part.to_mermaid(f"fig_{chr(65+i)}.mmd") # fig_A.mmd, fig_B.mmd
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Split Strategies
|
|
117
|
+
|
|
118
|
+
| Strategy | Description |
|
|
119
|
+
|----------|-------------|
|
|
120
|
+
| `by_groups` | Split by layout.groups (deterministic, paper-friendly) |
|
|
121
|
+
| `by_articulation` | Split at hub nodes (graph-theoretic) |
|
|
122
|
+
|
|
123
|
+
Ghost nodes are automatically added at boundaries with `→` prefix.
|
|
124
|
+
|
|
125
|
+
## Diagram Types
|
|
126
|
+
|
|
127
|
+
| Type | Direction | Use Case |
|
|
128
|
+
|------|-----------|----------|
|
|
129
|
+
| `workflow` | LR | Sequential processes |
|
|
130
|
+
| `decision` | TB | Decision trees |
|
|
131
|
+
| `pipeline` | LR | Data pipelines with stages |
|
|
132
|
+
| `hierarchy` | TB | Tree structures |
|
|
133
|
+
| `comparison` | LR | Side-by-side comparison |
|
|
134
|
+
|
|
135
|
+
## Node Shapes
|
|
136
|
+
|
|
137
|
+
| Shape | Mermaid | Use Case |
|
|
138
|
+
|-------|---------|----------|
|
|
139
|
+
| `box` | `["label"]` | Default |
|
|
140
|
+
| `rounded` | `("label")` | Processes |
|
|
141
|
+
| `stadium` | `(["label"])` | Start/End |
|
|
142
|
+
| `diamond` | `{"label"}` | Decisions |
|
|
143
|
+
| `circle` | `(("label"))` | Events |
|
|
144
|
+
|
|
145
|
+
## Emphasis Levels
|
|
146
|
+
|
|
147
|
+
| Level | Color | Use Case |
|
|
148
|
+
|-------|-------|----------|
|
|
149
|
+
| `normal` | Dark | Default |
|
|
150
|
+
| `primary` | Blue | Key nodes |
|
|
151
|
+
| `success` | Green | Positive outcomes |
|
|
152
|
+
| `warning` | Red | Negative outcomes |
|
|
153
|
+
| `muted` | Gray | Secondary/derived |
|
|
154
|
+
|
|
155
|
+
## Graphviz Output
|
|
156
|
+
|
|
157
|
+
For tightest layouts, use Graphviz:
|
|
158
|
+
|
|
159
|
+
```bash
|
|
160
|
+
# Render DOT to PNG
|
|
161
|
+
dot -Tpng workflow.dot -o workflow.png
|
|
162
|
+
|
|
163
|
+
# Render DOT to SVG (vector)
|
|
164
|
+
dot -Tsvg workflow.dot -o workflow.svg
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
Note: Mermaid doesn't support `rank=same` constraints, so Graphviz produces more compact output.
|
|
168
|
+
|
|
169
|
+
## API Reference
|
|
170
|
+
|
|
171
|
+
### Diagram Class
|
|
172
|
+
|
|
173
|
+
```python
|
|
174
|
+
Diagram(type="workflow", title="", column="single")
|
|
175
|
+
Diagram.from_yaml(path)
|
|
176
|
+
Diagram.from_mermaid(path, diagram_type="workflow")
|
|
177
|
+
|
|
178
|
+
diagram.add_node(id, label, shape="box", emphasis="normal")
|
|
179
|
+
diagram.add_edge(source, target, label=None, style="solid")
|
|
180
|
+
diagram.set_group(group_name, node_ids)
|
|
181
|
+
diagram.emphasize(*node_ids)
|
|
182
|
+
|
|
183
|
+
diagram.to_mermaid(path=None) -> str
|
|
184
|
+
diagram.to_graphviz(path=None) -> str
|
|
185
|
+
diagram.to_yaml(path=None) -> str
|
|
186
|
+
diagram.split(max_nodes=12, strategy="by_groups") -> List[Diagram]
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Schema Classes
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
DiagramSpec # Complete specification
|
|
193
|
+
PaperConstraints # column, mode, emphasize, return_edges
|
|
194
|
+
LayoutHints # groups, layers, layer_gap, node_gap
|
|
195
|
+
NodeSpec # id, label, shape, emphasis
|
|
196
|
+
EdgeSpec # source, target, label, style
|
|
197
|
+
```
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# -*- coding: utf-8 -*-
|
|
3
|
+
# Timestamp: 2025-12-15
|
|
4
|
+
# Author: ywatanabe / Claude
|
|
5
|
+
# File: scitex/diagram/__init__.py
|
|
6
|
+
|
|
7
|
+
"""
|
|
8
|
+
SciTeX Diagram - Paper-optimized diagram generation.
|
|
9
|
+
|
|
10
|
+
This module provides a semantic layer above Mermaid/Graphviz/D2 that
|
|
11
|
+
understands paper constraints (column width, reading direction, emphasis)
|
|
12
|
+
and compiles to backend formats with appropriate layout hints.
|
|
13
|
+
|
|
14
|
+
Key insight: LLMs are good at generating CONSTRAINTS, not pixel layouts.
|
|
15
|
+
SciTeX Diagram defines "what this diagram means for a paper" and compiles
|
|
16
|
+
that to backend-specific layout directives.
|
|
17
|
+
|
|
18
|
+
Example
|
|
19
|
+
-------
|
|
20
|
+
>>> from scitex.diagram import Diagram
|
|
21
|
+
>>>
|
|
22
|
+
>>> diagram = Diagram.from_yaml("workflow.diagram.yaml")
|
|
23
|
+
>>> diagram.to_mermaid("workflow.mmd")
|
|
24
|
+
>>> diagram.to_graphviz("workflow.dot")
|
|
25
|
+
"""
|
|
26
|
+
|
|
27
|
+
from scitex.diagram._schema import DiagramSpec, PaperConstraints, LayoutHints, PaperMode
|
|
28
|
+
from scitex.diagram._diagram import Diagram
|
|
29
|
+
from scitex.diagram._compile import compile_to_mermaid, compile_to_graphviz
|
|
30
|
+
from scitex.diagram._presets import WORKFLOW_PRESET, DECISION_PRESET, PIPELINE_PRESET
|
|
31
|
+
from scitex.diagram._split import split_diagram, SplitConfig, SplitStrategy, SplitResult
|
|
32
|
+
|
|
33
|
+
__all__ = [
|
|
34
|
+
"Diagram",
|
|
35
|
+
"DiagramSpec",
|
|
36
|
+
"PaperConstraints",
|
|
37
|
+
"LayoutHints",
|
|
38
|
+
"PaperMode",
|
|
39
|
+
"compile_to_mermaid",
|
|
40
|
+
"compile_to_graphviz",
|
|
41
|
+
"WORKFLOW_PRESET",
|
|
42
|
+
"DECISION_PRESET",
|
|
43
|
+
"PIPELINE_PRESET",
|
|
44
|
+
"split_diagram",
|
|
45
|
+
"SplitConfig",
|
|
46
|
+
"SplitStrategy",
|
|
47
|
+
"SplitResult",
|
|
48
|
+
]
|