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
scitex/cli/writer.py CHANGED
@@ -1,329 +1,79 @@
1
1
  #!/usr/bin/env python3
2
2
  """
3
- SciTeX Writer Commands - LaTeX Manuscript Management
3
+ SciTeX Writer CLI - Thin wrapper delegating to scitex-writer package.
4
4
 
5
- Provides manuscript project initialization and compilation.
5
+ All commands are delegated to scitex-writer CLI for maintainability.
6
6
  """
7
7
 
8
+ import subprocess
8
9
  import sys
9
- from pathlib import Path
10
10
 
11
11
  import click
12
12
 
13
+ # Check if scitex-writer package is available
14
+ try:
15
+ import scitex_writer
13
16
 
14
- @click.group(context_settings={"help_option_names": ["-h", "--help"]})
15
- def writer():
16
- """
17
- Manuscript writing and LaTeX compilation
18
-
19
- \b
20
- Provides manuscript project management:
21
- - Initialize new manuscript projects
22
- - Compile manuscript, supplementary, and revision documents
23
- - Watch mode for auto-recompilation
24
- - Project structure management
25
- """
26
- pass
27
-
28
-
29
- @writer.command("help-recursive")
30
- @click.pass_context
31
- def help_recursive(ctx):
32
- """Show help for all commands recursively."""
33
- fake_parent = click.Context(click.Group(), info_name="scitex")
34
- parent_ctx = click.Context(writer, info_name="writer", parent=fake_parent)
35
-
36
- click.secho("━━━ scitex writer ━━━", fg="cyan", bold=True)
37
- click.echo(writer.get_help(parent_ctx))
38
-
39
- for name in sorted(writer.list_commands(ctx) or []):
40
- cmd = writer.get_command(ctx, name)
41
- if cmd is None or name == "help-recursive":
42
- continue
43
- click.echo()
44
- click.secho(f"━━━ scitex writer {name} ━━━", fg="cyan", bold=True)
45
- with click.Context(cmd, info_name=name, parent=parent_ctx) as sub_ctx:
46
- click.echo(cmd.get_help(sub_ctx))
47
-
48
-
49
- @writer.command()
50
- @click.argument("project_dir", type=click.Path())
51
- @click.option(
52
- "--git-strategy",
53
- "-g",
54
- type=click.Choice(["child", "parent", "origin", "none"], case_sensitive=False),
55
- default="child",
56
- help="Git initialization strategy (default: child)",
57
- )
58
- @click.option("--branch", "-b", help="Specific branch of template to clone")
59
- @click.option("--tag", "-t", help="Specific tag/release of template to clone")
60
- def clone(project_dir, git_strategy, branch, tag):
61
- """
62
- Clone a new writer project from template
63
-
64
- \b
65
- Arguments:
66
- PROJECT_DIR Path to project directory (will be created)
67
-
68
- \b
69
- Git Strategies:
70
- child - Create isolated git in project directory (default)
71
- parent - Use parent git repository
72
- origin - Preserve template's original git history
73
- none - Disable git initialization
17
+ HAS_WRITER_PKG = True
18
+ except ImportError:
19
+ HAS_WRITER_PKG = False
74
20
 
75
- \b
76
- Examples:
77
- scitex writer clone my_paper
78
- scitex writer clone ./papers/my_paper
79
- scitex writer clone my_paper --git-strategy parent
80
- scitex writer clone my_paper --branch develop
81
- scitex writer clone my_paper --tag v1.0.0
82
- """
83
- try:
84
- from scitex.writer._clone_writer_project import clone_writer_project
85
-
86
- # Validate mutual exclusivity of branch and tag
87
- if branch and tag:
88
- click.echo("Error: Cannot specify both --branch and --tag", err=True)
89
- sys.exit(1)
90
-
91
- # Convert git_strategy 'none' to None
92
- if git_strategy and git_strategy.lower() == "none":
93
- git_strategy = None
94
21
 
