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
@@ -0,0 +1,296 @@
1
+ #!/usr/bin/env python3
2
+ # Timestamp: 2026-01-25
3
+ # File: src/scitex/template/_templates/writer.py
4
+ # ----------------------------------------
5
+
6
+ """Template for stx.writer LaTeX manuscript compilation module usage."""
7
+
8
+ TEMPLATE = {
9
+ "name": "Writer Module",
10
+ "description": "stx.writer usage for LaTeX manuscript compilation and paper writing",
11
+ "filename": "writer_script.py",
12
+ "priority": 9,
13
+ "content": '''#!/usr/bin/env python3
14
+ # -*- coding: utf-8 -*-
15
+ # Timestamp: {timestamp}
16
+ # File: {filepath}
17
+
18
+ """
19
+ stx.writer - LaTeX Manuscript Compilation
20
+ =========================================
21
+
22
+ stx.writer provides:
23
+ - LaTeX to PDF compilation
24
+ - BibTeX bibliography processing
25
+ - Figure and table management
26
+ - Word count and statistics
27
+ - Manuscript structure scaffolding
28
+
29
+ Usage Patterns
30
+ --------------
31
+ 1. CLI: scitex writer <command> [options]
32
+ 2. MCP: writer_usage tool for documentation
33
+ 3. Python API: stx.writer.* functions
34
+
35
+ Typical Workflow
36
+ ----------------
37
+ 1. Clone paper template: scitex template clone paper ./manuscript
38
+ 2. Write manuscript: Edit .tex files
39
+ 3. Compile: scitex writer compile ./manuscript
40
+ 4. Check: scitex writer wordcount ./manuscript
41
+ """
42
+
43
+ import scitex as stx
44
+
45
+ # ============================================================
46
+ # Pattern 1: CLI Usage (Recommended)
47
+ # ============================================================
48
+
49
+ """
50
+ CLI Commands:
51
+ -------------
52
+
53
+ # Compile manuscript to PDF
54
+ scitex writer compile ./manuscript
55
+ scitex writer compile ./manuscript --output paper.pdf
56
+
57
+ # Compile with bibliography
58
+ scitex writer compile ./manuscript --bib
59
+
60
+ # Clean auxiliary files
61
+ scitex writer clean ./manuscript
62
+
63
+ # Word count
64
+ scitex writer wordcount ./manuscript
65
+
66
+ # Check for common LaTeX errors
67
+ scitex writer check ./manuscript
68
+
69
+ # Watch for changes and auto-compile
70
+ scitex writer watch ./manuscript
71
+ """
72
+
73
+ # ============================================================
74
+ # Pattern 2: Project Structure
75
+ # ============================================================
76
+
77
+ """
78
+ Recommended Manuscript Structure:
79
+ ---------------------------------
80
+
81
+ manuscript/
82
+ main.tex # Main document
83
+ sections/
84
+ abstract.tex # Abstract
85
+ introduction.tex # Introduction
86
+ methods.tex # Methods
87
+ results.tex # Results
88
+ discussion.tex # Discussion
89
+ references.tex # References section
90
+ figures/
91
+ fig1.png # Figure files
92
+ fig2.pdf
93
+ tables/
94
+ table1.tex # LaTeX tables
95
+ references.bib # BibTeX bibliography
96
+ config/
97
+ preamble.tex # Custom packages/macros
98
+
99
+ Create this structure with:
100
+ scitex template clone paper ./manuscript
101
+ """
102
+
103
+ # ============================================================
104
+ # Pattern 3: LaTeX Best Practices
105
+ # ============================================================
106
+
107
+ """
108
+ LaTeX Writing Guidelines:
109
+ -------------------------
110
+
111
+ 1. Document Structure:
112
+ \\\\documentclass[article]
113
+ \\\\input[config/preamble]
114
+ \\\\begin[document]
115
+ \\\\input[sections/abstract]
116
+ \\\\input[sections/introduction]
117
+ \\\\input[sections/methods]
118
+ \\\\input[sections/results]
119
+ \\\\input[sections/discussion]
120
+ \\\\bibliography[references]
121
+ \\\\end[document]
122
+
123
+ 2. Figure Inclusion:
124
+ \\\\begin[figure][htbp]
125
+ \\\\centering
126
+ \\\\includegraphics[width=0.8\\\\linewidth][figures/fig1.png]
127
+ \\\\caption[Description of the figure.]
128
+ \\\\label[fig:main]
129
+ \\\\end[figure]
130
+
131
+ 3. Table Inclusion:
132
+ \\\\begin[table][htbp]
133
+ \\\\centering
134
+ \\\\caption[Description of the table.]
135
+ \\\\label[tab:results]
136
+ \\\\input[tables/table1]
137
+ \\\\end[table]
138
+
139
+ 4. Citations:
140
+ As shown in previous work~\\\\cite[author2023]...
141
+ Multiple citations~\\\\cite[ref1,ref2,ref3]...
142
+
143
+ 5. Cross-references:
144
+ See Figure~\\\\ref[fig:main]...
145
+ Table~\\\\ref[tab:results] shows...
146
+ Section~\\\\ref[sec:methods] describes...
147
+
148
+ Note: Replace [] with curly braces in actual LaTeX code.
149
+ """
150
+
151
+ # ============================================================
152
+ # Pattern 4: BibTeX Management
153
+ # ============================================================
154
+
155
+ """
156
+ BibTeX Best Practices:
157
+ ----------------------
158
+
159
+ # references.bib structure
160
+ @article key=author2023,
161
+ author = Smith, John and Doe, Jane,
162
+ title = Title of the Paper,
163
+ journal = Journal Name,
164
+ year = 2023,
165
+ volume = 10,
166
+ pages = 1--15,
167
+ doi = 10.1000/example
168
+
169
+
170
+ # Enrich with scitex scholar
171
+ scitex scholar enrich --bibtex references.bib
172
+
173
+ # This adds:
174
+ # - Missing DOIs
175
+ # - Abstracts
176
+ # - Citation counts
177
+ # - Impact factors
178
+ """
179
+
180
+ # ============================================================
181
+ # Pattern 5: Integration with SciTeX
182
+ # ============================================================
183
+
184
+ @stx.session
185
+ def main(
186
+ manuscript_dir="./manuscript",
187
+ CONFIG=stx.INJECTED,
188
+ logger=stx.INJECTED,
189
+ ):
190
+ """Manuscript preparation workflow."""
191
+ from pathlib import Path
192
+
193
+ ms_dir = Path(manuscript_dir)
194
+
195
+ # 1. Generate figures from analysis
196
+ logger.info("Generating figures...")
197
+ # (figures created with stx.plt would go in ms_dir/figures/)
198
+
199
+ # 2. Generate tables from data
200
+ logger.info("Generating tables...")
201
+ # (tables created with stx.io.save() in LaTeX format)
202
+
203
+ # 3. Copy to manuscript directory
204
+ import shutil
205
+ if (CONFIG.SDIR_OUT / "figures").exists():
206
+ for fig in (CONFIG.SDIR_OUT / "figures").glob("*.png"):
207
+ shutil.copy(fig, ms_dir / "figures" / fig.name)
208
+ logger.info("Copied figure to manuscript")
209
+
210
+ logger.info("Figures ready in manuscript/figures/")
211
+ return 0
212
+
213
+ # ============================================================
214
+ # Pattern 6: Python API
215
+ # ============================================================
216
+
217
+ def python_api_example():
218
+ """Direct Python API for writer."""
219
+ from scitex.writer import (
220
+ compile_manuscript,
221
+ clean_auxiliary,
222
+ word_count,
223
+ check_manuscript,
224
+ )
225
+
226
+ # Compile
227
+ result = compile_manuscript(
228
+ manuscript_dir="./manuscript",
229
+ output="paper.pdf",
230
+ bibliography=True
231
+ )
232
+ print("Compilation complete")
233
+
234
+ # Word count
235
+ stats = word_count("./manuscript")
236
+ print("Word count complete")
237
+
238
+ # Check for issues
239
+ issues = check_manuscript("./manuscript")
240
+ for issue in issues:
241
+ print("Warning found")
242
+
243
+ # Clean
244
+ clean_auxiliary("./manuscript")
245
+
246
+ # ============================================================
247
+ # Pattern 7: Automated Paper Generation
248
+ # ============================================================
249
+
250
+ """
251
+ Automated Workflow:
252
+ -------------------
253
+
254
+ 1. Run analysis scripts:
255
+ python scripts/analysis.py
256
+
257
+ 2. Figures auto-generated to:
258
+ script_out/FINISHED_SUCCESS/<session>/
259
+
260
+ 3. Copy figures to manuscript:
261
+ cp script_out/FINISHED_SUCCESS/*/figures/* manuscript/figures/
262
+
263
+ 4. Compile manuscript:
264
+ scitex writer compile ./manuscript
265
+
266
+ 5. Check word count:
267
+ scitex writer wordcount ./manuscript
268
+ """
269
+
270
+ # ============================================================
271
+ # MCP Tools Reference
272
+ # ============================================================
273
+
274
+ """
275
+ MCP Tools:
276
+ ----------
277
+
278
+ Documentation:
279
+ - writer_usage() # Get complete usage guide
280
+
281
+ Note: Most writer operations are done via CLI:
282
+ - scitex writer compile <dir>
283
+ - scitex writer clean <dir>
284
+ - scitex writer wordcount <dir>
285
+ - scitex writer check <dir>
286
+ - scitex writer watch <dir>
287
+ """
288
+
289
+ if __name__ == "__main__":
290
+ main()
291
+ ''',
292
+ }
293
+
294
+ __all__ = ["TEMPLATE"]
295
+
296
+ # EOF
@@ -24,8 +24,16 @@ class EmailBackend(BaseNotifyBackend):
24
24
  recipient: Optional[str] = None,
