scitex 2.15.1__py3-none-any.whl → 2.15.2__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 (107) hide show
  1. scitex/__init__.py +68 -61
  2. scitex/_mcp_tools/introspect.py +42 -23
  3. scitex/_mcp_tools/template.py +24 -0
  4. scitex/ai/classification/timeseries/_TimeSeriesSlidingWindowSplit.py +30 -1550
  5. scitex/ai/classification/timeseries/_sliding_window_core.py +467 -0
  6. scitex/ai/classification/timeseries/_sliding_window_plotting.py +369 -0
  7. scitex/audio/__init__.py +2 -2
  8. scitex/audio/_tts.py +18 -10
  9. scitex/audio/engines/base.py +17 -10
  10. scitex/audio/engines/elevenlabs_engine.py +1 -1
  11. scitex/canvas/editor/flask_editor/_core/__init__.py +27 -0
  12. scitex/canvas/editor/flask_editor/_core/_bbox_extraction.py +200 -0
  13. scitex/canvas/editor/flask_editor/_core/_editor.py +173 -0
  14. scitex/canvas/editor/flask_editor/_core/_export_helpers.py +353 -0
  15. scitex/canvas/editor/flask_editor/_core/_routes_basic.py +190 -0
  16. scitex/canvas/editor/flask_editor/_core/_routes_export.py +332 -0
  17. scitex/canvas/editor/flask_editor/_core/_routes_panels.py +252 -0
  18. scitex/canvas/editor/flask_editor/_core/_routes_save.py +218 -0
  19. scitex/canvas/editor/flask_editor/_core.py +25 -1684
  20. scitex/cli/introspect.py +112 -74
  21. scitex/cli/main.py +2 -0
  22. scitex/cli/plt.py +357 -0
  23. scitex/cli/repro.py +15 -8
  24. scitex/cli/resource.py +15 -8
  25. scitex/cli/scholar/__init__.py +15 -8
  26. scitex/cli/social.py +6 -6
  27. scitex/cli/stats.py +15 -8
  28. scitex/cli/template.py +129 -12
  29. scitex/cli/tex.py +15 -8
  30. scitex/cli/writer.py +15 -8
  31. scitex/cloud/__init__.py +41 -2
  32. scitex/config/_env_registry.py +84 -19
  33. scitex/context/__init__.py +22 -0
  34. scitex/dev/__init__.py +20 -1
  35. scitex/gen/__init__.py +50 -14
  36. scitex/gen/_list_packages.py +4 -4
  37. scitex/introspect/__init__.py +16 -9
  38. scitex/introspect/_core.py +7 -8
  39. scitex/{gen/_inspect_module.py → introspect/_list_api.py} +43 -54
  40. scitex/introspect/_mcp/__init__.py +10 -6
  41. scitex/introspect/_mcp/handlers.py +37 -12
  42. scitex/introspect/_members.py +7 -3
  43. scitex/introspect/_signature.py +3 -3
  44. scitex/introspect/_source.py +2 -2
  45. scitex/io/_save.py +1 -2
  46. scitex/logging/_formatters.py +19 -9
  47. scitex/mcp_server.py +1 -1
  48. scitex/os/__init__.py +4 -0
  49. scitex/{gen → os}/_check_host.py +4 -5
  50. scitex/plt/__init__.py +11 -14
  51. scitex/session/__init__.py +26 -7
  52. scitex/session/_decorator.py +1 -1
  53. scitex/sh/__init__.py +7 -4
  54. scitex/social/__init__.py +10 -8
  55. scitex/stats/_mcp/_handlers/__init__.py +31 -0
  56. scitex/stats/_mcp/_handlers/_corrections.py +113 -0
  57. scitex/stats/_mcp/_handlers/_descriptive.py +78 -0
  58. scitex/stats/_mcp/_handlers/_effect_size.py +106 -0
  59. scitex/stats/_mcp/_handlers/_format.py +94 -0
  60. scitex/stats/_mcp/_handlers/_normality.py +110 -0
  61. scitex/stats/_mcp/_handlers/_posthoc.py +224 -0
  62. scitex/stats/_mcp/_handlers/_power.py +247 -0
  63. scitex/stats/_mcp/_handlers/_recommend.py +102 -0
  64. scitex/stats/_mcp/_handlers/_run_test.py +279 -0
  65. scitex/stats/_mcp/_handlers/_stars.py +48 -0
  66. scitex/stats/_mcp/handlers.py +19 -1171
  67. scitex/stats/auto/_stat_style.py +175 -0
  68. scitex/stats/auto/_style_definitions.py +411 -0
  69. scitex/stats/auto/_styles.py +22 -620
  70. scitex/stats/descriptive/__init__.py +11 -8
  71. scitex/stats/descriptive/_ci.py +39 -0
  72. scitex/stats/power/_power.py +15 -4
  73. scitex/str/__init__.py +2 -1
  74. scitex/str/_title_case.py +63 -0
  75. scitex/template/__init__.py +25 -10
  76. scitex/template/_code_templates.py +147 -0
  77. scitex/template/_mcp/handlers.py +81 -0
  78. scitex/template/_mcp/tool_schemas.py +55 -0
  79. scitex/template/_templates/__init__.py +51 -0
  80. scitex/template/_templates/audio.py +233 -0
  81. scitex/template/_templates/canvas.py +312 -0
  82. scitex/template/_templates/capture.py +268 -0
  83. scitex/template/_templates/config.py +43 -0
  84. scitex/template/_templates/diagram.py +294 -0
  85. scitex/template/_templates/io.py +107 -0
  86. scitex/template/_templates/module.py +53 -0
  87. scitex/template/_templates/plt.py +202 -0
  88. scitex/template/_templates/scholar.py +267 -0
  89. scitex/template/_templates/session.py +130 -0
  90. scitex/template/_templates/session_minimal.py +43 -0
  91. scitex/template/_templates/session_plot.py +67 -0
  92. scitex/template/_templates/session_stats.py +77 -0
  93. scitex/template/_templates/stats.py +323 -0
  94. scitex/template/_templates/writer.py +296 -0
  95. scitex/ui/_backends/_email.py +10 -2
  96. scitex/ui/_backends/_webhook.py +5 -1
  97. scitex/web/_search_pubmed.py +10 -6
  98. {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/METADATA +1 -1
  99. {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/RECORD +105 -64
  100. scitex/gen/_ci.py +0 -12
  101. scitex/gen/_title_case.py +0 -89
  102. /scitex/{gen → context}/_detect_environment.py +0 -0
  103. /scitex/{gen → context}/_get_notebook_path.py +0 -0
  104. /scitex/{gen/_shell.py → sh/_shell_legacy.py} +0 -0
  105. {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/WHEEL +0 -0
  106. {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/entry_points.txt +0 -0
  107. {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/licenses/LICENSE +0 -0
scitex/__init__.py CHANGED
@@ -29,19 +29,9 @@ warnings.filterwarnings("default", category=DeprecationWarning, module="scitex.*
29
29
  # Version
30
30
  from .__version__ import __version__
31
31
 
32
- # Installation guide - show users what modules are available
33
- from ._install_guide import show_install_guide
34
-
35
-
36
- # Sentinel object for decorator-injected parameters
37
- class _InjectedSentinel:
38
- """Sentinel value indicating a parameter will be injected by a decorator"""
39
-
40
- def __repr__(self):
41
- return "<INJECTED>"
42
-
43
-
44
- INJECTED = _InjectedSentinel()
32
+ # BACKWARD COMPATIBILITY: Deprecated items accessible via __getattr__
33
+ # These are handled at the end of this file after lazy modules are defined
34
+ _DEPRECATED_ATTRS = {"INJECTED", "show_install_guide", "Diagram"}
45
35
 
46
36
 
47
37
  # Lazy loading for all modules
@@ -198,47 +188,53 @@ msword = _LazyModule("msword")
198
188
  fts = _LazyModule("fts") # Bundle schemas module
199
189
  social = _LazyModule("social") # Social media integration (socialia wrapper)
200
190
  diagram = _LazyModule("diagram") # Diagram creation (delegates to figrecipe)
201
-
202
-
203
- # Lazy Diagram class - delegates to figrecipe.Diagram
204
- class _LazyDiagram:
205
- """Lazy loader for Diagram class from figrecipe."""
206
-
207
- _class = None
208
-
209
- def __new__(cls, *args, **kwargs):
210
- if cls._class is None:
211
- try:
212
- from figrecipe import Diagram as _FigrecipeDiagram
213
-
214
- cls._class = _FigrecipeDiagram
215
- except ImportError:
216
- # Fallback to scitex's own implementation if figrecipe not available
217
- from scitex.diagram._diagram import Diagram as _ScitexDiagram
218
-
219
- cls._class = _ScitexDiagram
220
- return cls._class(*args, **kwargs)
221
-
222
- @classmethod
223
- def from_yaml(cls, *args, **kwargs):
224
- if cls._class is None:
225
- cls.__new__(cls) # Trigger lazy load
226
- return cls._class.from_yaml(*args, **kwargs)
227
-
228
- @classmethod
229
- def from_mermaid(cls, *args, **kwargs):
230
- if cls._class is None:
231
- cls.__new__(cls) # Trigger lazy load
232
- return cls._class.from_mermaid(*args, **kwargs)
233
-
234
- @classmethod
235
- def from_dict(cls, *args, **kwargs):
236
- if cls._class is None:
237
- cls.__new__(cls) # Trigger lazy load
238
- return cls._class.from_dict(*args, **kwargs)
239
-
240
-
241
- Diagram = _LazyDiagram
191
+ introspect = _LazyModule("introspect") # Python introspection utilities
192
+ sh = _LazyModule("sh") # Shell command execution
193
+ os = _LazyModule("os") # OS utilities (file operations)
194
+ cv = _LazyModule("cv") # Computer vision utilities
195
+ ui = _LazyModule("ui") # User interface utilities
196
+ git = _LazyModule("git") # Git operations
197
+ schema = _LazyModule("schema") # Data schema utilities
198
+ canvas = _LazyModule("canvas") # Canvas utilities for figure composition
199
+ security = _LazyModule("security") # Security utilities
200
+ benchmark = _LazyModule("benchmark") # Benchmarking utilities
201
+ bridge = _LazyModule("bridge") # Bridge utilities
202
+ browser = _LazyModule("browser") # Browser automation
203
+ compat = _LazyModule("compat") # Compatibility utilities
204
+ cli = _LazyModule("cli") # Command-line interface
205
+
206
+
207
+ # BACKWARD COMPATIBILITY: Module-level __getattr__ for deprecated attributes
208
+ def __getattr__(name):
209
+ """Handle deprecated attributes with warnings."""
210
+ if name == "INJECTED":
211
+ warnings.warn(
212
+ "scitex.INJECTED is deprecated, use scitex.session.INJECTED instead",
213
+ DeprecationWarning,
214
+ stacklevel=2,
215
+ )
216
+ from .session import INJECTED
217
+
218
+ return INJECTED
219
+ if name == "show_install_guide":
220
+ warnings.warn(
221
+ "scitex.show_install_guide() is deprecated, use scitex.dev.show_install_guide() instead",
222
+ DeprecationWarning,
223
+ stacklevel=2,
224
+ )
225
+ from .dev import show_install_guide
226
+
227
+ return show_install_guide
228
+ if name == "Diagram":
229
+ warnings.warn(
230
+ "scitex.Diagram is deprecated, use scitex.diagram.Diagram instead",
231
+ DeprecationWarning,
232
+ stacklevel=2,
233
+ )
234
+ from .diagram import Diagram
235
+
236
+ return Diagram
237
+ raise AttributeError(f"module 'scitex' has no attribute '{name}'")
242
238
 
243
239
 
244
240
  # Centralized path configuration - eager loaded for convenience
@@ -257,6 +253,7 @@ if _os.environ.get("SCITEX_CLOUD_CODE_WORKSPACE") == "true":
257
253
  pass # Silently fail if matplotlib not available
258
254
 
259
255
  __all__ = [
256
+ # Core modules
260
257
  "io",
261
258
  "gen",
262
259
  "plt",
@@ -268,7 +265,6 @@ __all__ = [
268
265
  "path",
269
266
  "dict",
270
267
  "decorators",
271
- "__version__",
272
268
  "sh",
273
269
  "errors",
274
270
  "units",
@@ -292,7 +288,7 @@ __all__ = [
292
288
  "linalg",
293
289
  "parallel",
294
290
  "datetime",
295
- "dt", # Alias for datetime (shorter name)
291
+ "dt",
296
292
  "types",
297
293
  "utils",
298
294
  "etc",
@@ -304,12 +300,23 @@ __all__ = [
304
300
  "audio",
305
301
  "msword",
306
302
  "fts",
307
- "fsb", # Legacy alias
308
- "social", # Social media integration
309
- "diagram", # Diagram module (delegates to figrecipe)
310
- "Diagram", # Diagram class (from figrecipe)
303
+ "social",
304
+ "diagram",
305
+ "introspect",
306
+ "os",
307
+ "cv",
308
+ "ui",
309
+ "git",
310
+ "schema",
311
+ "canvas",
312
+ "security",
313
+ "benchmark",
314
+ "bridge",
315
+ "browser",
316
+ "compat",
317
+ "cli",
311
318
  "PATHS",
312
- "INJECTED",
319
+ "__version__",
313
320
  ]
314
321
 
315
322
  # EOF
@@ -16,17 +16,18 @@ def _json(data: dict) -> str:
16
16
 
17
17
  def register_introspect_tools(mcp) -> None:
18
18
  """Register introspection tools with FastMCP server."""
19
+ # IPython-style tools (primary)
19
20
 
20
21
  @mcp.tool()
21
- async def introspect_signature(
22
+ async def introspect_q(
22
23
  dotted_path: str,
23
24
  include_defaults: bool = True,
24
25
  include_annotations: bool = True,
25
26
  ) -> str:
26
27
  """[introspect] Get function/class signature (like IPython's func?)."""
27
- from scitex.introspect._mcp.handlers import signature_handler
28
+ from scitex.introspect._mcp.handlers import q_handler
28
29
 
29
- result = await signature_handler(
30
+ result = await q_handler(
30
31
  dotted_path=dotted_path,
31
32
  include_defaults=include_defaults,
32
33
  include_annotations=include_annotations,
@@ -34,29 +35,15 @@ def register_introspect_tools(mcp) -> None:
34
35
  return _json(result)
35
36
 
36
37
  @mcp.tool()
37
- async def introspect_docstring(
38
- dotted_path: str,
39
- format: str = "raw",
40
- ) -> str:
41
- """[introspect] Get docstring of a Python object. format: raw|parsed|summary."""
42
- from scitex.introspect._mcp.handlers import docstring_handler
43
-
44
- result = await docstring_handler(
45
- dotted_path=dotted_path,
46
- format=format,
47
- )
48
- return _json(result)
49
-
50
- @mcp.tool()
51
- async def introspect_source(
38
+ async def introspect_qq(
52
39
  dotted_path: str,
53
40
  max_lines: Optional[int] = None,
54
41
  include_decorators: bool = True,
55
42
  ) -> str:
56
43
  """[introspect] Get source code of a Python object (like IPython's func??)."""
57
- from scitex.introspect._mcp.handlers import source_handler
44
+ from scitex.introspect._mcp.handlers import qq_handler
58
45
 
59
- result = await source_handler(
46
+ result = await qq_handler(
60
47
  dotted_path=dotted_path,
61
48
  max_lines=max_lines,
62
49
  include_decorators=include_decorators,
@@ -64,16 +51,16 @@ def register_introspect_tools(mcp) -> None:
64
51
  return _json(result)
65
52
 
66
53
  @mcp.tool()
67
- async def introspect_members(
54
+ async def introspect_dir(
68
55
  dotted_path: str,
69
56
  filter: str = "public",
70
57
  kind: Optional[str] = None,
71
58
  include_inherited: bool = False,
72
59
  ) -> str:
73
60
  """[introspect] List members of module/class (like dir()). filter: all|public|private|dunder."""
74
- from scitex.introspect._mcp.handlers import members_handler
61
+ from scitex.introspect._mcp.handlers import dir_handler
75
62
 
76
- result = await members_handler(
63
+ result = await dir_handler(
77
64
  dotted_path=dotted_path,
78
65
  filter=filter,
79
66
  kind=kind,
@@ -81,6 +68,38 @@ def register_introspect_tools(mcp) -> None:
81
68
  )
82
69
  return _json(result)
83
70
 
71
+ @mcp.tool()
72
+ async def introspect_api(
73
+ dotted_path: str,
74
+ max_depth: int = 5,
75
+ docstring: bool = False,
76
+ root_only: bool = False,
77
+ ) -> str:
78
+ """[introspect] List the API tree of a module recursively."""
79
+ from scitex.introspect._mcp.handlers import list_api_handler
80
+
81
+ result = await list_api_handler(
82
+ dotted_path=dotted_path,
83
+ max_depth=max_depth,
84
+ docstring=docstring,
85
+ root_only=root_only,
86
+ )
87
+ return _json(result)
88
+
89
+ @mcp.tool()
90
+ async def introspect_docstring(
91
+ dotted_path: str,
92
+ format: str = "raw",
93
+ ) -> str:
94
+ """[introspect] Get docstring of a Python object. format: raw|parsed|summary."""
95
+ from scitex.introspect._mcp.handlers import docstring_handler
96
+
97
+ result = await docstring_handler(
98
+ dotted_path=dotted_path,
99
+ format=format,
100
+ )
101
+ return _json(result)
102
+
84
103
  @mcp.tool()
85
104
  async def introspect_exports(dotted_path: str) -> str:
86
105
  """[introspect] Get __all__ exports of a module."""
@@ -62,5 +62,29 @@ def register_template_tools(mcp) -> None:
62
62
  result = await list_git_strategies_handler()
63
63
  return _json(result)
64
64
 
65
+ @mcp.tool()
66
+ async def template_get_code_template(
67
+ template_id: str,
68
+ filepath: Optional[str] = None,
69
+ docstring: Optional[str] = None,
70
+ ) -> str:
71
+ """[template] Get a code template for scripts and modules. Core: session, io, config. Module usage: plt, stats, scholar, audio, capture, diagram, canvas, writer. Use 'all' for all templates combined."""
72
+ from scitex.template._mcp.handlers import get_code_template_handler
73
+
74
+ result = await get_code_template_handler(
75
+ template_id=template_id,
76
+ filepath=filepath,
77
+ docstring=docstring,
78
+ )
79
+ return _json(result)
80
+
81
+ @mcp.tool()
82
+ async def template_list_code_templates() -> str:
83
+ """[template] List all available code templates for scripts and modules."""
84
+ from scitex.template._mcp.handlers import list_code_templates_handler
85
+
86
+ result = await list_code_templates_handler()
87
+ return _json(result)
88
+
65
89
 
66
90
  # EOF