95
- click.echo(f"Cloning writer project: {project_dir}")
96
-
97
- # Clone writer project
98
- result = clone_writer_project(
99
- project_dir=project_dir,
100
- git_strategy=git_strategy,
101
- branch=branch,
102
- tag=tag,
22
+ def _require_writer_pkg():
23
+ """Check if scitex-writer package is available."""
24
+ if not HAS_WRITER_PKG:
25
+ click.secho(
26
+ "scitex-writer package not installed. "
27
+ "Install with: pip install scitex-writer",
28
+ fg="red",
29
+ err=True,
103
30
  )
104
-
105
- if result:
106
- project_path = Path(project_dir)
107
- click.echo()
108
- click.secho(
109
- f"✓ Successfully cloned project at {project_path.absolute()}",
110
- fg="green",
111
- )
112
- click.echo()
113
- click.echo("Project structure:")
114
- click.echo(f" {project_dir}/")
115
- click.echo(
116
- " ├── 00_shared/ # Shared resources (figures, bibliography)"
117
- )
118
- click.echo(" ├── 01_manuscript/ # Main manuscript")
119
- click.echo(" ├── 02_supplementary/ # Supplementary materials")
120
- click.echo(" ├── 03_revision/ # Revision documents")
121
- click.echo(" └── scripts/ # Compilation scripts")
122
- click.echo()
123
- click.echo("Next steps:")
124
- click.echo(f" cd {project_dir}")
125
- click.echo(" # Edit your manuscript in 01_manuscript/contents/")
126
- click.echo(" scitex writer compile manuscript")
127
- else:
128
- click.secho("✗ Failed to clone project", fg="red", err=True)
129
- sys.exit(1)
130
-
131
- except Exception as e:
132
- click.secho(f"Error: {e}", fg="red", err=True)
133
31
  sys.exit(1)
134
32
 
135
33
 
136
- @writer.command()
137
- @click.argument(
138
- "document",
139
- type=click.Choice(
140
- ["manuscript", "supplementary", "revision"], case_sensitive=False
141
- ),
142
- default="manuscript",
143
- )
144
- @click.option(
145
- "--dir",
146
- "-d",
147
- type=click.Path(exists=True),
148
- help="Project directory (defaults to current directory)",
34
+ @click.command(
35
+ context_settings={
36
+ "help_option_names": ["-h", "--help"],
37
+ "ignore_unknown_options": True,
38
+ "allow_extra_args": True,
39
+ "allow_interspersed_args": False,
40
+ },
149
41
  )
150
- @click.option(
151
- "--track-changes", is_flag=True, help="Enable change tracking (revision only)"
152
- )
153
- @click.option(
154
- "--timeout",
155
- type=int,
156
- default=300,
157
- help="Compilation timeout in seconds (default: 300)",
158
- )
159
- def compile(document, dir, track_changes, timeout):
42
+ @click.argument("args", nargs=-1, type=click.UNPROCESSED)
43
+ @click.pass_context
44
+ def writer(ctx, args):
160
45
  """
161
- Compile LaTeX document to PDF
46
+ Manuscript writing and LaTeX compilation (delegates to scitex-writer)
162
47
 
163
48
  \b
164
- Arguments:
165
- DOCUMENT Document type to compile (manuscript|supplementary|revision)
49
+ Commands (from scitex-writer):
50
+ compile Compile LaTeX to PDF
51
+ bib Bibliography management
52
+ tables Table management
53
+ figures Figure management
54
+ guidelines IMRAD writing guidelines
55
+ prompts AI prompts (Asta integration)
56
+ mcp MCP server commands
166
57
 
167
58
  \b
168
59
  Examples:
169
- scitex writer compile manuscript
170
- scitex writer compile manuscript --dir ./my_paper
171
- scitex writer compile revision --track-changes
172
- scitex writer compile supplementary --timeout 600
173
- """
174
- from scitex.writer import Writer
175
-
176
- project_dir = Path(dir) if dir else Path.cwd()
177
-
178
- # Check if this is a Writer project before trying to attach
179
- required_dirs = ["01_manuscript", "02_supplementary", "03_revision"]
180
- missing = [d for d in required_dirs if not (project_dir / d).exists()]
181
-
182
- if missing:
183
- click.echo(f"Not a Writer project: {project_dir.absolute()}")
184
- click.echo(f"Missing directories: {', '.join(missing)}")
185
- click.echo()
186
- click.echo("To create a new project, run:")
187
- click.echo(" scitex writer clone <project-name>")
188
- return # Exit gracefully with code 0
189
-
190
- try:
191
- writer = Writer(project_dir)
192
-
193
- click.echo(f"Compiling {document} in {project_dir}...")
194
- click.echo()
195
-
196
- # Compile based on document type
197
- if document == "manuscript":
198
- result = writer.compile_manuscript(timeout=timeout)
199
- elif document == "supplementary":
200
- result = writer.compile_supplementary(timeout=timeout)
201
- elif document == "revision":
202
- result = writer.compile_revision(
203
- track_changes=track_changes, timeout=timeout
204
- )
205
-
206
- if result.success:
207
- click.secho("✓ Compilation successful!", fg="green")
208
- click.echo(f"PDF: {result.output_pdf}")
209
- else:
210
- click.secho(
211
- f"✗ Compilation failed (exit code {result.exit_code})",
212
- fg="red",
213
- err=True,
214
- )
215
- if result.errors:
216
- click.echo()
217
- click.echo("Errors:")
218
- for error in result.errors[:10]: # Show first 10 errors
219
- click.echo(f" - {error}")
220
- sys.exit(result.exit_code)
221
-
222
- except Exception as e:
223
- click.secho(f"Error: {e}", fg="red", err=True)
224
- sys.exit(1)
225
-
226
-
227
- @writer.command()
228
- @click.option(
229
- "--dir",
230
- "-d",
231
- type=click.Path(exists=True),
232
- help="Project directory (defaults to current directory)",
233
- )
234
- def info(dir):
235
- """
236
- Show project information
60
+ scitex writer compile manuscript ./my-paper
61
+ scitex writer bib list ./my-paper
62
+ scitex writer tables add ./my-paper data.csv
63
+ scitex writer figures list ./my-paper
64
+ scitex writer guidelines get abstract
65
+ scitex writer prompts asta ./my-paper --section introduction
237
66
 
238
67
  \b
239
- Examples:
240
- scitex writer info
241
- scitex writer info --dir ./my_paper
68
+ For full help:
69
+ scitex writer --help
70
+ scitex-writer --help
242
71
  """
243
- from scitex.writer import Writer
244
-
245
- project_dir = Path(dir) if dir else Path.cwd()
246
-
247
- # Check if this is a Writer project before trying to attach
248
- required_dirs = ["01_manuscript", "02_supplementary", "03_revision"]
249
- missing = [d for d in required_dirs if not (project_dir / d).exists()]
250
-
251
- if missing:
252
- click.echo(f"Not a Writer project: {project_dir.absolute()}")
253
- click.echo(f"Missing directories: {', '.join(missing)}")
254
- return # Exit gracefully with code 0
72
+ _require_writer_pkg()
255
73
 
256
- try:
257
- writer = Writer(project_dir)
258
-
259
- click.echo(f"Project: {writer.project_name}")
260
- click.echo(f"Location: {writer.project_dir.absolute()}")
261
- click.echo(f"Git root: {writer.git_root}")
262
- click.echo()
263
- click.echo("Documents:")
264
- click.echo(f" - Manuscript: {writer.manuscript.root}")
265
- click.echo(f" - Supplementary: {writer.supplementary.root}")
266
- click.echo(f" - Revision: {writer.revision.root}")
267
- click.echo()
268
-
269
- # Check for compiled PDFs
270
- click.echo("Compiled PDFs:")
271
- for doc_type in ["manuscript", "supplementary", "revision"]:
272
- pdf = writer.get_pdf(doc_type)
273
- if pdf:
274
- click.secho(f" ✓ {doc_type}: {pdf}", fg="green")
275
- else:
276
- click.echo(f" - {doc_type}: not compiled")
277
-
278
- except Exception as e:
279
- click.secho(f"Error: {e}", fg="red", err=True)
280
- sys.exit(1)
281
-
282
-
283
- @writer.command()
284
- @click.option(
285
- "--dir",
286
- "-d",
287
- type=click.Path(exists=True),
288
- help="Project directory (defaults to current directory)",
289
- )
290
- def watch(dir):
291
- """
292
- Watch for file changes and auto-recompile
293
-
294
- \b
295
- Examples:
296
- scitex writer watch
297
- scitex writer watch --dir ./my_paper
298
- """
299
- from scitex.writer import Writer
300
-
301
- project_dir = Path(dir) if dir else Path.cwd()
302
-
303
- # Check if this is a Writer project before trying to attach
304
- required_dirs = ["01_manuscript", "02_supplementary", "03_revision"]
305
- missing = [d for d in required_dirs if not (project_dir / d).exists()]
306
-
307
- if missing:
308
- click.echo(f"Not a Writer project: {project_dir.absolute()}")
309
- click.echo(f"Missing directories: {', '.join(missing)}")
310
- return # Exit gracefully with code 0
311
-
312
- try:
313
- writer = Writer(project_dir)
314
-
315
- click.echo(f"Watching {project_dir} for changes...")
316
- click.echo("Press Ctrl+C to stop")
317
- click.echo()
318
-
319
- writer.watch()
320
-
321
- except KeyboardInterrupt:
322
- click.echo()
323
- click.echo("Stopped watching")
324
- except Exception as e:
325
- click.secho(f"Error: {e}", fg="red", err=True)
326
- sys.exit(1)
74
+ # Delegate to scitex-writer CLI
75
+ cmd = ["scitex-writer"] + list(args)
76
+ sys.exit(subprocess.call(cmd))
327
77
 
328
78
 
329
79
  # EOF
scitex/cloud/__init__.py CHANGED
@@ -1,14 +1,44 @@
1
1
  #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
2
  # SciTeX Cloud Integration Module
4
3
  # Provides cloud-specific functionality for SciTeX running in SciTeX Cloud
4
+ #
5
+ # This module wraps the scitex-cloud package (if installed) and provides
6
+ # additional cloud environment utilities.
5
7
 
8
+ import base64
6
9
  import os
7
10
  import sys
8
- import base64
9
11
  from pathlib import Path
10
12
  from typing import Optional
11
13
 
14
+ # ============================================================================
15
+ # Optional scitex-cloud package integration
16
+ # Pattern: scitex-cloud → scitex.cloud (like figrecipe → scitex.plt)
17
+ # ============================================================================
18
+ try:
19
+ from scitex_cloud import (
20
+ DockerManager,
21
+ Environment,
22
+ get_environment,
23
+ )
24
+ from scitex_cloud import __version__ as cloud_version
25
+ from scitex_cloud import (
26
+ config as cloud_config,
27
+ )
28
+ from scitex_cloud import (
29
+ utils as cloud_utils,
30
+ )
31
+
32
+ HAS_CLOUD_CLI = True
33
+ except ImportError:
34
+ HAS_CLOUD_CLI = False
35
+ cloud_version = None
36
+ DockerManager = None
37
+ Environment = None
38
+ get_environment = None
39
+ cloud_config = None
40
+ cloud_utils = None
41
+
12
42
 
13
43
  def is_cloud_environment() -> bool:
14
44
  """Check if running in SciTeX Cloud environment."""
@@ -116,11 +146,20 @@ def emit_file_link(file_path: str, line_number: Optional[int] = None) -> None:
116
146
 
117
147
 
118
148
  __all__ = [
149
+ # Local cloud environment utilities
119
150
  "is_cloud_environment",
120
151
  "get_cloud_backend",
121
152
  "get_project_root",
122
153
  "emit_inline_image",
123
154
  "emit_file_link",
155
+ # scitex-cloud package integration (if installed)
156
+ "HAS_CLOUD_CLI",
157
+ "cloud_version",
158
+ "DockerManager",
159
+ "Environment",
160
+ "get_environment",
161
+ "cloud_config",
162
+ "cloud_utils",
124
163
  ]
125
164
 
126
165
  # Auto-import matplotlib hook to enable inline plotting
scitex/config/README.md CHANGED
@@ -1,7 +1,7 @@
1
1
  <!-- ---
2
2
  !-- Timestamp: 2025-12-09
3
3
  !-- Author: ywatanabe
4
- !-- File: /home/ywatanabe/proj/scitex-code/src/scitex/config/README.md
4
+ !-- File: /home/ywatanabe/proj/scitex-python/src/scitex/config/README.md
5
5
  !-- --- -->
6
6
 
7
7
  # SciTeX Configuration Module
scitex/config/__init__.py CHANGED
@@ -1,5 +1,4 @@
1
1
  #!/usr/bin/env python3
2
- # -*- coding: utf-8 -*-
3
2
  # Timestamp: "2025-12-09 (ywatanabe)"
4
3
  # File: ./src/scitex/config/__init__.py
5
4
 
@@ -34,8 +33,16 @@ Usage:
34
33
  cache_dir = paths.resolve("cache", user_provided_path)
35
34
  """
36
35
 
37
- from ._PriorityConfig import PriorityConfig, get_scitex_dir, load_dotenv
36
+ from ._env_registry import (
37
+ ENV_REGISTRY,
38
+ EnvVar,
39
+ generate_template,
40
+ get_all_modules,
41
+ get_env_by_module,
42
+ get_env_docs,
43
+ )
38
44
  from ._paths import ScitexPaths, get_paths
45
+ from ._PriorityConfig import PriorityConfig, get_scitex_dir, load_dotenv
39
46
  from ._ScitexConfig import ScitexConfig, get_config, load_yaml
40
47
 
41
48
  __all__ = [
@@ -50,6 +57,13 @@ __all__ = [
50
57
  "PriorityConfig",
51
58
  "get_scitex_dir",
52
59
  "load_dotenv",
60
+ # Environment variable registry
61
+ "ENV_REGISTRY",
62
+ "EnvVar",
63
+ "generate_template",
64
+ "get_all_modules",
65
+ "get_env_by_module",
66
+ "get_env_docs",
53
67
  ]
54
68
 
55
69