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.
- scitex/__init__.py +68 -61
- scitex/_mcp_tools/introspect.py +42 -23
- scitex/_mcp_tools/template.py +24 -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/__init__.py +2 -2
- scitex/audio/_tts.py +18 -10
- scitex/audio/engines/base.py +17 -10
- scitex/audio/engines/elevenlabs_engine.py +1 -1
- 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/cli/introspect.py +112 -74
- scitex/cli/main.py +2 -0
- scitex/cli/plt.py +357 -0
- scitex/cli/repro.py +15 -8
- scitex/cli/resource.py +15 -8
- scitex/cli/scholar/__init__.py +15 -8
- scitex/cli/social.py +6 -6
- scitex/cli/stats.py +15 -8
- scitex/cli/template.py +129 -12
- scitex/cli/tex.py +15 -8
- scitex/cli/writer.py +15 -8
- scitex/cloud/__init__.py +41 -2
- scitex/config/_env_registry.py +84 -19
- scitex/context/__init__.py +22 -0
- scitex/dev/__init__.py +20 -1
- scitex/gen/__init__.py +50 -14
- scitex/gen/_list_packages.py +4 -4
- scitex/introspect/__init__.py +16 -9
- scitex/introspect/_core.py +7 -8
- scitex/{gen/_inspect_module.py → introspect/_list_api.py} +43 -54
- scitex/introspect/_mcp/__init__.py +10 -6
- scitex/introspect/_mcp/handlers.py +37 -12
- scitex/introspect/_members.py +7 -3
- scitex/introspect/_signature.py +3 -3
- scitex/introspect/_source.py +2 -2
- scitex/io/_save.py +1 -2
- scitex/logging/_formatters.py +19 -9
- scitex/mcp_server.py +1 -1
- scitex/os/__init__.py +4 -0
- scitex/{gen → os}/_check_host.py +4 -5
- scitex/plt/__init__.py +11 -14
- scitex/session/__init__.py +26 -7
- scitex/session/_decorator.py +1 -1
- scitex/sh/__init__.py +7 -4
- scitex/social/__init__.py +10 -8
- 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/__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/ui/_backends/_email.py +10 -2
- scitex/ui/_backends/_webhook.py +5 -1
- scitex/web/_search_pubmed.py +10 -6
- {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/METADATA +1 -1
- {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/RECORD +105 -64
- scitex/gen/_ci.py +0 -12
- scitex/gen/_title_case.py +0 -89
- /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.15.1.dist-info → scitex-2.15.2.dist-info}/WHEEL +0 -0
- {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/entry_points.txt +0 -0
- {scitex-2.15.1.dist-info → scitex-2.15.2.dist-info}/licenses/LICENSE +0 -0
scitex/cli/resource.py
CHANGED
|
@@ -10,8 +10,13 @@ import sys
|
|
|
10
10
|
import click
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
@click.group(
|
|
14
|
-
|
|
13
|
+
@click.group(
|
|
14
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
15
|
+
invoke_without_command=True,
|
|
16
|
+
)
|
|
17
|
+
@click.option("--help-recursive", is_flag=True, help="Show help for all subcommands")
|
|
18
|
+
@click.pass_context
|
|
19
|
+
def resource(ctx, help_recursive):
|
|
15
20
|
"""
|
|
16
21
|
System resource monitoring
|
|
17
22
|
|
|
@@ -27,20 +32,22 @@ def resource():
|
|
|
27
32
|
scitex resource usage # Current CPU/memory/GPU usage
|
|
28
33
|
scitex resource monitor --interval 5
|
|
29
34
|
"""
|
|
30
|
-
|
|
35
|
+
if help_recursive:
|
|
36
|
+
_print_help_recursive(ctx)
|
|
37
|
+
ctx.exit(0)
|
|
38
|
+
elif ctx.invoked_subcommand is None:
|
|
39
|
+
click.echo(ctx.get_help())
|
|
31
40
|
|
|
32
41
|
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
def help_recursive(ctx):
|
|
36
|
-
"""Show help for all commands recursively."""
|
|
42
|
+
def _print_help_recursive(ctx):
|
|
43
|
+
"""Print help for all commands recursively."""
|
|
37
44
|
fake_parent = click.Context(click.Group(), info_name="scitex")
|
|
38
45
|
parent_ctx = click.Context(resource, info_name="resource", parent=fake_parent)
|
|
39
46
|
click.secho("━━━ scitex resource ━━━", fg="cyan", bold=True)
|
|
40
47
|
click.echo(resource.get_help(parent_ctx))
|
|
41
48
|
for name in sorted(resource.list_commands(ctx) or []):
|
|
42
49
|
cmd = resource.get_command(ctx, name)
|
|
43
|
-
if cmd is None
|
|
50
|
+
if cmd is None:
|
|
44
51
|
continue
|
|
45
52
|
click.echo()
|
|
46
53
|
click.secho(f"━━━ scitex resource {name} ━━━", fg="cyan", bold=True)
|
scitex/cli/scholar/__init__.py
CHANGED
|
@@ -33,8 +33,13 @@ from ._jobs import jobs
|
|
|
33
33
|
from ._library import config, library
|
|
34
34
|
|
|
35
35
|
|
|
36
|
-
@click.group(
|
|
37
|
-
|
|
36
|
+
@click.group(
|
|
37
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
38
|
+
invoke_without_command=True,
|
|
39
|
+
)
|
|
40
|
+
@click.option("--help-recursive", is_flag=True, help="Show help for all subcommands")
|
|
41
|
+
@click.pass_context
|
|
42
|
+
def scholar(ctx, help_recursive):
|
|
38
43
|
"""
|
|
39
44
|
Scientific paper management
|
|
40
45
|
|
|
@@ -48,13 +53,15 @@ def scholar():
|
|
|
48
53
|
scitex scholar library
|
|
49
54
|
scitex scholar jobs list
|
|
50
55
|
"""
|
|
51
|
-
|
|
56
|
+
if help_recursive:
|
|
57
|
+
_print_help_recursive(ctx)
|
|
58
|
+
ctx.exit(0)
|
|
59
|
+
elif ctx.invoked_subcommand is None:
|
|
60
|
+
click.echo(ctx.get_help())
|
|
52
61
|
|
|
53
62
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
def help_recursive(ctx):
|
|
57
|
-
"""Show help for all commands recursively."""
|
|
63
|
+
def _print_help_recursive(ctx):
|
|
64
|
+
"""Print help for all commands recursively."""
|
|
58
65
|
fake_parent = click.Context(click.Group(), info_name="scitex")
|
|
59
66
|
parent_ctx = click.Context(scholar, info_name="scholar", parent=fake_parent)
|
|
60
67
|
|
|
@@ -63,7 +70,7 @@ def help_recursive(ctx):
|
|
|
63
70
|
|
|
64
71
|
for name in sorted(scholar.list_commands(ctx) or []):
|
|
65
72
|
cmd = scholar.get_command(ctx, name)
|
|
66
|
-
if cmd is None
|
|
73
|
+
if cmd is None:
|
|
67
74
|
continue
|
|
68
75
|
click.echo()
|
|
69
76
|
click.secho(f"━━━ scitex scholar {name} ━━━", fg="cyan", bold=True)
|
scitex/cli/social.py
CHANGED
|
@@ -61,13 +61,13 @@ def social(ctx, help_recursive):
|
|
|
61
61
|
scitex social analytics twitter
|
|
62
62
|
|
|
63
63
|
\b
|
|
64
|
-
Environment Variables (
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
64
|
+
Environment Variables (SCITEX_SOCIAL_ prefix):
|
|
65
|
+
SCITEX_SOCIAL_X_CONSUMER_KEY Twitter API keys
|
|
66
|
+
SCITEX_SOCIAL_LINKEDIN_ACCESS_TOKEN LinkedIn OAuth token
|
|
67
|
+
SCITEX_SOCIAL_REDDIT_CLIENT_ID Reddit app credentials
|
|
68
|
+
SCITEX_SOCIAL_YOUTUBE_API_KEY YouTube API key
|
|
69
69
|
|
|
70
|
-
Note: Falls back to SOCIALIA_ prefix if
|
|
70
|
+
Note: Falls back to SOCIALIA_ prefix if SCITEX_SOCIAL_ not set.
|
|
71
71
|
"""
|
|
72
72
|
if not _check_socialia():
|
|
73
73
|
click.secho("Error: socialia not installed", fg="red", err=True)
|
scitex/cli/stats.py
CHANGED
|
@@ -11,8 +11,13 @@ from pathlib import Path
|
|
|
11
11
|
import click
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
@click.group(
|
|
15
|
-
|
|
14
|
+
@click.group(
|
|
15
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
16
|
+
invoke_without_command=True,
|
|
17
|
+
)
|
|
18
|
+
@click.option("--help-recursive", is_flag=True, help="Show help for all subcommands")
|
|
19
|
+
@click.pass_context
|
|
20
|
+
def stats(ctx, help_recursive):
|
|
16
21
|
"""
|
|
17
22
|
Statistical analysis and testing utilities
|
|
18
23
|
|
|
@@ -29,20 +34,22 @@ def stats():
|
|
|
29
34
|
scitex stats describe data.csv
|
|
30
35
|
scitex stats save results.json --output analysis.stats
|
|
31
36
|
"""
|
|
32
|
-
|
|
37
|
+
if help_recursive:
|
|
38
|
+
_print_help_recursive(ctx)
|
|
39
|
+
ctx.exit(0)
|
|
40
|
+
elif ctx.invoked_subcommand is None:
|
|
41
|
+
click.echo(ctx.get_help())
|
|
33
42
|
|
|
34
43
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def help_recursive(ctx):
|
|
38
|
-
"""Show help for all commands recursively."""
|
|
44
|
+
def _print_help_recursive(ctx):
|
|
45
|
+
"""Print help for all commands recursively."""
|
|
39
46
|
fake_parent = click.Context(click.Group(), info_name="scitex")
|
|
40
47
|
parent_ctx = click.Context(stats, info_name="stats", parent=fake_parent)
|
|
41
48
|
click.secho("━━━ scitex stats ━━━", fg="cyan", bold=True)
|
|
42
49
|
click.echo(stats.get_help(parent_ctx))
|
|
43
50
|
for name in sorted(stats.list_commands(ctx) or []):
|
|
44
51
|
cmd = stats.get_command(ctx, name)
|
|
45
|
-
if cmd is None
|
|
52
|
+
if cmd is None:
|
|
46
53
|
continue
|
|
47
54
|
click.echo()
|
|
48
55
|
click.secho(f"━━━ scitex stats {name} ━━━", fg="cyan", bold=True)
|
scitex/cli/template.py
CHANGED
|
@@ -11,38 +11,55 @@ from pathlib import Path
|
|
|
11
11
|
import click
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
@click.group(
|
|
15
|
-
|
|
14
|
+
@click.group(
|
|
15
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
16
|
+
invoke_without_command=True,
|
|
17
|
+
)
|
|
18
|
+
@click.option("--help-recursive", is_flag=True, help="Show help for all subcommands")
|
|
19
|
+
@click.pass_context
|
|
20
|
+
def template(ctx, help_recursive):
|
|
16
21
|
"""
|
|
17
22
|
Project template scaffolding
|
|
18
23
|
|
|
19
24
|
\b
|
|
20
|
-
|
|
25
|
+
Project Templates (clone):
|
|
21
26
|
research - Full scientific workflow structure
|
|
22
27
|
pip-project - Pip-installable Python package
|
|
23
28
|
singularity - Container-based project
|
|
24
29
|
paper - Academic paper writing template
|
|
25
30
|
|
|
31
|
+
\b
|
|
32
|
+
Code Templates (get):
|
|
33
|
+
session - @stx.session script with CONFIG docs (priority)
|
|
34
|
+
io - stx.io save/load patterns (priority)
|
|
35
|
+
config - YAML configuration file
|
|
36
|
+
session-minimal/plot/stats - Variants
|
|
37
|
+
module - Standard Python module
|
|
38
|
+
all - All templates combined
|
|
39
|
+
|
|
26
40
|
\b
|
|
27
41
|
Examples:
|
|
28
|
-
scitex template
|
|
29
|
-
scitex template
|
|
30
|
-
scitex template
|
|
42
|
+
scitex template get session # Session script template
|
|
43
|
+
scitex template get io # I/O operations template
|
|
44
|
+
scitex template get all # All templates
|
|
45
|
+
scitex template get session -o script.py # Save to file
|
|
31
46
|
"""
|
|
32
|
-
|
|
47
|
+
if help_recursive:
|
|
48
|
+
_print_help_recursive(ctx)
|
|
49
|
+
ctx.exit(0)
|
|
50
|
+
elif ctx.invoked_subcommand is None:
|
|
51
|
+
click.echo(ctx.get_help())
|
|
33
52
|
|
|
34
53
|
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
def help_recursive(ctx):
|
|
38
|
-
"""Show help for all commands recursively."""
|
|
54
|
+
def _print_help_recursive(ctx):
|
|
55
|
+
"""Print help for all commands recursively."""
|
|
39
56
|
fake_parent = click.Context(click.Group(), info_name="scitex")
|
|
40
57
|
parent_ctx = click.Context(template, info_name="template", parent=fake_parent)
|
|
41
58
|
click.secho("━━━ scitex template ━━━", fg="cyan", bold=True)
|
|
42
59
|
click.echo(template.get_help(parent_ctx))
|
|
43
60
|
for name in sorted(template.list_commands(ctx) or []):
|
|
44
61
|
cmd = template.get_command(ctx, name)
|
|
45
|
-
if cmd is None
|
|
62
|
+
if cmd is None:
|
|
46
63
|
continue
|
|
47
64
|
click.echo()
|
|
48
65
|
click.secho(f"━━━ scitex template {name} ━━━", fg="cyan", bold=True)
|
|
@@ -198,6 +215,106 @@ def clone(template_type, destination, git_strategy, branch, tag):
|
|
|
198
215
|
sys.exit(1)
|
|
199
216
|
|
|
200
217
|
|
|
218
|
+
@template.command()
|
|
219
|
+
@click.argument(
|
|
220
|
+
"template_id",
|
|
221
|
+
type=click.Choice(
|
|
222
|
+
[
|
|
223
|
+
# Core templates (priority 1-3)
|
|
224
|
+
"session",
|
|
225
|
+
"io",
|
|
226
|
+
"config",
|
|
227
|
+
# Session variants
|
|
228
|
+
"session-minimal",
|
|
229
|
+
"session-plot",
|
|
230
|
+
"session-stats",
|
|
231
|
+
# Module template
|
|
232
|
+
"module",
|
|
233
|
+
# Module usage templates
|
|
234
|
+
"plt",
|
|
235
|
+
"stats",
|
|
236
|
+
"scholar",
|
|
237
|
+
"audio",
|
|
238
|
+
"capture",
|
|
239
|
+
"diagram",
|
|
240
|
+
"canvas",
|
|
241
|
+
"writer",
|
|
242
|
+
# All templates
|
|
243
|
+
"all",
|
|
244
|
+
]
|
|
245
|
+
),
|
|
246
|
+
)
|
|
247
|
+
@click.option(
|
|
248
|
+
"--output", "-o", type=click.Path(), help="Save to file instead of printing"
|
|
249
|
+
)
|
|
250
|
+
@click.option("--docstring", "-d", help="Custom docstring for the template")
|
|
251
|
+
def get(template_id, output, docstring):
|
|
252
|
+
"""
|
|
253
|
+
Get a code template (print or save to file)
|
|
254
|
+
|
|
255
|
+
\b
|
|
256
|
+
Core Templates (priority 1-3):
|
|
257
|
+
session - Full @stx.session script with CONFIG docs
|
|
258
|
+
io - stx.io.save/load patterns (30+ formats)
|
|
259
|
+
config - YAML configuration file
|
|
260
|
+
|
|
261
|
+
\b
|
|
262
|
+
Session Variants:
|
|
263
|
+
session-minimal - Minimal session script
|
|
264
|
+
session-plot - Plotting-focused session script
|
|
265
|
+
session-stats - Statistical analysis script
|
|
266
|
+
module - Standard Python module
|
|
267
|
+
|
|
268
|
+
\b
|
|
269
|
+
Module Usage Templates:
|
|
270
|
+
plt - stx.plt plotting usage
|
|
271
|
+
stats - stx.stats statistical analysis
|
|
272
|
+
scholar - stx.scholar literature management
|
|
273
|
+
audio - stx.audio text-to-speech
|
|
274
|
+
capture - stx.capture screenshots
|
|
275
|
+
diagram - stx.diagram Mermaid/Graphviz
|
|
276
|
+
canvas - stx.canvas figure composition
|
|
277
|
+
writer - stx.writer LaTeX compilation
|
|
278
|
+
|
|
279
|
+
\b
|
|
280
|
+
All:
|
|
281
|
+
all - All templates combined
|
|
282
|
+
|
|
283
|
+
\b
|
|
284
|
+
Examples:
|
|
285
|
+
scitex template get session # Print to stdout
|
|
286
|
+
scitex template get io # I/O operations template
|
|
287
|
+
scitex template get all # All templates
|
|
288
|
+
scitex template get session -o script.py # Save to file
|
|
289
|
+
"""
|
|
290
|
+
try:
|
|
291
|
+
if template_id == "all":
|
|
292
|
+
from scitex.template import get_all_templates
|
|
293
|
+
|
|
294
|
+
content = get_all_templates()
|
|
295
|
+
else:
|
|
296
|
+
from scitex.template import get_code_template
|
|
297
|
+
|
|
298
|
+
filepath = output if output else None
|
|
299
|
+
content = get_code_template(
|
|
300
|
+
template_id, filepath=filepath, docstring=docstring
|
|
301
|
+
)
|
|
302
|
+
|
|
303
|
+
if output:
|
|
304
|
+
# Save to file
|
|
305
|
+
out_path = Path(output)
|
|
306
|
+
out_path.parent.mkdir(parents=True, exist_ok=True)
|
|
307
|
+
out_path.write_text(content)
|
|
308
|
+
click.secho(f"Template saved: {out_path}", fg="green")
|
|
309
|
+
else:
|
|
310
|
+
# Print to stdout
|
|
311
|
+
click.echo(content)
|
|
312
|
+
|
|
313
|
+
except Exception as e:
|
|
314
|
+
click.secho(f"Error: {e}", fg="red", err=True)
|
|
315
|
+
sys.exit(1)
|
|
316
|
+
|
|
317
|
+
|
|
201
318
|
@template.command()
|
|
202
319
|
@click.argument("template_id")
|
|
203
320
|
def info(template_id):
|
scitex/cli/tex.py
CHANGED
|
@@ -11,8 +11,13 @@ from pathlib import Path
|
|
|
11
11
|
import click
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
@click.group(
|
|
15
|
-
|
|
14
|
+
@click.group(
|
|
15
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
16
|
+
invoke_without_command=True,
|
|
17
|
+
)
|
|
18
|
+
@click.option("--help-recursive", is_flag=True, help="Show help for all subcommands")
|
|
19
|
+
@click.pass_context
|
|
20
|
+
def tex(ctx, help_recursive):
|
|
16
21
|
"""
|
|
17
22
|
LaTeX compilation and utilities
|
|
18
23
|
|
|
@@ -28,20 +33,22 @@ def tex():
|
|
|
28
33
|
scitex tex preview paper.tex
|
|
29
34
|
scitex tex to-vec figure.tex --format svg
|
|
30
35
|
"""
|
|
31
|
-
|
|
36
|
+
if help_recursive:
|
|
37
|
+
_print_help_recursive(ctx)
|
|
38
|
+
ctx.exit(0)
|
|
39
|
+
elif ctx.invoked_subcommand is None:
|
|
40
|
+
click.echo(ctx.get_help())
|
|
32
41
|
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
def help_recursive(ctx):
|
|
37
|
-
"""Show help for all commands recursively."""
|
|
43
|
+
def _print_help_recursive(ctx):
|
|
44
|
+
"""Print help for all commands recursively."""
|
|
38
45
|
fake_parent = click.Context(click.Group(), info_name="scitex")
|
|
39
46
|
parent_ctx = click.Context(tex, info_name="tex", parent=fake_parent)
|
|
40
47
|
click.secho("━━━ scitex tex ━━━", fg="cyan", bold=True)
|
|
41
48
|
click.echo(tex.get_help(parent_ctx))
|
|
42
49
|
for name in sorted(tex.list_commands(ctx) or []):
|
|
43
50
|
cmd = tex.get_command(ctx, name)
|
|
44
|
-
if cmd is None
|
|
51
|
+
if cmd is None:
|
|
45
52
|
continue
|
|
46
53
|
click.echo()
|
|
47
54
|
click.secho(f"━━━ scitex tex {name} ━━━", fg="cyan", bold=True)
|
scitex/cli/writer.py
CHANGED
|
@@ -11,8 +11,13 @@ from pathlib import Path
|
|
|
11
11
|
import click
|
|
12
12
|
|
|
13
13
|
|
|
14
|
-
@click.group(
|
|
15
|
-
|
|
14
|
+
@click.group(
|
|
15
|
+
context_settings={"help_option_names": ["-h", "--help"]},
|
|
16
|
+
invoke_without_command=True,
|
|
17
|
+
)
|
|
18
|
+
@click.option("--help-recursive", is_flag=True, help="Show help for all subcommands")
|
|
19
|
+
@click.pass_context
|
|
20
|
+
def writer(ctx, help_recursive):
|
|
16
21
|
"""
|
|
17
22
|
Manuscript writing and LaTeX compilation
|
|
18
23
|
|
|
@@ -23,13 +28,15 @@ def writer():
|
|
|
23
28
|
- Watch mode for auto-recompilation
|
|
24
29
|
- Project structure management
|
|
25
30
|
"""
|
|
26
|
-
|
|
31
|
+
if help_recursive:
|
|
32
|
+
_print_help_recursive(ctx)
|
|
33
|
+
ctx.exit(0)
|
|
34
|
+
elif ctx.invoked_subcommand is None:
|
|
35
|
+
click.echo(ctx.get_help())
|
|
27
36
|
|
|
28
37
|
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def help_recursive(ctx):
|
|
32
|
-
"""Show help for all commands recursively."""
|
|
38
|
+
def _print_help_recursive(ctx):
|
|
39
|
+
"""Print help for all commands recursively."""
|
|
33
40
|
fake_parent = click.Context(click.Group(), info_name="scitex")
|
|
34
41
|
parent_ctx = click.Context(writer, info_name="writer", parent=fake_parent)
|
|
35
42
|
|
|
@@ -38,7 +45,7 @@ def help_recursive(ctx):
|
|
|
38
45
|
|
|
39
46
|
for name in sorted(writer.list_commands(ctx) or []):
|
|
40
47
|
cmd = writer.get_command(ctx, name)
|
|
41
|
-
if cmd is None
|
|
48
|
+
if cmd is None:
|
|
42
49
|
continue
|
|
43
50
|
click.echo()
|
|
44
51
|
click.secho(f"━━━ scitex writer {name} ━━━", fg="cyan", bold=True)
|
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/_env_registry.py
CHANGED
|
@@ -32,19 +32,21 @@ ENV_REGISTRY: List[EnvVar] = [
|
|
|
32
32
|
EnvVar("SCITEX_DIR", "Base directory for scitex data", "core", "~/.scitex"),
|
|
33
33
|
EnvVar("SCITEX_ENV_SRC", "Path to env source file/directory", "core"),
|
|
34
34
|
EnvVar("SCITEX_LOGGING_LEVEL", "Logging level", "logging", "INFO"),
|
|
35
|
-
EnvVar("
|
|
36
|
-
EnvVar("
|
|
35
|
+
EnvVar("SCITEX_LOGGING_FORMAT", "Log format style", "logging", "default"),
|
|
36
|
+
EnvVar("SCITEX_LOGGING_FORCE_COLOR", "Force colored output", "logging", "false"),
|
|
37
37
|
# Audio
|
|
38
38
|
EnvVar("SCITEX_AUDIO_MODE", "Audio mode: local/remote/auto", "audio", "auto"),
|
|
39
39
|
EnvVar("SCITEX_AUDIO_RELAY_URL", "Relay server URL for remote audio", "audio"),
|
|
40
40
|
EnvVar("SCITEX_AUDIO_RELAY_HOST", "Relay server host", "audio"),
|
|
41
41
|
EnvVar("SCITEX_AUDIO_RELAY_PORT", "Relay server port", "audio", "31293"),
|
|
42
42
|
EnvVar("SCITEX_AUDIO_PORT", "Audio server port", "audio", "31293"),
|
|
43
|
-
EnvVar(
|
|
43
|
+
EnvVar(
|
|
44
|
+
"SCITEX_AUDIO_ELEVENLABS_API_KEY", "ElevenLabs API key", "audio", sensitive=True
|
|
45
|
+
),
|
|
44
46
|
# Scholar
|
|
45
47
|
EnvVar("SCITEX_SCHOLAR_DIR", "Scholar library directory", "scholar"),
|
|
46
|
-
EnvVar("
|
|
47
|
-
EnvVar("
|
|
48
|
+
EnvVar("SCITEX_SCHOLAR_CROSSREF_EMAIL", "Email for Crossref API", "scholar"),
|
|
49
|
+
EnvVar("SCITEX_SCHOLAR_PUBMED_EMAIL", "Email for PubMed API", "scholar"),
|
|
48
50
|
EnvVar("SCITEX_SCHOLAR_CROSSREF_DB", "Local Crossref database path", "scholar"),
|
|
49
51
|
EnvVar("SCITEX_SCHOLAR_CROSSREF_API_URL", "Crossref API URL", "scholar"),
|
|
50
52
|
EnvVar(
|
|
@@ -68,35 +70,98 @@ ENV_REGISTRY: List[EnvVar] = [
|
|
|
68
70
|
sensitive=True,
|
|
69
71
|
),
|
|
70
72
|
# Social
|
|
71
|
-
EnvVar("SCITEX_X_CONSUMER_KEY", "Twitter/X consumer key", "social", sensitive=True),
|
|
72
73
|
EnvVar(
|
|
73
|
-
"
|
|
74
|
+
"SCITEX_SOCIAL_X_CONSUMER_KEY",
|
|
75
|
+
"Twitter/X consumer key",
|
|
76
|
+
"social",
|
|
77
|
+
sensitive=True,
|
|
78
|
+
),
|
|
79
|
+
EnvVar(
|
|
80
|
+
"SCITEX_SOCIAL_X_CONSUMER_KEY_SECRET",
|
|
74
81
|
"Twitter/X consumer secret",
|
|
75
82
|
"social",
|
|
76
83
|
sensitive=True,
|
|
77
84
|
),
|
|
78
|
-
EnvVar("SCITEX_X_ACCESS_TOKEN", "Twitter/X access token", "social", sensitive=True),
|
|
79
85
|
EnvVar(
|
|
80
|
-
"
|
|
86
|
+
"SCITEX_SOCIAL_X_ACCESS_TOKEN",
|
|
87
|
+
"Twitter/X access token",
|
|
88
|
+
"social",
|
|
89
|
+
sensitive=True,
|
|
90
|
+
),
|
|
91
|
+
EnvVar(
|
|
92
|
+
"SCITEX_SOCIAL_X_ACCESS_TOKEN_SECRET",
|
|
81
93
|
"Twitter/X access token secret",
|
|
82
94
|
"social",
|
|
83
95
|
sensitive=True,
|
|
84
96
|
),
|
|
85
97
|
EnvVar(
|
|
86
|
-
"
|
|
98
|
+
"SCITEX_SOCIAL_X_BEARER_TOKEN",
|
|
99
|
+
"Twitter/X bearer token",
|
|
100
|
+
"social",
|
|
101
|
+
sensitive=True,
|
|
102
|
+
),
|
|
103
|
+
EnvVar(
|
|
104
|
+
"SCITEX_SOCIAL_LINKEDIN_CLIENT_ID",
|
|
105
|
+
"LinkedIn client ID",
|
|
106
|
+
"social",
|
|
107
|
+
sensitive=True,
|
|
108
|
+
),
|
|
109
|
+
EnvVar(
|
|
110
|
+
"SCITEX_SOCIAL_LINKEDIN_CLIENT_SECRET",
|
|
111
|
+
"LinkedIn client secret",
|
|
112
|
+
"social",
|
|
113
|
+
sensitive=True,
|
|
114
|
+
),
|
|
115
|
+
EnvVar(
|
|
116
|
+
"SCITEX_SOCIAL_LINKEDIN_ACCESS_TOKEN",
|
|
87
117
|
"LinkedIn access token",
|
|
88
118
|
"social",
|
|
89
119
|
sensitive=True,
|
|
90
120
|
),
|
|
91
|
-
EnvVar("SCITEX_REDDIT_CLIENT_ID", "Reddit client ID", "social", sensitive=True),
|
|
92
121
|
EnvVar(
|
|
93
|
-
"
|
|
122
|
+
"SCITEX_SOCIAL_REDDIT_CLIENT_ID",
|
|
123
|
+
"Reddit client ID",
|
|
124
|
+
"social",
|
|
125
|
+
sensitive=True,
|
|
126
|
+
),
|
|
127
|
+
EnvVar(
|
|
128
|
+
"SCITEX_SOCIAL_REDDIT_CLIENT_SECRET",
|
|
94
129
|
"Reddit client secret",
|
|
95
130
|
"social",
|
|
96
131
|
sensitive=True,
|
|
97
132
|
),
|
|
98
|
-
EnvVar(
|
|
99
|
-
|
|
133
|
+
EnvVar(
|
|
134
|
+
"SCITEX_SOCIAL_YOUTUBE_API_KEY",
|
|
135
|
+
"YouTube API key",
|
|
136
|
+
"social",
|
|
137
|
+
sensitive=True,
|
|
138
|
+
),
|
|
139
|
+
EnvVar(
|
|
140
|
+
"SCITEX_SOCIAL_YOUTUBE_CLIENT_SECRETS_FILE",
|
|
141
|
+
"YouTube client secrets file path",
|
|
142
|
+
"social",
|
|
143
|
+
),
|
|
144
|
+
EnvVar(
|
|
145
|
+
"SCITEX_SOCIAL_GOOGLE_ANALYTICS_PROPERTY_ID",
|
|
146
|
+
"Google Analytics property ID",
|
|
147
|
+
"social",
|
|
148
|
+
),
|
|
149
|
+
EnvVar(
|
|
150
|
+
"SCITEX_SOCIAL_GOOGLE_ANALYTICS_MEASUREMENT_ID",
|
|
151
|
+
"Google Analytics measurement ID",
|
|
152
|
+
"social",
|
|
153
|
+
),
|
|
154
|
+
EnvVar(
|
|
155
|
+
"SCITEX_SOCIAL_GOOGLE_ANALYTICS_API_SECRET",
|
|
156
|
+
"Google Analytics API secret",
|
|
157
|
+
"social",
|
|
158
|
+
sensitive=True,
|
|
159
|
+
),
|
|
160
|
+
EnvVar(
|
|
161
|
+
"SCITEX_SOCIAL_GOOGLE_APPLICATION_CREDENTIALS",
|
|
162
|
+
"Google service account credentials path",
|
|
163
|
+
"social",
|
|
164
|
+
),
|
|
100
165
|
# Cloud
|
|
101
166
|
EnvVar("SCITEX_CLOUD_USERNAME", "Cloud username", "cloud", sensitive=True),
|
|
102
167
|
EnvVar("SCITEX_CLOUD_PASSWORD", "Cloud password", "cloud", sensitive=True),
|
|
@@ -116,9 +181,9 @@ ENV_REGISTRY: List[EnvVar] = [
|
|
|
116
181
|
EnvVar("SCITEX_UI_WARNING_BACKENDS", "Backends for warning notifications", "ui"),
|
|
117
182
|
EnvVar("SCITEX_UI_ERROR_BACKENDS", "Backends for error notifications", "ui"),
|
|
118
183
|
EnvVar("SCITEX_UI_CRITICAL_BACKENDS", "Backends for critical notifications", "ui"),
|
|
119
|
-
EnvVar("
|
|
120
|
-
EnvVar("
|
|
121
|
-
EnvVar("
|
|
184
|
+
EnvVar("SCITEX_UI_EMAIL_NOTIFICATION_FROM", "Email notification sender", "ui"),
|
|
185
|
+
EnvVar("SCITEX_UI_EMAIL_NOTIFICATION_TO", "Email notification recipient", "ui"),
|
|
186
|
+
EnvVar("SCITEX_UI_WEBHOOK_URL", "Webhook URL for notifications", "ui"),
|
|
122
187
|
# Capture
|
|
123
188
|
EnvVar("SCITEX_CAPTURE_DIR", "Screenshot capture directory", "capture"),
|
|
124
189
|
# Web
|
|
@@ -126,8 +191,8 @@ ENV_REGISTRY: List[EnvVar] = [
|
|
|
126
191
|
# PLT
|
|
127
192
|
EnvVar("SCITEX_PLT_AXES_WIDTH_MM", "Default axes width in mm", "plt"),
|
|
128
193
|
EnvVar("SCITEX_PLT_LINES_TRACE_MM", "Default line trace width in mm", "plt"),
|
|
129
|
-
EnvVar("
|
|
130
|
-
EnvVar("
|
|
194
|
+
EnvVar("SCITEX_PLT_STYLE", "Default plot style", "plt"),
|
|
195
|
+
EnvVar("SCITEX_PLT_COLORS", "Color palette to use", "plt"),
|
|
131
196
|
]
|
|
132
197
|
|
|
133
198
|
|
scitex/context/__init__.py
CHANGED
|
@@ -1,9 +1,31 @@
|
|
|
1
1
|
#!/usr/bin/env python3
|
|
2
2
|
"""Scitex context module."""
|
|
3
3
|
|
|
4
|
+
from ._detect_environment import (
|
|
5
|
+
detect_environment,
|
|
6
|
+
get_output_directory,
|
|
7
|
+
is_ipython,
|
|
8
|
+
is_notebook,
|
|
9
|
+
is_script,
|
|
10
|
+
)
|
|
11
|
+
from ._get_notebook_path import (
|
|
12
|
+
get_notebook_directory,
|
|
13
|
+
get_notebook_info_simple,
|
|
14
|
+
get_notebook_name,
|
|
15
|
+
get_notebook_path,
|
|
16
|
+
)
|
|
4
17
|
from ._suppress_output import quiet, suppress_output
|
|
5
18
|
|
|
6
19
|
__all__ = [
|
|
20
|
+
"detect_environment",
|
|
21
|
+
"get_notebook_directory",
|
|
22
|
+
"get_notebook_info_simple",
|
|
23
|
+
"get_notebook_name",
|
|
24
|
+
"get_notebook_path",
|
|
25
|
+
"get_output_directory",
|
|
26
|
+
"is_ipython",
|
|
27
|
+
"is_notebook",
|
|
28
|
+
"is_script",
|
|
7
29
|
"quiet",
|
|
8
30
|
"suppress_output",
|
|
9
31
|
]
|