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.
- scitex/__init__.py +71 -17
- scitex/_env_loader.py +156 -0
- scitex/_mcp_resources/__init__.py +37 -0
- scitex/_mcp_resources/_cheatsheet.py +135 -0
- scitex/_mcp_resources/_figrecipe.py +138 -0
- scitex/_mcp_resources/_formats.py +102 -0
- scitex/_mcp_resources/_modules.py +337 -0
- scitex/_mcp_resources/_session.py +149 -0
- scitex/_mcp_tools/__init__.py +4 -0
- scitex/_mcp_tools/audio.py +66 -0
- scitex/_mcp_tools/diagram.py +11 -95
- scitex/_mcp_tools/introspect.py +210 -0
- scitex/_mcp_tools/plt.py +260 -305
- scitex/_mcp_tools/scholar.py +74 -0
- scitex/_mcp_tools/social.py +27 -0
- scitex/_mcp_tools/template.py +24 -0
- scitex/_mcp_tools/writer.py +17 -210
- scitex/ai/_gen_ai/_PARAMS.py +10 -7
- scitex/ai/classification/reporters/_SingleClassificationReporter.py +45 -1603
- scitex/ai/classification/reporters/_mixins/__init__.py +36 -0
- scitex/ai/classification/reporters/_mixins/_constants.py +67 -0
- scitex/ai/classification/reporters/_mixins/_cv_summary.py +387 -0
- scitex/ai/classification/reporters/_mixins/_feature_importance.py +119 -0
- scitex/ai/classification/reporters/_mixins/_metrics.py +275 -0
- scitex/ai/classification/reporters/_mixins/_plotting.py +179 -0
- scitex/ai/classification/reporters/_mixins/_reports.py +153 -0
- scitex/ai/classification/reporters/_mixins/_storage.py +160 -0
- scitex/ai/classification/timeseries/_TimeSeriesSlidingWindowSplit.py +30 -1550
- scitex/ai/classification/timeseries/_sliding_window_core.py +467 -0
- scitex/ai/classification/timeseries/_sliding_window_plotting.py +369 -0
- scitex/audio/README.md +40 -36
- scitex/audio/__init__.py +129 -61
- scitex/audio/_branding.py +185 -0
- scitex/audio/_mcp/__init__.py +32 -0
- scitex/audio/_mcp/handlers.py +59 -6
- scitex/audio/_mcp/speak_handlers.py +238 -0
- scitex/audio/_relay.py +225 -0
- scitex/audio/_tts.py +18 -10
- scitex/audio/engines/base.py +17 -10
- scitex/audio/engines/elevenlabs_engine.py +7 -2
- scitex/audio/mcp_server.py +228 -75
- scitex/canvas/README.md +1 -1
- scitex/canvas/editor/_dearpygui/__init__.py +25 -0
- scitex/canvas/editor/_dearpygui/_editor.py +147 -0
- scitex/canvas/editor/_dearpygui/_handlers.py +476 -0
- scitex/canvas/editor/_dearpygui/_panels/__init__.py +17 -0
- scitex/canvas/editor/_dearpygui/_panels/_control.py +119 -0
- scitex/canvas/editor/_dearpygui/_panels/_element_controls.py +190 -0
- scitex/canvas/editor/_dearpygui/_panels/_preview.py +43 -0
- scitex/canvas/editor/_dearpygui/_panels/_sections.py +390 -0
- scitex/canvas/editor/_dearpygui/_plotting.py +187 -0
- scitex/canvas/editor/_dearpygui/_rendering.py +504 -0
- scitex/canvas/editor/_dearpygui/_selection.py +295 -0
- scitex/canvas/editor/_dearpygui/_state.py +93 -0
- scitex/canvas/editor/_dearpygui/_utils.py +61 -0
- scitex/canvas/editor/flask_editor/_core/__init__.py +27 -0
- scitex/canvas/editor/flask_editor/_core/_bbox_extraction.py +200 -0
- scitex/canvas/editor/flask_editor/_core/_editor.py +173 -0
- scitex/canvas/editor/flask_editor/_core/_export_helpers.py +353 -0
- scitex/canvas/editor/flask_editor/_core/_routes_basic.py +190 -0
- scitex/canvas/editor/flask_editor/_core/_routes_export.py +332 -0
- scitex/canvas/editor/flask_editor/_core/_routes_panels.py +252 -0
- scitex/canvas/editor/flask_editor/_core/_routes_save.py +218 -0
- scitex/canvas/editor/flask_editor/_core.py +25 -1684
- scitex/canvas/editor/flask_editor/templates/__init__.py +32 -70
- scitex/cli/__init__.py +38 -43
- scitex/cli/audio.py +160 -41
- scitex/cli/capture.py +133 -20
- scitex/cli/introspect.py +488 -0
- scitex/cli/main.py +200 -109
- scitex/cli/mcp.py +60 -34
- scitex/cli/plt.py +414 -0
- scitex/cli/repro.py +15 -8
- scitex/cli/resource.py +15 -8
- scitex/cli/scholar/__init__.py +154 -8
- scitex/cli/scholar/_crossref_scitex.py +296 -0
- scitex/cli/scholar/_fetch.py +25 -3
- scitex/cli/social.py +355 -0
- scitex/cli/stats.py +136 -11
- scitex/cli/template.py +129 -12
- scitex/cli/tex.py +15 -8
- scitex/cli/writer.py +49 -299
- scitex/cloud/__init__.py +41 -2
- scitex/config/README.md +1 -1
- scitex/config/__init__.py +16 -2
- scitex/config/_env_registry.py +256 -0
- scitex/context/__init__.py +22 -0
- scitex/dev/__init__.py +20 -1
- scitex/diagram/__init__.py +42 -19
- scitex/diagram/mcp_server.py +13 -125
- scitex/gen/__init__.py +50 -14
- scitex/gen/_list_packages.py +4 -4
- scitex/introspect/__init__.py +82 -0
- scitex/introspect/_call_graph.py +303 -0
- scitex/introspect/_class_hierarchy.py +163 -0
- scitex/introspect/_core.py +41 -0
- scitex/introspect/_docstring.py +131 -0
- scitex/introspect/_examples.py +113 -0
- scitex/introspect/_imports.py +271 -0
- scitex/{gen/_inspect_module.py → introspect/_list_api.py} +48 -56
- scitex/introspect/_mcp/__init__.py +41 -0
- scitex/introspect/_mcp/handlers.py +233 -0
- scitex/introspect/_members.py +155 -0
- scitex/introspect/_resolve.py +89 -0
- scitex/introspect/_signature.py +131 -0
- scitex/introspect/_source.py +80 -0
- scitex/introspect/_type_hints.py +172 -0
- scitex/io/_save.py +1 -2
- scitex/io/bundle/README.md +1 -1
- scitex/logging/_formatters.py +19 -9
- scitex/mcp_server.py +98 -5
- scitex/os/__init__.py +4 -0
- scitex/{gen → os}/_check_host.py +4 -5
- scitex/plt/__init__.py +245 -550
- scitex/plt/_subplots/_AxisWrapperMixins/_SeabornMixin/_wrappers.py +5 -10
- scitex/plt/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
- scitex/plt/gallery/README.md +1 -1
- scitex/plt/utils/_hitmap/__init__.py +82 -0
- scitex/plt/utils/_hitmap/_artist_extraction.py +343 -0
- scitex/plt/utils/_hitmap/_color_application.py +346 -0
- scitex/plt/utils/_hitmap/_color_conversion.py +121 -0
- scitex/plt/utils/_hitmap/_constants.py +40 -0
- scitex/plt/utils/_hitmap/_hitmap_core.py +334 -0
- scitex/plt/utils/_hitmap/_path_extraction.py +357 -0
- scitex/plt/utils/_hitmap/_query.py +113 -0
- scitex/plt/utils/_hitmap.py +46 -1616
- scitex/plt/utils/_metadata/__init__.py +80 -0
- scitex/plt/utils/_metadata/_artists/__init__.py +25 -0
- scitex/plt/utils/_metadata/_artists/_base.py +195 -0
- scitex/plt/utils/_metadata/_artists/_collections.py +356 -0
- scitex/plt/utils/_metadata/_artists/_extract.py +57 -0
- scitex/plt/utils/_metadata/_artists/_images.py +80 -0
- scitex/plt/utils/_metadata/_artists/_lines.py +261 -0
- scitex/plt/utils/_metadata/_artists/_patches.py +247 -0
- scitex/plt/utils/_metadata/_artists/_text.py +106 -0
- scitex/plt/utils/_metadata/_csv.py +416 -0
- scitex/plt/utils/_metadata/_detect.py +225 -0
- scitex/plt/utils/_metadata/_legend.py +127 -0
- scitex/plt/utils/_metadata/_rounding.py +117 -0
- scitex/plt/utils/_metadata/_verification.py +202 -0
- scitex/schema/README.md +1 -1
- scitex/scholar/__init__.py +8 -0
- scitex/scholar/_mcp/crossref_handlers.py +265 -0
- scitex/scholar/core/Scholar.py +63 -1700
- scitex/scholar/core/_mixins/__init__.py +36 -0
- scitex/scholar/core/_mixins/_enrichers.py +270 -0
- scitex/scholar/core/_mixins/_library_handlers.py +100 -0
- scitex/scholar/core/_mixins/_loaders.py +103 -0
- scitex/scholar/core/_mixins/_pdf_download.py +375 -0
- scitex/scholar/core/_mixins/_pipeline.py +312 -0
- scitex/scholar/core/_mixins/_project_handlers.py +125 -0
- scitex/scholar/core/_mixins/_savers.py +69 -0
- scitex/scholar/core/_mixins/_search.py +103 -0
- scitex/scholar/core/_mixins/_services.py +88 -0
- scitex/scholar/core/_mixins/_url_finding.py +105 -0
- scitex/scholar/crossref_scitex.py +367 -0
- scitex/scholar/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
- scitex/scholar/examples/00_run_all.sh +120 -0
- scitex/scholar/jobs/_executors.py +27 -3
- scitex/scholar/pdf_download/ScholarPDFDownloader.py +38 -416
- scitex/scholar/pdf_download/_cli.py +154 -0
- scitex/scholar/pdf_download/strategies/__init__.py +11 -8
- scitex/scholar/pdf_download/strategies/manual_download_fallback.py +80 -3
- scitex/scholar/pipelines/ScholarPipelineBibTeX.py +73 -121
- scitex/scholar/pipelines/ScholarPipelineParallel.py +80 -138
- scitex/scholar/pipelines/ScholarPipelineSingle.py +43 -63
- scitex/scholar/pipelines/_single_steps.py +71 -36
- scitex/scholar/storage/_LibraryManager.py +97 -1695
- scitex/scholar/storage/_mixins/__init__.py +30 -0
- scitex/scholar/storage/_mixins/_bibtex_handlers.py +128 -0
- scitex/scholar/storage/_mixins/_library_operations.py +218 -0
- scitex/scholar/storage/_mixins/_metadata_conversion.py +226 -0
- scitex/scholar/storage/_mixins/_paper_saving.py +456 -0
- scitex/scholar/storage/_mixins/_resolution.py +376 -0
- scitex/scholar/storage/_mixins/_storage_helpers.py +121 -0
- scitex/scholar/storage/_mixins/_symlink_handlers.py +226 -0
- scitex/security/README.md +3 -3
- scitex/session/README.md +1 -1
- scitex/session/__init__.py +26 -7
- scitex/session/_decorator.py +1 -1
- scitex/sh/README.md +1 -1
- scitex/sh/__init__.py +7 -4
- scitex/social/__init__.py +155 -0
- scitex/social/docs/EXTERNAL_PACKAGE_BRANDING.md +149 -0
- scitex/stats/_mcp/_handlers/__init__.py +31 -0
- scitex/stats/_mcp/_handlers/_corrections.py +113 -0
- scitex/stats/_mcp/_handlers/_descriptive.py +78 -0
- scitex/stats/_mcp/_handlers/_effect_size.py +106 -0
- scitex/stats/_mcp/_handlers/_format.py +94 -0
- scitex/stats/_mcp/_handlers/_normality.py +110 -0
- scitex/stats/_mcp/_handlers/_posthoc.py +224 -0
- scitex/stats/_mcp/_handlers/_power.py +247 -0
- scitex/stats/_mcp/_handlers/_recommend.py +102 -0
- scitex/stats/_mcp/_handlers/_run_test.py +279 -0
- scitex/stats/_mcp/_handlers/_stars.py +48 -0
- scitex/stats/_mcp/handlers.py +19 -1171
- scitex/stats/auto/_stat_style.py +175 -0
- scitex/stats/auto/_style_definitions.py +411 -0
- scitex/stats/auto/_styles.py +22 -620
- scitex/stats/descriptive/__init__.py +11 -8
- scitex/stats/descriptive/_ci.py +39 -0
- scitex/stats/power/_power.py +15 -4
- scitex/str/__init__.py +2 -1
- scitex/str/_title_case.py +63 -0
- scitex/template/README.md +1 -1
- scitex/template/__init__.py +25 -10
- scitex/template/_code_templates.py +147 -0
- scitex/template/_mcp/handlers.py +81 -0
- scitex/template/_mcp/tool_schemas.py +55 -0
- scitex/template/_templates/__init__.py +51 -0
- scitex/template/_templates/audio.py +233 -0
- scitex/template/_templates/canvas.py +312 -0
- scitex/template/_templates/capture.py +268 -0
- scitex/template/_templates/config.py +43 -0
- scitex/template/_templates/diagram.py +294 -0
- scitex/template/_templates/io.py +107 -0
- scitex/template/_templates/module.py +53 -0
- scitex/template/_templates/plt.py +202 -0
- scitex/template/_templates/scholar.py +267 -0
- scitex/template/_templates/session.py +130 -0
- scitex/template/_templates/session_minimal.py +43 -0
- scitex/template/_templates/session_plot.py +67 -0
- scitex/template/_templates/session_stats.py +77 -0
- scitex/template/_templates/stats.py +323 -0
- scitex/template/_templates/writer.py +296 -0
- scitex/template/clone_writer_directory.py +5 -5
- scitex/ui/_backends/_email.py +10 -2
- scitex/ui/_backends/_webhook.py +5 -1
- scitex/web/_search_pubmed.py +10 -6
- scitex/writer/README.md +1 -1
- scitex/writer/__init__.py +43 -34
- scitex/writer/_mcp/handlers.py +11 -744
- scitex/writer/_mcp/tool_schemas.py +5 -335
- scitex-2.15.3.dist-info/METADATA +667 -0
- {scitex-2.14.0.dist-info → scitex-2.15.3.dist-info}/RECORD +241 -120
- scitex/canvas/editor/flask_editor/templates/_scripts.py +0 -4933
- scitex/canvas/editor/flask_editor/templates/_styles.py +0 -1658
- scitex/diagram/_compile.py +0 -312
- scitex/diagram/_diagram.py +0 -355
- scitex/diagram/_mcp/__init__.py +0 -4
- scitex/diagram/_mcp/handlers.py +0 -400
- scitex/diagram/_mcp/tool_schemas.py +0 -157
- scitex/diagram/_presets.py +0 -173
- scitex/diagram/_schema.py +0 -182
- scitex/diagram/_split.py +0 -278
- scitex/gen/_ci.py +0 -12
- scitex/gen/_title_case.py +0 -89
- scitex/plt/_mcp/__init__.py +0 -4
- scitex/plt/_mcp/_handlers_annotation.py +0 -102
- scitex/plt/_mcp/_handlers_figure.py +0 -195
- scitex/plt/_mcp/_handlers_plot.py +0 -252
- scitex/plt/_mcp/_handlers_style.py +0 -219
- scitex/plt/_mcp/handlers.py +0 -74
- scitex/plt/_mcp/tool_schemas.py +0 -497
- scitex/plt/mcp_server.py +0 -231
- scitex/scholar/examples/SUGGESTIONS.md +0 -865
- scitex/scholar/examples/dev.py +0 -38
- scitex-2.14.0.dist-info/METADATA +0 -1238
- /scitex/{gen → context}/_detect_environment.py +0 -0
- /scitex/{gen → context}/_get_notebook_path.py +0 -0
- /scitex/{gen/_shell.py → sh/_shell_legacy.py} +0 -0
- {scitex-2.14.0.dist-info → scitex-2.15.3.dist-info}/WHEEL +0 -0
- {scitex-2.14.0.dist-info → scitex-2.15.3.dist-info}/entry_points.txt +0 -0
- {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
|
|
3
|
+
SciTeX Writer CLI - Thin wrapper delegating to scitex-writer package.
|
|
4
4
|
|
|
5
|
-
|
|
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
|
-
|
|
15
|
-
|
|
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
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
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
|
-
@
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
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.
|
|
151
|
-
|
|
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
|
-
|
|
46
|
+
Manuscript writing and LaTeX compilation (delegates to scitex-writer)
|
|
162
47
|
|
|
163
48
|
\b
|
|
164
|
-
|
|
165
|
-
|
|
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
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
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
|
-
|
|
240
|
-
|
|
241
|
-
|
|
68
|
+
For full help:
|
|
69
|
+
scitex writer --help
|
|
70
|
+
scitex-writer --help
|
|
242
71
|
"""
|
|
243
|
-
|
|
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
|
-
|
|
257
|
-
|
|
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
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 .
|
|
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
|
|