25
25
  sender: Optional[str] = None,
26
26
  ):
27
- self.recipient = recipient or os.getenv("SCITEX_NOTIFY_EMAIL_TO")
28
- self.sender = sender or os.getenv("SCITEX_NOTIFY_EMAIL_FROM")
27
+ self.recipient = (
28
+ recipient
29
+ or os.getenv("SCITEX_UI_EMAIL_NOTIFICATION_TO")
30
+ or os.getenv("SCITEX_NOTIFY_EMAIL_TO")
31
+ )
32
+ self.sender = (
33
+ sender
34
+ or os.getenv("SCITEX_UI_EMAIL_NOTIFICATION_FROM")
35
+ or os.getenv("SCITEX_NOTIFY_EMAIL_FROM")
36
+ )
29
37
 
30
38
  def is_available(self) -> bool:
31
39
  return bool(
@@ -22,7 +22,11 @@ class WebhookBackend(BaseNotifyBackend):
22
22
  name = "webhook"
23
23
 
24
24
  def __init__(self, url: Optional[str] = None):
25
- self.url = url or os.getenv("SCITEX_NOTIFY_WEBHOOK_URL")
25
+ self.url = (
26
+ url
27
+ or os.getenv("SCITEX_UI_WEBHOOK_URL")
28
+ or os.getenv("SCITEX_NOTIFY_WEBHOOK_URL")
29
+ )
26
30
 
27
31
  def is_available(self) -> bool:
28
32
  return bool(self.url)
@@ -179,9 +179,11 @@ def get_crossref_metrics(
179
179
 
180
180
  # Use provided email or fallback to environment variables
181
181
  if not email:
182
- email = os.getenv(
183
- "SCITEX_CROSSREF_EMAIL",
184
- os.getenv("SCITEX_PUBMED_EMAIL", "research@example.com"),
182
+ email = (
183
+ os.getenv("SCITEX_SCHOLAR_CROSSREF_EMAIL")
184
+ or os.getenv("SCITEX_CROSSREF_EMAIL")
185
+ or os.getenv("SCITEX_SCHOLAR_PUBMED_EMAIL")
186
+ or os.getenv("SCITEX_PUBMED_EMAIL", "research@example.com")
185
187
  )
186
188
  headers = {"User-Agent": f"SciTeX/1.0 (mailto:{email})"}
187
189
 
@@ -218,9 +220,11 @@ async def get_crossref_metrics_async(
218
220
 
219
221
  # Use provided email or fallback to environment variables
220
222
  if not email:
221
- email = os.getenv(
222
- "SCITEX_CROSSREF_EMAIL",
223
- os.getenv("SCITEX_PUBMED_EMAIL", "research@example.com"),
223
+ email = (
224
+ os.getenv("SCITEX_SCHOLAR_CROSSREF_EMAIL")
225
+ or os.getenv("SCITEX_CROSSREF_EMAIL")
226
+ or os.getenv("SCITEX_SCHOLAR_PUBMED_EMAIL")
227
+ or os.getenv("SCITEX_PUBMED_EMAIL", "research@example.com")
224
228
  )
225
229
  headers = {"User-Agent": f"SciTeX/1.0 (mailto:{email})"}
226
230
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: scitex
3
- Version: 2.15.1
3
+ Version: 2.15.2
4
4
  Summary: A comprehensive Python library for scientific computing and data analysis
5
5
  Project-URL: Homepage, https://github.com/ywatanabe1989/scitex-python
6
6
  Project-URL: Documentation, https://scitex.readthedocs.io