scitex 2.16.0__py3-none-any.whl → 2.16.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/_mcp_tools/audio.py +11 -65
- scitex/audio/README.md +40 -12
- scitex/audio/__init__.py +27 -235
- scitex/audio/_audio_check.py +93 -0
- scitex/audio/_mcp/speak_handlers.py +56 -8
- scitex/audio/_speak.py +295 -0
- scitex/audio/mcp_server.py +98 -73
- scitex/scholar/url_finder/.tmp/open_url/KNOWN_RESOLVERS.py +462 -0
- scitex/scholar/url_finder/.tmp/open_url/README.md +223 -0
- scitex/scholar/url_finder/.tmp/open_url/_DOIToURLResolver.py +694 -0
- scitex/scholar/url_finder/.tmp/open_url/_OpenURLResolver.py +1160 -0
- scitex/scholar/url_finder/.tmp/open_url/_ResolverLinkFinder.py +344 -0
- scitex/scholar/url_finder/.tmp/open_url/__init__.py +24 -0
- scitex/social/__init__.py +1 -24
- scitex/writer/README.md +25 -409
- scitex/writer/__init__.py +98 -13
- {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/METADATA +6 -1
- {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/RECORD +21 -93
- scitex/dev/plt/data/mpl/PLOTTING_FUNCTIONS.yaml +0 -90
- scitex/dev/plt/data/mpl/PLOTTING_SIGNATURES.yaml +0 -1571
- scitex/dev/plt/data/mpl/PLOTTING_SIGNATURES_DETAILED.yaml +0 -6262
- scitex/dev/plt/data/mpl/SIGNATURES_FLATTENED.yaml +0 -1274
- scitex/dev/plt/data/mpl/dir_ax.txt +0 -459
- scitex/scholar/data/.gitkeep +0 -0
- scitex/scholar/data/README.md +0 -44
- scitex/scholar/data/bib_files/bibliography.bib +0 -1952
- scitex/scholar/data/bib_files/neurovista.bib +0 -277
- scitex/scholar/data/bib_files/neurovista_enriched.bib +0 -441
- scitex/scholar/data/bib_files/neurovista_enriched_enriched.bib +0 -441
- scitex/scholar/data/bib_files/neurovista_processed.bib +0 -338
- scitex/scholar/data/bib_files/openaccess.bib +0 -89
- scitex/scholar/data/bib_files/pac-seizure_prediction_enriched.bib +0 -2178
- scitex/scholar/data/bib_files/pac.bib +0 -698
- scitex/scholar/data/bib_files/pac_enriched.bib +0 -1061
- scitex/scholar/data/bib_files/pac_processed.bib +0 -0
- scitex/scholar/data/bib_files/pac_titles.txt +0 -75
- scitex/scholar/data/bib_files/paywalled.bib +0 -98
- scitex/scholar/data/bib_files/related-papers-by-coauthors.bib +0 -58
- scitex/scholar/data/bib_files/related-papers-by-coauthors_enriched.bib +0 -87
- scitex/scholar/data/bib_files/seizure_prediction.bib +0 -694
- scitex/scholar/data/bib_files/seizure_prediction_processed.bib +0 -0
- scitex/scholar/data/bib_files/test_complete_enriched.bib +0 -437
- scitex/scholar/data/bib_files/test_final_enriched.bib +0 -437
- scitex/scholar/data/bib_files/test_seizure.bib +0 -46
- scitex/scholar/data/impact_factor/JCR_IF_2022.xlsx +0 -0
- scitex/scholar/data/impact_factor/JCR_IF_2024.db +0 -0
- scitex/scholar/data/impact_factor/JCR_IF_2024.xlsx +0 -0
- scitex/scholar/data/impact_factor/JCR_IF_2024_v01.db +0 -0
- scitex/scholar/data/impact_factor.db +0 -0
- scitex/writer/Writer.py +0 -487
- scitex/writer/_clone_writer_project.py +0 -160
- scitex/writer/_compile/__init__.py +0 -41
- scitex/writer/_compile/_compile_async.py +0 -130
- scitex/writer/_compile/_compile_unified.py +0 -148
- scitex/writer/_compile/_parser.py +0 -63
- scitex/writer/_compile/_runner.py +0 -457
- scitex/writer/_compile/_validator.py +0 -46
- scitex/writer/_compile/manuscript.py +0 -110
- scitex/writer/_compile/revision.py +0 -82
- scitex/writer/_compile/supplementary.py +0 -100
- scitex/writer/_dataclasses/__init__.py +0 -44
- scitex/writer/_dataclasses/config/_CONSTANTS.py +0 -46
- scitex/writer/_dataclasses/config/_WriterConfig.py +0 -175
- scitex/writer/_dataclasses/config/__init__.py +0 -9
- scitex/writer/_dataclasses/contents/_ManuscriptContents.py +0 -236
- scitex/writer/_dataclasses/contents/_RevisionContents.py +0 -136
- scitex/writer/_dataclasses/contents/_SupplementaryContents.py +0 -114
- scitex/writer/_dataclasses/contents/__init__.py +0 -9
- scitex/writer/_dataclasses/core/_Document.py +0 -146
- scitex/writer/_dataclasses/core/_DocumentSection.py +0 -546
- scitex/writer/_dataclasses/core/__init__.py +0 -7
- scitex/writer/_dataclasses/results/_CompilationResult.py +0 -165
- scitex/writer/_dataclasses/results/_LaTeXIssue.py +0 -102
- scitex/writer/_dataclasses/results/_SaveSectionsResponse.py +0 -118
- scitex/writer/_dataclasses/results/_SectionReadResponse.py +0 -131
- scitex/writer/_dataclasses/results/__init__.py +0 -11
- scitex/writer/_dataclasses/tree/MINIMUM_FILES.md +0 -121
- scitex/writer/_dataclasses/tree/_ConfigTree.py +0 -86
- scitex/writer/_dataclasses/tree/_ManuscriptTree.py +0 -84
- scitex/writer/_dataclasses/tree/_RevisionTree.py +0 -97
- scitex/writer/_dataclasses/tree/_ScriptsTree.py +0 -118
- scitex/writer/_dataclasses/tree/_SharedTree.py +0 -100
- scitex/writer/_dataclasses/tree/_SupplementaryTree.py +0 -101
- scitex/writer/_dataclasses/tree/__init__.py +0 -23
- scitex/writer/_mcp/__init__.py +0 -4
- scitex/writer/_mcp/handlers.py +0 -32
- scitex/writer/_mcp/tool_schemas.py +0 -33
- scitex/writer/_project/__init__.py +0 -29
- scitex/writer/_project/_create.py +0 -89
- scitex/writer/_project/_trees.py +0 -63
- scitex/writer/_project/_validate.py +0 -61
- scitex/writer/utils/.legacy_git_retry.py +0 -164
- scitex/writer/utils/__init__.py +0 -24
- scitex/writer/utils/_converters.py +0 -635
- scitex/writer/utils/_parse_latex_logs.py +0 -138
- scitex/writer/utils/_parse_script_args.py +0 -156
- scitex/writer/utils/_verify_tree_structure.py +0 -205
- scitex/writer/utils/_watch.py +0 -96
- {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/WHEEL +0 -0
- {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/entry_points.txt +0 -0
- {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/licenses/LICENSE +0 -0
|
@@ -1,130 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# Timestamp: "2025-10-28 17:43:50 (ywatanabe)"
|
|
3
|
-
# File: /home/ywatanabe/proj/scitex-code/src/scitex/writer/_compile_async.py
|
|
4
|
-
# ----------------------------------------
|
|
5
|
-
from __future__ import annotations
|
|
6
|
-
|
|
7
|
-
import os
|
|
8
|
-
|
|
9
|
-
__FILE__ = "./src/scitex/writer/_compile_async.py"
|
|
10
|
-
__DIR__ = os.path.dirname(__FILE__)
|
|
11
|
-
# ----------------------------------------
|
|
12
|
-
|
|
13
|
-
"""
|
|
14
|
-
Asynchronous compilation support for writer module.
|
|
15
|
-
|
|
16
|
-
Allows non-blocking compilation operations for concurrent workflows.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
import asyncio
|
|
20
|
-
from concurrent.futures import ThreadPoolExecutor
|
|
21
|
-
from functools import partial, wraps
|
|
22
|
-
from pathlib import Path
|
|
23
|
-
from typing import Any, Callable
|
|
24
|
-
|
|
25
|
-
from scitex.logging import getLogger
|
|
26
|
-
|
|
27
|
-
from .._dataclasses import CompilationResult
|
|
28
|
-
from .manuscript import compile_manuscript
|
|
29
|
-
from .revision import compile_revision
|
|
30
|
-
from .supplementary import compile_supplementary
|
|
31
|
-
|
|
32
|
-
logger = getLogger(__name__)
|
|
33
|
-
|
|
34
|
-
# Thread pool for async operations
|
|
35
|
-
_executor = ThreadPoolExecutor(max_workers=2)
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
def _make_async_wrapper(sync_func: Callable) -> Callable:
|
|
39
|
-
"""
|
|
40
|
-
Factory function to create async wrappers for sync compilation functions.
|
|
41
|
-
|
|
42
|
-
Args:
|
|
43
|
-
sync_func: Synchronous compilation function
|
|
44
|
-
|
|
45
|
-
Returns
|
|
46
|
-
-------
|
|
47
|
-
Async wrapper function
|
|
48
|
-
"""
|
|
49
|
-
|
|
50
|
-
@wraps(sync_func)
|
|
51
|
-
async def async_wrapper(*args: Any, **kwargs: Any) -> CompilationResult:
|
|
52
|
-
loop = asyncio.get_event_loop()
|
|
53
|
-
# Use partial to bind kwargs since run_in_executor only accepts positional args
|
|
54
|
-
bound_func = partial(sync_func, *args, **kwargs)
|
|
55
|
-
return await loop.run_in_executor(_executor, bound_func)
|
|
56
|
-
|
|
57
|
-
return async_wrapper
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
# Create async wrappers using factory function
|
|
61
|
-
compile_manuscript_async = _make_async_wrapper(compile_manuscript)
|
|
62
|
-
compile_supplementary_async = _make_async_wrapper(compile_supplementary)
|
|
63
|
-
compile_revision_async = _make_async_wrapper(compile_revision)
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
async def compile_all_async(
|
|
67
|
-
project_dir: Path, track_changes: bool = False, timeout: int = 300
|
|
68
|
-
) -> dict:
|
|
69
|
-
"""
|
|
70
|
-
Compile all document dataclasses concurrently.
|
|
71
|
-
|
|
72
|
-
Runs all three document compilations in parallel for faster overall completion.
|
|
73
|
-
|
|
74
|
-
Args:
|
|
75
|
-
project_dir: Path to writer project
|
|
76
|
-
track_changes: Whether to track changes in revision
|
|
77
|
-
timeout: Timeout per compilation
|
|
78
|
-
|
|
79
|
-
Returns
|
|
80
|
-
-------
|
|
81
|
-
Dict with keys 'manuscript', 'supplementary', 'revision' and CompilationResult values.
|
|
82
|
-
If a compilation fails, the value will be None.
|
|
83
|
-
|
|
84
|
-
Example:
|
|
85
|
-
>>> results = await compile_all_async(Path("my_paper"))
|
|
86
|
-
>>> for doc_type, result in results.items():
|
|
87
|
-
... if result and result.success:
|
|
88
|
-
... print(f"{doc_type}: OK")
|
|
89
|
-
... else:
|
|
90
|
-
... print(f"{doc_type}: FAILED")
|
|
91
|
-
"""
|
|
92
|
-
logger.info(f"Starting concurrent compilation of all documents in {project_dir}")
|
|
93
|
-
|
|
94
|
-
try:
|
|
95
|
-
results = await asyncio.gather(
|
|
96
|
-
compile_manuscript_async(project_dir, timeout=timeout),
|
|
97
|
-
compile_supplementary_async(project_dir, timeout=timeout),
|
|
98
|
-
compile_revision_async(project_dir, track_changes, timeout=timeout),
|
|
99
|
-
return_exceptions=True,
|
|
100
|
-
)
|
|
101
|
-
except Exception as e:
|
|
102
|
-
logger.error(f"Error during concurrent compilation: {e}")
|
|
103
|
-
return {
|
|
104
|
-
"manuscript": None,
|
|
105
|
-
"supplementary": None,
|
|
106
|
-
"revision": None,
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
# Handle exceptions and convert to None
|
|
110
|
-
def safe_result(result):
|
|
111
|
-
if isinstance(result, Exception):
|
|
112
|
-
logger.error(f"Compilation exception: {result}")
|
|
113
|
-
return None
|
|
114
|
-
return result
|
|
115
|
-
|
|
116
|
-
return {
|
|
117
|
-
"manuscript": safe_result(results[0]),
|
|
118
|
-
"supplementary": safe_result(results[1]),
|
|
119
|
-
"revision": safe_result(results[2]),
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
__all__ = [
|
|
124
|
-
"compile_manuscript_async",
|
|
125
|
-
"compile_supplementary_async",
|
|
126
|
-
"compile_revision_async",
|
|
127
|
-
"compile_all_async",
|
|
128
|
-
]
|
|
129
|
-
|
|
130
|
-
# EOF
|
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# File: /home/ywatanabe/proj/scitex-code/src/scitex/writer/_compile_unified.py
|
|
3
|
-
|
|
4
|
-
"""
|
|
5
|
-
Unified compilation interface for writer module.
|
|
6
|
-
|
|
7
|
-
Provides a single `compile()` function that handles all document types
|
|
8
|
-
with optional async support.
|
|
9
|
-
"""
|
|
10
|
-
|
|
11
|
-
from __future__ import annotations
|
|
12
|
-
|
|
13
|
-
import asyncio
|
|
14
|
-
from pathlib import Path
|
|
15
|
-
from typing import Literal, Optional, Union
|
|
16
|
-
|
|
17
|
-
from .._dataclasses import CompilationResult
|
|
18
|
-
from ._compile_async import (
|
|
19
|
-
compile_all_async,
|
|
20
|
-
compile_manuscript_async,
|
|
21
|
-
compile_revision_async,
|
|
22
|
-
compile_supplementary_async,
|
|
23
|
-
)
|
|
24
|
-
from .manuscript import compile_manuscript
|
|
25
|
-
from .revision import compile_revision
|
|
26
|
-
from .supplementary import compile_supplementary
|
|
27
|
-
|
|
28
|
-
DocType = Literal["manuscript", "supplementary", "revision", "all"]
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
def compile(
|
|
32
|
-
*doc_types: DocType,
|
|
33
|
-
project_dir: Optional[Path] = None,
|
|
34
|
-
async_: bool = False,
|
|
35
|
-
track_changes: bool = False,
|
|
36
|
-
timeout: int = 300,
|
|
37
|
-
) -> Union[CompilationResult, dict, asyncio.coroutine]:
|
|
38
|
-
"""
|
|
39
|
-
Unified compilation function for LaTeX documents.
|
|
40
|
-
|
|
41
|
-
Args:
|
|
42
|
-
*doc_types: Document types to compile. One or more of:
|
|
43
|
-
- "manuscript": Main document
|
|
44
|
-
- "supplementary": Supplementary materials
|
|
45
|
-
- "revision": Revision response
|
|
46
|
-
- "all": All document types (async only)
|
|
47
|
-
project_dir: Path to writer project directory
|
|
48
|
-
async_: If True, returns awaitable coroutine
|
|
49
|
-
track_changes: Enable change tracking for revision (default: False)
|
|
50
|
-
timeout: Compilation timeout in seconds (default: 300)
|
|
51
|
-
|
|
52
|
-
Returns
|
|
53
|
-
-------
|
|
54
|
-
- Single doc_type (sync): CompilationResult
|
|
55
|
-
- Multiple doc_types (sync): dict of {doc_type: CompilationResult}
|
|
56
|
-
- async_=True: Awaitable coroutine returning above
|
|
57
|
-
|
|
58
|
-
Examples
|
|
59
|
-
--------
|
|
60
|
-
>>> # Sync single document
|
|
61
|
-
>>> result = compile("manuscript", project_dir=Path("."))
|
|
62
|
-
|
|
63
|
-
>>> # Sync multiple documents
|
|
64
|
-
>>> results = compile("manuscript", "supplementary", project_dir=Path("."))
|
|
65
|
-
>>> results["manuscript"].success
|
|
66
|
-
|
|
67
|
-
>>> # Async single document
|
|
68
|
-
>>> result = await compile("manuscript", project_dir=Path("."), async_=True)
|
|
69
|
-
|
|
70
|
-
>>> # Async all documents (parallel)
|
|
71
|
-
>>> results = await compile("all", project_dir=Path("."), async_=True)
|
|
72
|
-
"""
|
|
73
|
-
if not doc_types:
|
|
74
|
-
raise ValueError("At least one document type required")
|
|
75
|
-
|
|
76
|
-
if project_dir is None:
|
|
77
|
-
raise ValueError("project_dir is required")
|
|
78
|
-
|
|
79
|
-
project_dir = Path(project_dir)
|
|
80
|
-
|
|
81
|
-
# Map doc types to functions
|
|
82
|
-
sync_funcs = {
|
|
83
|
-
"manuscript": lambda: compile_manuscript(project_dir, timeout=timeout),
|
|
84
|
-
"supplementary": lambda: compile_supplementary(project_dir, timeout=timeout),
|
|
85
|
-
"revision": lambda: compile_revision(
|
|
86
|
-
project_dir, track_changes, timeout=timeout
|
|
87
|
-
),
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
async_funcs = {
|
|
91
|
-
"manuscript": lambda: compile_manuscript_async(project_dir, timeout=timeout),
|
|
92
|
-
"supplementary": lambda: compile_supplementary_async(
|
|
93
|
-
project_dir, timeout=timeout
|
|
94
|
-
),
|
|
95
|
-
"revision": lambda: compile_revision_async(
|
|
96
|
-
project_dir, track_changes, timeout=timeout
|
|
97
|
-
),
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
# Handle "all" special case
|
|
101
|
-
if "all" in doc_types:
|
|
102
|
-
if async_:
|
|
103
|
-
return compile_all_async(
|
|
104
|
-
project_dir, track_changes=track_changes, timeout=timeout
|
|
105
|
-
)
|
|
106
|
-
else:
|
|
107
|
-
# Sync "all" - compile sequentially
|
|
108
|
-
return {
|
|
109
|
-
"manuscript": sync_funcs["manuscript"](),
|
|
110
|
-
"supplementary": sync_funcs["supplementary"](),
|
|
111
|
-
"revision": sync_funcs["revision"](),
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
# Validate doc types
|
|
115
|
-
valid_types = {"manuscript", "supplementary", "revision"}
|
|
116
|
-
for dt in doc_types:
|
|
117
|
-
if dt not in valid_types:
|
|
118
|
-
raise ValueError(
|
|
119
|
-
f"Invalid document type: {dt}. Must be one of {valid_types}"
|
|
120
|
-
)
|
|
121
|
-
|
|
122
|
-
# Single document
|
|
123
|
-
if len(doc_types) == 1:
|
|
124
|
-
doc_type = doc_types[0]
|
|
125
|
-
if async_:
|
|
126
|
-
return async_funcs[doc_type]()
|
|
127
|
-
else:
|
|
128
|
-
return sync_funcs[doc_type]()
|
|
129
|
-
|
|
130
|
-
# Multiple documents
|
|
131
|
-
if async_:
|
|
132
|
-
|
|
133
|
-
async def _compile_multiple():
|
|
134
|
-
tasks = [async_funcs[dt]() for dt in doc_types]
|
|
135
|
-
results = await asyncio.gather(*tasks, return_exceptions=True)
|
|
136
|
-
return {
|
|
137
|
-
dt: (None if isinstance(r, Exception) else r)
|
|
138
|
-
for dt, r in zip(doc_types, results)
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
return _compile_multiple()
|
|
142
|
-
else:
|
|
143
|
-
return {dt: sync_funcs[dt]() for dt in doc_types}
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
__all__ = ["compile"]
|
|
147
|
-
|
|
148
|
-
# EOF
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
# -*- coding: utf-8 -*-
|
|
3
|
-
# Timestamp: "2025-10-29 (ywatanabe)"
|
|
4
|
-
# File: /home/ywatanabe/proj/scitex-code/src/scitex/writer/_compile/_parser.py
|
|
5
|
-
# ----------------------------------------
|
|
6
|
-
from __future__ import annotations
|
|
7
|
-
import os
|
|
8
|
-
|
|
9
|
-
__FILE__ = "./src/scitex/writer/_compile/_parser.py"
|
|
10
|
-
__DIR__ = os.path.dirname(__FILE__)
|
|
11
|
-
# ----------------------------------------
|
|
12
|
-
|
|
13
|
-
"""
|
|
14
|
-
Compilation output parsing.
|
|
15
|
-
|
|
16
|
-
Parses LaTeX compilation output and log files for errors and warnings.
|
|
17
|
-
"""
|
|
18
|
-
|
|
19
|
-
from pathlib import Path
|
|
20
|
-
from typing import Tuple, List, Optional
|
|
21
|
-
|
|
22
|
-
from scitex.logging import getLogger
|
|
23
|
-
from scitex.writer.utils._parse_latex_logs import parse_compilation_output
|
|
24
|
-
|
|
25
|
-
logger = getLogger(__name__)
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
def parse_output(
|
|
29
|
-
stdout: str,
|
|
30
|
-
stderr: str,
|
|
31
|
-
log_file: Optional[Path] = None,
|
|
32
|
-
) -> Tuple[List[str], List[str]]:
|
|
33
|
-
"""
|
|
34
|
-
Parse compilation output for errors and warnings.
|
|
35
|
-
|
|
36
|
-
Parameters
|
|
37
|
-
----------
|
|
38
|
-
stdout : str
|
|
39
|
-
Standard output from compilation
|
|
40
|
-
stderr : str
|
|
41
|
-
Standard error from compilation
|
|
42
|
-
log_file : Path, optional
|
|
43
|
-
Path to LaTeX log file
|
|
44
|
-
|
|
45
|
-
Returns
|
|
46
|
-
-------
|
|
47
|
-
tuple
|
|
48
|
-
(errors, warnings) as lists of strings
|
|
49
|
-
"""
|
|
50
|
-
error_issues, warning_issues = parse_compilation_output(
|
|
51
|
-
stdout + stderr, log_file=log_file
|
|
52
|
-
)
|
|
53
|
-
|
|
54
|
-
# Convert LaTeXIssue objects to strings for backward compatibility
|
|
55
|
-
errors = [str(issue) for issue in error_issues]
|
|
56
|
-
warnings = [str(issue) for issue in warning_issues]
|
|
57
|
-
|
|
58
|
-
return errors, warnings
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
__all__ = ["parse_output"]
|
|
62
|
-
|
|
63
|
-
# EOF
|