scitex 2.14.0__py3-none-any.whl → 2.15.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.
Files changed (264) hide show
  1. scitex/__init__.py +71 -17
  2. scitex/_env_loader.py +156 -0
  3. scitex/_mcp_resources/__init__.py +37 -0
  4. scitex/_mcp_resources/_cheatsheet.py +135 -0
  5. scitex/_mcp_resources/_figrecipe.py +138 -0
  6. scitex/_mcp_resources/_formats.py +102 -0
  7. scitex/_mcp_resources/_modules.py +337 -0
  8. scitex/_mcp_resources/_session.py +149 -0
  9. scitex/_mcp_tools/__init__.py +4 -0
  10. scitex/_mcp_tools/audio.py +66 -0
  11. scitex/_mcp_tools/diagram.py +11 -95
  12. scitex/_mcp_tools/introspect.py +210 -0
  13. scitex/_mcp_tools/plt.py +260 -305
  14. scitex/_mcp_tools/scholar.py +74 -0
  15. scitex/_mcp_tools/social.py +27 -0
  16. scitex/_mcp_tools/template.py +24 -0
  17. scitex/_mcp_tools/writer.py +17 -210
  18. scitex/ai/_gen_ai/_PARAMS.py +10 -7
  19. scitex/ai/classification/reporters/_SingleClassificationReporter.py +45 -1603
  20. scitex/ai/classification/reporters/_mixins/__init__.py +36 -0
  21. scitex/ai/classification/reporters/_mixins/_constants.py +67 -0
  22. scitex/ai/classification/reporters/_mixins/_cv_summary.py +387 -0
  23. scitex/ai/classification/reporters/_mixins/_feature_importance.py +119 -0
  24. scitex/ai/classification/reporters/_mixins/_metrics.py +275 -0
  25. scitex/ai/classification/reporters/_mixins/_plotting.py +179 -0
  26. scitex/ai/classification/reporters/_mixins/_reports.py +153 -0
  27. scitex/ai/classification/reporters/_mixins/_storage.py +160 -0
  28. scitex/ai/classification/timeseries/_TimeSeriesSlidingWindowSplit.py +30 -1550
  29. scitex/ai/classification/timeseries/_sliding_window_core.py +467 -0
  30. scitex/ai/classification/timeseries/_sliding_window_plotting.py +369 -0
  31. scitex/audio/README.md +40 -36
  32. scitex/audio/__init__.py +129 -61
  33. scitex/audio/_branding.py +185 -0
  34. scitex/audio/_mcp/__init__.py +32 -0
  35. scitex/audio/_mcp/handlers.py +59 -6
  36. scitex/audio/_mcp/speak_handlers.py +238 -0
  37. scitex/audio/_relay.py +225 -0
  38. scitex/audio/_tts.py +18 -10
  39. scitex/audio/engines/base.py +17 -10
  40. scitex/audio/engines/elevenlabs_engine.py +7 -2
  41. scitex/audio/mcp_server.py +228 -75
  42. scitex/canvas/README.md +1 -1
  43. scitex/canvas/editor/_dearpygui/__init__.py +25 -0
  44. scitex/canvas/editor/_dearpygui/_editor.py +147 -0
  45. scitex/canvas/editor/_dearpygui/_handlers.py +476 -0
  46. scitex/canvas/editor/_dearpygui/_panels/__init__.py +17 -0
  47. scitex/canvas/editor/_dearpygui/_panels/_control.py +119 -0
  48. scitex/canvas/editor/_dearpygui/_panels/_element_controls.py +190 -0
  49. scitex/canvas/editor/_dearpygui/_panels/_preview.py +43 -0
  50. scitex/canvas/editor/_dearpygui/_panels/_sections.py +390 -0
  51. scitex/canvas/editor/_dearpygui/_plotting.py +187 -0
  52. scitex/canvas/editor/_dearpygui/_rendering.py +504 -0
  53. scitex/canvas/editor/_dearpygui/_selection.py +295 -0
  54. scitex/canvas/editor/_dearpygui/_state.py +93 -0
  55. scitex/canvas/editor/_dearpygui/_utils.py +61 -0
  56. scitex/canvas/editor/flask_editor/_core/__init__.py +27 -0
  57. scitex/canvas/editor/flask_editor/_core/_bbox_extraction.py +200 -0
  58. scitex/canvas/editor/flask_editor/_core/_editor.py +173 -0
  59. scitex/canvas/editor/flask_editor/_core/_export_helpers.py +353 -0
  60. scitex/canvas/editor/flask_editor/_core/_routes_basic.py +190 -0
  61. scitex/canvas/editor/flask_editor/_core/_routes_export.py +332 -0
  62. scitex/canvas/editor/flask_editor/_core/_routes_panels.py +252 -0
  63. scitex/canvas/editor/flask_editor/_core/_routes_save.py +218 -0
  64. scitex/canvas/editor/flask_editor/_core.py +25 -1684
  65. scitex/canvas/editor/flask_editor/templates/__init__.py +32 -70
  66. scitex/cli/__init__.py +38 -43
  67. scitex/cli/audio.py +160 -41
  68. scitex/cli/capture.py +133 -20
  69. scitex/cli/introspect.py +488 -0
  70. scitex/cli/main.py +200 -109
  71. scitex/cli/mcp.py +60 -34
  72. scitex/cli/plt.py +414 -0
  73. scitex/cli/repro.py +15 -8
  74. scitex/cli/resource.py +15 -8
  75. scitex/cli/scholar/__init__.py +154 -8
  76. scitex/cli/scholar/_crossref_scitex.py +296 -0
  77. scitex/cli/scholar/_fetch.py +25 -3
  78. scitex/cli/social.py +355 -0
  79. scitex/cli/stats.py +136 -11
  80. scitex/cli/template.py +129 -12
  81. scitex/cli/tex.py +15 -8
  82. scitex/cli/writer.py +49 -299
  83. scitex/cloud/__init__.py +41 -2
  84. scitex/config/README.md +1 -1
  85. scitex/config/__init__.py +16 -2
  86. scitex/config/_env_registry.py +256 -0
  87. scitex/context/__init__.py +22 -0
  88. scitex/dev/__init__.py +20 -1
  89. scitex/diagram/__init__.py +42 -19
  90. scitex/diagram/mcp_server.py +13 -125
  91. scitex/gen/__init__.py +50 -14
  92. scitex/gen/_list_packages.py +4 -4
  93. scitex/introspect/__init__.py +82 -0
  94. scitex/introspect/_call_graph.py +303 -0
  95. scitex/introspect/_class_hierarchy.py +163 -0
  96. scitex/introspect/_core.py +41 -0
  97. scitex/introspect/_docstring.py +131 -0
  98. scitex/introspect/_examples.py +113 -0
  99. scitex/introspect/_imports.py +271 -0
  100. scitex/{gen/_inspect_module.py → introspect/_list_api.py} +48 -56
  101. scitex/introspect/_mcp/__init__.py +41 -0
  102. scitex/introspect/_mcp/handlers.py +233 -0
  103. scitex/introspect/_members.py +155 -0
  104. scitex/introspect/_resolve.py +89 -0
  105. scitex/introspect/_signature.py +131 -0
  106. scitex/introspect/_source.py +80 -0
  107. scitex/introspect/_type_hints.py +172 -0
  108. scitex/io/_save.py +1 -2
  109. scitex/io/bundle/README.md +1 -1
  110. scitex/logging/_formatters.py +19 -9
  111. scitex/mcp_server.py +98 -5
  112. scitex/os/__init__.py +4 -0
  113. scitex/{gen → os}/_check_host.py +4 -5
  114. scitex/plt/__init__.py +245 -550
  115. scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin/_wrappers.py +5 -10
  116. scitex/plt/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
  117. scitex/plt/gallery/README.md +1 -1
  118. scitex/plt/utils/_hitmap/__init__.py +82 -0
  119. scitex/plt/utils/_hitmap/_artist_extraction.py +343 -0
  120. scitex/plt/utils/_hitmap/_color_application.py +346 -0
  121. scitex/plt/utils/_hitmap/_color_conversion.py +121 -0
  122. scitex/plt/utils/_hitmap/_constants.py +40 -0
  123. scitex/plt/utils/_hitmap/_hitmap_core.py +334 -0
  124. scitex/plt/utils/_hitmap/_path_extraction.py +357 -0
  125. scitex/plt/utils/_hitmap/_query.py +113 -0
  126. scitex/plt/utils/_hitmap.py +46 -1616
  127. scitex/plt/utils/_metadata/__init__.py +80 -0
  128. scitex/plt/utils/_metadata/_artists/__init__.py +25 -0
  129. scitex/plt/utils/_metadata/_artists/_base.py +195 -0
  130. scitex/plt/utils/_metadata/_artists/_collections.py +356 -0
  131. scitex/plt/utils/_metadata/_artists/_extract.py +57 -0
  132. scitex/plt/utils/_metadata/_artists/_images.py +80 -0
  133. scitex/plt/utils/_metadata/_artists/_lines.py +261 -0
  134. scitex/plt/utils/_metadata/_artists/_patches.py +247 -0
  135. scitex/plt/utils/_metadata/_artists/_text.py +106 -0
  136. scitex/plt/utils/_metadata/_csv.py +416 -0
  137. scitex/plt/utils/_metadata/_detect.py +225 -0
  138. scitex/plt/utils/_metadata/_legend.py +127 -0
  139. scitex/plt/utils/_metadata/_rounding.py +117 -0
  140. scitex/plt/utils/_metadata/_verification.py +202 -0
  141. scitex/schema/README.md +1 -1
  142. scitex/scholar/__init__.py +8 -0
  143. scitex/scholar/_mcp/crossref_handlers.py +265 -0
  144. scitex/scholar/core/Scholar.py +63 -1700
  145. scitex/scholar/core/_mixins/__init__.py +36 -0
  146. scitex/scholar/core/_mixins/_enrichers.py +270 -0
  147. scitex/scholar/core/_mixins/_library_handlers.py +100 -0
  148. scitex/scholar/core/_mixins/_loaders.py +103 -0
  149. scitex/scholar/core/_mixins/_pdf_download.py +375 -0
  150. scitex/scholar/core/_mixins/_pipeline.py +312 -0
  151. scitex/scholar/core/_mixins/_project_handlers.py +125 -0
  152. scitex/scholar/core/_mixins/_savers.py +69 -0
  153. scitex/scholar/core/_mixins/_search.py +103 -0
  154. scitex/scholar/core/_mixins/_services.py +88 -0
  155. scitex/scholar/core/_mixins/_url_finding.py +105 -0
  156. scitex/scholar/crossref_scitex.py +367 -0
  157. scitex/scholar/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
  158. scitex/scholar/examples/00_run_all.sh +120 -0
  159. scitex/scholar/jobs/_executors.py +27 -3
  160. scitex/scholar/pdf_download/ScholarPDFDownloader.py +38 -416
  161. scitex/scholar/pdf_download/_cli.py +154 -0
  162. scitex/scholar/pdf_download/strategies/__init__.py +11 -8
  163. scitex/scholar/pdf_download/strategies/manual_download_fallback.py +80 -3
  164. scitex/scholar/pipelines/ScholarPipelineBibTeX.py +73 -121
  165. scitex/scholar/pipelines/ScholarPipelineParallel.py +80 -138
  166. scitex/scholar/pipelines/ScholarPipelineSingle.py +43 -63
  167. scitex/scholar/pipelines/_single_steps.py +71 -36
  168. scitex/scholar/storage/_LibraryManager.py +97 -1695
  169. scitex/scholar/storage/_mixins/__init__.py +30 -0
  170. scitex/scholar/storage/_mixins/_bibtex_handlers.py +128 -0
  171. scitex/scholar/storage/_mixins/_library_operations.py +218 -0
  172. scitex/scholar/storage/_mixins/_metadata_conversion.py +226 -0
  173. scitex/scholar/storage/_mixins/_paper_saving.py +456 -0
  174. scitex/scholar/storage/_mixins/_resolution.py +376 -0
  175. scitex/scholar/storage/_mixins/_storage_helpers.py +121 -0
  176. scitex/scholar/storage/_mixins/_symlink_handlers.py +226 -0
  177. scitex/security/README.md +3 -3
  178. scitex/session/README.md +1 -1
  179. scitex/session/__init__.py +26 -7
  180. scitex/session/_decorator.py +1 -1
  181. scitex/sh/README.md +1 -1
  182. scitex/sh/__init__.py +7 -4
  183. scitex/social/__init__.py +155 -0
  184. scitex/social/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
  185. scitex/stats/_mcp/_handlers/__init__.py +31 -0
  186. scitex/stats/_mcp/_handlers/_corrections.py +113 -0
  187. scitex/stats/_mcp/_handlers/_descriptive.py +78 -0
  188. scitex/stats/_mcp/_handlers/_effect_size.py +106 -0
  189. scitex/stats/_mcp/_handlers/_format.py +94 -0
  190. scitex/stats/_mcp/_handlers/_normality.py +110 -0
  191. scitex/stats/_mcp/_handlers/_posthoc.py +224 -0
  192. scitex/stats/_mcp/_handlers/_power.py +247 -0
  193. scitex/stats/_mcp/_handlers/_recommend.py +102 -0
  194. scitex/stats/_mcp/_handlers/_run_test.py +279 -0
  195. scitex/stats/_mcp/_handlers/_stars.py +48 -0
  196. scitex/stats/_mcp/handlers.py +19 -1171
  197. scitex/stats/auto/_stat_style.py +175 -0
  198. scitex/stats/auto/_style_definitions.py +411 -0
  199. scitex/stats/auto/_styles.py +22 -620
  200. scitex/stats/descriptive/__init__.py +11 -8
  201. scitex/stats/descriptive/_ci.py +39 -0
  202. scitex/stats/power/_power.py +15 -4
  203. scitex/str/__init__.py +2 -1
  204. scitex/str/_title_case.py +63 -0
  205. scitex/template/README.md +1 -1
  206. scitex/template/__init__.py +25 -10
  207. scitex/template/_code_templates.py +147 -0
  208. scitex/template/_mcp/handlers.py +81 -0
  209. scitex/template/_mcp/tool_schemas.py +55 -0
  210. scitex/template/_templates/__init__.py +51 -0
  211. scitex/template/_templates/audio.py +233 -0
  212. scitex/template/_templates/canvas.py +312 -0
  213. scitex/template/_templates/capture.py +268 -0
  214. scitex/template/_templates/config.py +43 -0
  215. scitex/template/_templates/diagram.py +294 -0
  216. scitex/template/_templates/io.py +107 -0
  217. scitex/template/_templates/module.py +53 -0
  218. scitex/template/_templates/plt.py +202 -0
  219. scitex/template/_templates/scholar.py +267 -0
  220. scitex/template/_templates/session.py +130 -0
  221. scitex/template/_templates/session_minimal.py +43 -0
  222. scitex/template/_templates/session_plot.py +67 -0
  223. scitex/template/_templates/session_stats.py +77 -0
  224. scitex/template/_templates/stats.py +323 -0
  225. scitex/template/_templates/writer.py +296 -0
  226. scitex/template/clone_writer_directory.py +5 -5
  227. scitex/ui/_backends/_email.py +10 -2
  228. scitex/ui/_backends/_webhook.py +5 -1
  229. scitex/web/_search_pubmed.py +10 -6
  230. scitex/writer/README.md +1 -1
  231. scitex/writer/__init__.py +43 -34
  232. scitex/writer/_mcp/handlers.py +11 -744
  233. scitex/writer/_mcp/tool_schemas.py +5 -335
  234. scitex-2.15.3.dist-info/METADATA +667 -0
  235. {scitex-2.14.0.dist-info → scitex-2.15.3.dist-info}/RECORD +241 -120
  236. scitex/canvas/editor/flask_editor/templates/_scripts.py +0 -4933
  237. scitex/canvas/editor/flask_editor/templates/_styles.py +0 -1658
  238. scitex/diagram/_compile.py +0 -312
  239. scitex/diagram/_diagram.py +0 -355
  240. scitex/diagram/_mcp/__init__.py +0 -4
  241. scitex/diagram/_mcp/handlers.py +0 -400
  242. scitex/diagram/_mcp/tool_schemas.py +0 -157
  243. scitex/diagram/_presets.py +0 -173
  244. scitex/diagram/_schema.py +0 -182
  245. scitex/diagram/_split.py +0 -278
  246. scitex/gen/_ci.py +0 -12
  247. scitex/gen/_title_case.py +0 -89
  248. scitex/plt/_mcp/__init__.py +0 -4
  249. scitex/plt/_mcp/_handlers_annotation.py +0 -102
  250. scitex/plt/_mcp/_handlers_figure.py +0 -195
  251. scitex/plt/_mcp/_handlers_plot.py +0 -252
  252. scitex/plt/_mcp/_handlers_style.py +0 -219
  253. scitex/plt/_mcp/handlers.py +0 -74
  254. scitex/plt/_mcp/tool_schemas.py +0 -497
  255. scitex/plt/mcp_server.py +0 -231
  256. scitex/scholar/examples/SUGGESTIONS.md +0 -865
  257. scitex/scholar/examples/dev.py +0 -38
  258. scitex-2.14.0.dist-info/METADATA +0 -1238
  259. /scitex/{gen → context}/_detect_environment.py +0 -0
  260. /scitex/{gen → context}/_get_notebook_path.py +0 -0
  261. /scitex/{gen/_shell.py → sh/_shell_legacy.py} +0 -0
  262. {scitex-2.14.0.dist-info → scitex-2.15.3.dist-info}/WHEEL +0 -0
  263. {scitex-2.14.0.dist-info → scitex-2.15.3.dist-info}/entry_points.txt +0 -0
  264. {scitex-2.14.0.dist-info → scitex-2.15.3.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,268 @@
1
+ #!/usr/bin/env python3
2
+ # Timestamp: 2026-01-25
3
+ # File: src/scitex/template/_templates/capture.py
4
+ # ----------------------------------------
5
+
6
+ """Template for stx.capture screenshot module usage."""
7
+
8
+ TEMPLATE = {
9
+ "name": "Capture Module",
10
+ "description": "stx.capture usage for screenshots, monitoring, and screen recording",
11
+ "filename": "capture_script.py",
12
+ "priority": 6,
13
+ "content": '''#!/usr/bin/env python3
14
+ # -*- coding: utf-8 -*-
15
+ # Timestamp: {timestamp}
16
+ # File: {filepath}
17
+
18
+ """
19
+ stx.capture - Screenshot & Screen Recording
20
+ ===========================================
21
+
22
+ stx.capture provides:
23
+ - Single and multi-monitor screenshots
24
+ - Window-specific capture
25
+ - Continuous monitoring with timestamps
26
+ - Animated GIF creation from sequences
27
+ - Error detection in screenshots
28
+
29
+ Usage Patterns
30
+ --------------
31
+ 1. MCP: capture_* tools for Claude Code integration
32
+ 2. Python API: stx.capture.* functions
33
+ 3. Useful for: debugging, documentation, testing
34
+ """
35
+
36
+ import scitex as stx
37
+
38
+ # ============================================================
39
+ # Pattern 1: Basic Screenshots (via MCP)
40
+ # ============================================================
41
+
42
+ """
43
+ MCP Tools for Claude Code:
44
+ --------------------------
45
+
46
+ # Capture current monitor
47
+ capture_capture_screenshot()
48
+
49
+ # Capture specific monitor
50
+ capture_capture_screenshot(monitor_id=1)
51
+
52
+ # Capture all monitors
53
+ capture_capture_screenshot(all=True)
54
+
55
+ # Capture specific window by app name
56
+ capture_capture_screenshot(app="Firefox")
57
+
58
+ # Get screenshot as base64 (for analysis)
59
+ capture_capture_screenshot(return_base64=True)
60
+
61
+ # Capture with message annotation
62
+ capture_capture_screenshot(message="Before fix")
63
+ """
64
+
65
+ # ============================================================
66
+ # Pattern 2: Window Capture
67
+ # ============================================================
68
+
69
+ """
70
+ Window-Specific Capture:
71
+ ------------------------
72
+
73
+ # List all visible windows
74
+ capture_list_windows()
75
+
76
+ # Capture window by handle
77
+ capture_capture_window(window_handle=12345)
78
+
79
+ # Get system info (monitors, desktops)
80
+ capture_get_info()
81
+ """
82
+
83
+ # ============================================================
84
+ # Pattern 3: Continuous Monitoring
85
+ # ============================================================
86
+
87
+ """
88
+ Screen Monitoring:
89
+ ------------------
90
+
91
+ # Start continuous capture (1 screenshot/second)
92
+ capture_start_monitoring(interval=1.0, monitor_id=0)
93
+
94
+ # Start with all monitors
95
+ capture_start_monitoring(capture_all=True, interval=0.5)
96
+
97
+ # Get monitoring status
98
+ capture_get_monitoring_status()
99
+
100
+ # Stop monitoring
101
+ capture_stop_monitoring()
102
+
103
+ # List monitoring sessions
104
+ capture_list_sessions(limit=10)
105
+ """
106
+
107
+ # ============================================================
108
+ # Pattern 4: GIF Creation
109
+ # ============================================================
110
+
111
+ """
112
+ Animated GIF Creation:
113
+ ----------------------
114
+
115
+ # Create GIF from monitoring session
116
+ capture_create_gif(session_id="xxx", duration=0.5)
117
+
118
+ # Create GIF from specific images
119
+ capture_create_gif(
120
+ image_paths=["/path/1.png", "/path/2.png"],
121
+ output_path="animation.gif",
122
+ duration=0.3
123
+ )
124
+
125
+ # Create GIF with frame limit
126
+ capture_create_gif(
127
+ session_id="xxx",
128
+ max_frames=50,
129
+ optimize=True
130
+ )
131
+ """
132
+
133
+ # ============================================================
134
+ # Pattern 5: Python API Usage
135
+ # ============================================================
136
+
137
+ def python_api_example():
138
+ """Direct Python API for screenshots."""
139
+ from scitex.capture import (
140
+ capture_screenshot,
141
+ start_monitoring,
142
+ stop_monitoring,
143
+ create_gif,
144
+ list_windows,
145
+ )
146
+
147
+ # Take a screenshot
148
+ result = capture_screenshot(
149
+ monitor_id=0,
150
+ quality=85
151
+ )
152
+ print(f"Saved to: {{result['path']}}")
153
+
154
+ # List windows
155
+ windows = list_windows()
156
+ for win in windows:
157
+ print(f"Window: {{win['title']}} (handle: {{win['handle']}})")
158
+
159
+ # Start monitoring
160
+ start_monitoring(interval=1.0)
161
+
162
+ # ... do something ...
163
+
164
+ # Stop and create GIF
165
+ stop_monitoring()
166
+ create_gif(duration=0.5, output_path="recording.gif")
167
+
168
+ # ============================================================
169
+ # Pattern 6: With @stx.session (Documentation)
170
+ # ============================================================
171
+
172
+ @stx.session
173
+ def main(
174
+ interval=2.0,
175
+ duration=10,
176
+ CONFIG=stx.INJECTED,
177
+ logger=stx.INJECTED,
178
+ ):
179
+ """Capture session for documentation."""
180
+ from scitex.capture import (
181
+ capture_screenshot,
182
+ start_monitoring,
183
+ stop_monitoring,
184
+ create_gif,
185
+ )
186
+ import time
187
+
188
+ # Take initial screenshot
189
+ result = capture_screenshot(
190
+ message="Initial state"
191
+ )
192
+ stx.io.save(result, CONFIG.SDIR_OUT / "initial.json")
193
+
194
+ # Start monitoring
195
+ logger.info(f"Starting {{duration}}s monitoring...")
196
+ start_monitoring(
197
+ interval=interval,
198
+ output_dir=str(CONFIG.SDIR_OUT / "frames")
199
+ )
200
+
201
+ time.sleep(duration)
202
+
203
+ stop_monitoring()
204
+
205
+ # Create GIF
206
+ logger.info("Creating GIF...")
207
+ create_gif(
208
+ output_path=str(CONFIG.SDIR_OUT / "recording.gif"),
209
+ duration=0.5
210
+ )
211
+
212
+ logger.info(f"Recording saved to {{CONFIG.SDIR_OUT}}")
213
+ return 0
214
+
215
+ # ============================================================
216
+ # Pattern 7: Error Analysis
217
+ # ============================================================
218
+
219
+ """
220
+ Screenshot Analysis:
221
+ --------------------
222
+
223
+ # Analyze screenshot for errors
224
+ capture_analyze_screenshot(path="/path/to/screenshot.png")
225
+
226
+ # Returns error indicators like:
227
+ # - Red error dialogs
228
+ # - Error text patterns
229
+ # - Warning indicators
230
+ """
231
+
232
+ # ============================================================
233
+ # MCP Tools Reference
234
+ # ============================================================
235
+
236
+ """
237
+ MCP Tools:
238
+ ----------
239
+
240
+ Screenshots:
241
+ - capture_capture_screenshot(monitor_id, all, app, url, quality, return_base64)
242
+ - capture_capture_window(window_handle, output_path)
243
+ - capture_list_windows()
244
+ - capture_get_info()
245
+
246
+ Monitoring:
247
+ - capture_start_monitoring(interval, monitor_id, capture_all)
248
+ - capture_stop_monitoring()
249
+ - capture_get_monitoring_status()
250
+ - capture_list_sessions(limit)
251
+
252
+ Processing:
253
+ - capture_create_gif(session_id, image_paths, duration, max_frames)
254
+ - capture_analyze_screenshot(path)
255
+
256
+ Cache:
257
+ - capture_list_recent_screenshots(limit, category)
258
+ - capture_clear_cache(max_size_gb)
259
+ """
260
+
261
+ if __name__ == "__main__":
262
+ main()
263
+ ''',
264
+ }
265
+
266
+ __all__ = ["TEMPLATE"]
267
+
268
+ # EOF
@@ -0,0 +1,43 @@
1
+ #!/usr/bin/env python3
2
+ """YAML configuration file template."""
3
+
4
+ TEMPLATE = {
5
+ "name": "Configuration YAML",
6
+ "description": "YAML configuration file for @stx.session scripts",
7
+ "filename": "config/config.yaml",
8
+ "usage": """
9
+ Usage:
10
+ Place in ./config/ directory
11
+ Access via CONFIG parameter: CONFIG.config.data.input_dir
12
+ """,
13
+ "content": """# Configuration file for SciTeX session
14
+ # Place in ./config/ directory (auto-loaded by @stx.session)
15
+ # Access via CONFIG parameter: CONFIG.<filename>.<key>
16
+ # Example: CONFIG.config.data.input_dir (for this file named config.yaml)
17
+
18
+ # Data paths
19
+ data:
20
+ input_dir: ./data/raw
21
+ output_dir: ./data/processed
22
+
23
+ # Analysis parameters
24
+ analysis:
25
+ n_samples: 100
26
+ threshold: 0.05
27
+ seed: 42
28
+
29
+ # Figure settings
30
+ figure:
31
+ dpi: 300
32
+ format: png
33
+ width_mm: 180
34
+ height_mm: 120
35
+
36
+ # Logging
37
+ logging:
38
+ level: INFO
39
+ save_log: true
40
+ """,
41
+ }
42
+
43
+ # EOF
@@ -0,0 +1,294 @@
1
+ #!/usr/bin/env python3
2
+ # Timestamp: 2026-01-25
3
+ # File: src/scitex/template/_templates/diagram.py
4
+ # ----------------------------------------
5
+
6
+ """Template for stx.diagram module usage."""
7
+
8
+ TEMPLATE = {
9
+ "name": "Diagram Module",
10
+ "description": "stx.diagram usage for creating Mermaid and Graphviz diagrams from YAML specs",
11
+ "filename": "diagram_script.py",
12
+ "priority": 7,
13
+ "content": '''#!/usr/bin/env python3
14
+ # -*- coding: utf-8 -*-
15
+ # Timestamp: {timestamp}
16
+ # File: {filepath}
17
+
18
+ """
19
+ stx.diagram - Scientific Diagrams
20
+ =================================
21
+
22
+ stx.diagram provides:
23
+ - YAML-based diagram specifications
24
+ - Mermaid and Graphviz output
25
+ - Paper-ready presets (workflow, decision, pipeline, scientific)
26
+ - Large diagram splitting for multi-column layouts
27
+ - PNG/SVG/PDF rendering
28
+
29
+ Usage Patterns
30
+ --------------
31
+ 1. MCP: diagram_* tools for Claude Code integration
32
+ 2. YAML spec files for reproducible diagrams
33
+ 3. Multiple rendering backends (mermaid-cli, graphviz, mermaid.ink)
34
+ """
35
+
36
+ import scitex as stx
37
+
38
+ # ============================================================
39
+ # Pattern 1: YAML Specification
40
+ # ============================================================
41
+
42
+ """
43
+ YAML Diagram Specification Format:
44
+ ----------------------------------
45
+
46
+ # diagram_spec.yaml
47
+ metadata:
48
+ title: "Data Processing Pipeline"
49
+ paper_mode: single_column # or double_column, full_page
50
+
51
+ preset: workflow # workflow, decision, pipeline, scientific
52
+
53
+ nodes:
54
+ - id: input
55
+ label: "Raw Data"
56
+ shape: cylinder
57
+ group: data
58
+
59
+ - id: preprocess
60
+ label: "Preprocessing"
61
+ shape: box
62
+ group: processing
63
+
64
+ edges:
65
+ - from: input
66
+ to: preprocess
67
+ label: "load"
68
+
69
+ groups:
70
+ - id: data
71
+ label: "Data Layer"
72
+ """
73
+
74
+ # ============================================================
75
+ # Pattern 2: MCP Tools Usage
76
+ # ============================================================
77
+
78
+ """
79
+ MCP Tools for Claude Code:
80
+ --------------------------
81
+
82
+ # Create diagram from YAML file
83
+ diagram_create(spec_path="/path/to/diagram.yaml")
84
+
85
+ # Create from dict specification (see Pattern 5 for dict format)
86
+ diagram_create(spec_dict=spec)
87
+
88
+ # Compile to Mermaid format
89
+ diagram_compile_mermaid(spec_path="diagram.yaml", output_path="diagram.mmd")
90
+
91
+ # Compile to Graphviz DOT
92
+ diagram_compile_graphviz(spec_path="diagram.yaml", output_path="diagram.dot")
93
+
94
+ # Render to image
95
+ diagram_render(
96
+ spec_path="diagram.yaml",
97
+ output_path="diagram.png",
98
+ format="png", # png, svg, pdf
99
+ backend="auto", # mermaid-cli, graphviz, mermaid.ink, auto
100
+ scale=2.0
101
+ )
102
+
103
+ # List available presets
104
+ diagram_list_presets()
105
+
106
+ # Get preset configuration
107
+ diagram_get_preset(preset_name="workflow")
108
+
109
+ # Get paper layout modes
110
+ diagram_get_paper_modes()
111
+
112
+ # Check rendering backends
113
+ diagram_get_backends()
114
+ """
115
+
116
+ # ============================================================
117
+ # Pattern 3: Presets
118
+ # ============================================================
119
+
120
+ """
121
+ Available Presets:
122
+ ------------------
123
+
124
+ workflow:
125
+ - Left-to-right flow
126
+ - Rounded boxes
127
+ - Good for process diagrams
128
+
129
+ decision:
130
+ - Top-down flow
131
+ - Diamond decision nodes
132
+ - Good for flowcharts
133
+
134
+ pipeline:
135
+ - Left-to-right flow
136
+ - Data cylinders
137
+ - Good for data pipelines
138
+
139
+ scientific:
140
+ - Top-down flow
141
+ - Clean academic style
142
+ - Good for methods diagrams
143
+ """
144
+
145
+ # ============================================================
146
+ # Pattern 4: Large Diagram Splitting
147
+ # ============================================================
148
+
149
+ """
150
+ Split Large Diagrams:
151
+ ---------------------
152
+ For multi-column layouts, split diagrams into parts:
153
+
154
+ # Split by groups
155
+ diagram_split(
156
+ spec_path="large_diagram.yaml",
157
+ max_nodes_per_part=10,
158
+ strategy="by_groups"
159
+ )
160
+
161
+ # Split by articulation points
162
+ diagram_split(
163
+ spec_path="large_diagram.yaml",
164
+ strategy="by_articulation"
165
+ )
166
+ """
167
+
168
+ # ============================================================
169
+ # Pattern 5: Python API Usage
170
+ # ============================================================
171
+
172
+ def python_api_example():
173
+ """Direct Python API for diagrams."""
174
+ from scitex.diagram import (
175
+ create_diagram,
176
+ compile_mermaid,
177
+ compile_graphviz,
178
+ render_diagram,
179
+ )
180
+
181
+ # Define specification as dict
182
+ # Keys: metadata, preset, nodes, edges
183
+ spec = dict(
184
+ metadata=dict(title="Simple Pipeline"),
185
+ preset="pipeline",
186
+ nodes=[
187
+ dict(id="a", label="Input"),
188
+ dict(id="b", label="Process"),
189
+ dict(id="c", label="Output"),
190
+ ],
191
+ edges=[
192
+ dict(from_="a", to="b"),
193
+ dict(from_="b", to="c"),
194
+ ],
195
+ )
196
+
197
+ # Create (returns mermaid and graphviz strings)
198
+ result = create_diagram(spec_dict=spec)
199
+ print("Mermaid:")
200
+ print(result["mermaid"])
201
+
202
+ # Compile to file
203
+ compile_mermaid(spec_dict=spec, output_path="pipeline.mmd")
204
+
205
+ # Render to PNG
206
+ render_diagram(
207
+ spec_dict=spec,
208
+ output_path="pipeline.png",
209
+ format="png",
210
+ scale=2.0
211
+ )
212
+
213
+ # ============================================================
214
+ # Pattern 6: With @stx.session
215
+ # ============================================================
216
+
217
+ @stx.session
218
+ def main(
219
+ CONFIG=stx.INJECTED,
220
+ logger=stx.INJECTED,
221
+ ):
222
+ """Create research methodology diagram."""
223
+ from scitex.diagram import render_diagram
224
+
225
+ # Define methodology using dict() constructor
226
+ spec = dict(
227
+ metadata=dict(
228
+ title="Research Methodology",
229
+ paper_mode="single_column"
230
+ ),
231
+ preset="scientific",
232
+ nodes=[
233
+ dict(id="data", label="Data Collection", shape="cylinder"),
234
+ dict(id="preprocess", label="Preprocessing"),
235
+ dict(id="features", label="Feature Extraction"),
236
+ dict(id="model", label="Model Training"),
237
+ dict(id="eval", label="Evaluation"),
238
+ dict(id="results", label="Results", shape="cylinder"),
239
+ ],
240
+ edges=[
241
+ dict(from_="data", to="preprocess"),
242
+ dict(from_="preprocess", to="features"),
243
+ dict(from_="features", to="model"),
244
+ dict(from_="model", to="eval"),
245
+ dict(from_="eval", to="results"),
246
+ ],
247
+ )
248
+
249
+ # Render diagram
250
+ output_path = CONFIG.SDIR_OUT / "methodology.png"
251
+ render_diagram(
252
+ spec_dict=spec,
253
+ output_path=str(output_path),
254
+ format="png",
255
+ scale=2.0
256
+ )
257
+
258
+ logger.info("Diagram saved to output directory")
259
+ return 0
260
+
261
+ # ============================================================
262
+ # MCP Tools Reference
263
+ # ============================================================
264
+
265
+ """
266
+ MCP Tools:
267
+ ----------
268
+
269
+ Creation:
270
+ - diagram_create(spec_dict, spec_path)
271
+ - diagram_compile_mermaid(spec_dict, spec_path, output_path)
272
+ - diagram_compile_graphviz(spec_dict, spec_path, output_path)
273
+
274
+ Rendering:
275
+ - diagram_render(spec_dict, spec_path, output_path, format, backend, scale)
276
+ - diagram_get_backends()
277
+
278
+ Presets & Layout:
279
+ - diagram_list_presets()
280
+ - diagram_get_preset(preset_name)
281
+ - diagram_get_paper_modes()
282
+
283
+ Advanced:
284
+ - diagram_split(spec_path, max_nodes_per_part, strategy)
285
+ """
286
+
287
+ if __name__ == "__main__":
288
+ main()
289
+ ''',
290
+ }
291
+
292
+ __all__ = ["TEMPLATE"]
293
+
294
+ # EOF
@@ -0,0 +1,107 @@
1
+ #!/usr/bin/env python3
2
+ """I/O operations script template."""
3
+
4
+ TEMPLATE = {
5
+ "name": "I/O Operations Script",
6
+ "description": "Demonstrates stx.io.save() and stx.io.load() for 30+ file formats",
7
+ "filename": "io_script.py",
8
+ "usage": """
9
+ Usage:
10
+ python io_script.py
11
+
12
+ Supported Formats (30+):
13
+ Data: csv, json, yaml, pkl, npy, npz, mat, hdf5, parquet, feather
14
+ Figures: png, jpg, svg, pdf (with metadata embedding)
15
+ Text: txt, md, html
16
+ Config: yaml, toml, ini
17
+ """,
18
+ "content": '''#!/usr/bin/env python3
19
+ # -*- coding: utf-8 -*-
20
+ # Timestamp: "{timestamp}"
21
+ # File: {filepath}
22
+
23
+ """
24
+ {docstring}
25
+
26
+ stx.io Usage Guide
27
+ ------------------
28
+ stx.io.save(obj, path, **kwargs) # Universal save
29
+ stx.io.load(path) # Universal load
30
+
31
+ Supported Formats (30+):
32
+ Data: csv, json, yaml, pkl, npy, npz, mat, hdf5, parquet, feather
33
+ Figures: png, jpg, svg, pdf (with metadata embedding)
34
+ Text: txt, md, html
35
+ Config: yaml, toml, ini
36
+
37
+ Key Features:
38
+ - Auto-format detection from extension
39
+ - Metadata embedding in images
40
+ - Symlink support for centralized outputs
41
+ - Automatic CSV export for figures
42
+ """
43
+
44
+ import numpy as np
45
+ import pandas as pd
46
+ import scitex as stx
47
+
48
+
49
+ @stx.session
50
+ def main(
51
+ CONFIG=stx.INJECTED,
52
+ plt=stx.INJECTED,
53
+ logger=stx.INJECTED,
54
+ ):
55
+ """Demonstrate stx.io save/load operations."""
56
+
57
+ # === DataFrame ===
58
+ df = pd.DataFrame({{"x": [1, 2, 3], "y": [4, 5, 6]}})
59
+ stx.io.save(df, "data.csv") # -> CONFIG.SDIR_OUT/data.csv
60
+ stx.io.save(df, "data.json")
61
+ stx.io.save(df, "data.parquet")
62
+
63
+ # === NumPy Arrays ===
64
+ arr = np.random.randn(100, 10)
65
+ stx.io.save(arr, "array.npy")
66
+ stx.io.save(arr, "array.csv")
67
+
68
+ # === Dictionaries ===
69
+ config = {{"param1": 100, "param2": "value"}}
70
+ stx.io.save(config, "config.yaml")
71
+ stx.io.save(config, "config.json")
72
+
73
+ # === Figures with Metadata ===
74
+ fig, ax = plt.subplots()
75
+ ax.plot_line([1, 2, 3], [1, 4, 9])
76
+ ax.set_xyt("X", "Y", "Example")
77
+
78
+ stx.io.save(
79
+ fig,
80
+ "figure.png",
81
+ metadata={{"experiment": "demo"}}, # Embedded in image
82
+ symlink_to="./data", # Create symlink
83
+ verbose=True,
84
+ )
85
+ # Auto-exports: figure.csv (plotted data)
86
+
87
+ # === Loading ===
88
+ df_loaded = stx.io.load(f"{{CONFIG.SDIR_OUT}}/data.csv")
89
+ arr_loaded = stx.io.load(f"{{CONFIG.SDIR_OUT}}/array.npy")
90
+ img, meta = stx.io.load(f"{{CONFIG.SDIR_OUT}}/figure.png")
91
+
92
+ logger.info(f"Output directory: {{CONFIG.SDIR_OUT}}")
93
+ logger.info(f"Loaded DataFrame shape: {{df_loaded.shape}}")
94
+ logger.info(f"Loaded array shape: {{arr_loaded.shape}}")
95
+ logger.info(f"Image metadata: {{meta}}")
96
+
97
+ return 0
98
+
99
+
100
+ if __name__ == "__main__":
101
+ main()
102
+
103
+ # EOF
104
+ ''',
105
+ }
106
+
107
+ # EOF