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.
Files changed (101) hide show
  1. scitex/_mcp_tools/audio.py +11 -65
  2. scitex/audio/README.md +40 -12
  3. scitex/audio/__init__.py +27 -235
  4. scitex/audio/_audio_check.py +93 -0
  5. scitex/audio/_mcp/speak_handlers.py +56 -8
  6. scitex/audio/_speak.py +295 -0
  7. scitex/audio/mcp_server.py +98 -73
  8. scitex/scholar/url_finder/.tmp/open_url/KNOWN_RESOLVERS.py +462 -0
  9. scitex/scholar/url_finder/.tmp/open_url/README.md +223 -0
  10. scitex/scholar/url_finder/.tmp/open_url/_DOIToURLResolver.py +694 -0
  11. scitex/scholar/url_finder/.tmp/open_url/_OpenURLResolver.py +1160 -0
  12. scitex/scholar/url_finder/.tmp/open_url/_ResolverLinkFinder.py +344 -0
  13. scitex/scholar/url_finder/.tmp/open_url/__init__.py +24 -0
  14. scitex/social/__init__.py +1 -24
  15. scitex/writer/README.md +25 -409
  16. scitex/writer/__init__.py +98 -13
  17. {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/METADATA +6 -1
  18. {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/RECORD +21 -93
  19. scitex/dev/plt/data/mpl/PLOTTING_FUNCTIONS.yaml +0 -90
  20. scitex/dev/plt/data/mpl/PLOTTING_SIGNATURES.yaml +0 -1571
  21. scitex/dev/plt/data/mpl/PLOTTING_SIGNATURES_DETAILED.yaml +0 -6262
  22. scitex/dev/plt/data/mpl/SIGNATURES_FLATTENED.yaml +0 -1274
  23. scitex/dev/plt/data/mpl/dir_ax.txt +0 -459
  24. scitex/scholar/data/.gitkeep +0 -0
  25. scitex/scholar/data/README.md +0 -44
  26. scitex/scholar/data/bib_files/bibliography.bib +0 -1952
  27. scitex/scholar/data/bib_files/neurovista.bib +0 -277
  28. scitex/scholar/data/bib_files/neurovista_enriched.bib +0 -441
  29. scitex/scholar/data/bib_files/neurovista_enriched_enriched.bib +0 -441
  30. scitex/scholar/data/bib_files/neurovista_processed.bib +0 -338
  31. scitex/scholar/data/bib_files/openaccess.bib +0 -89
  32. scitex/scholar/data/bib_files/pac-seizure_prediction_enriched.bib +0 -2178
  33. scitex/scholar/data/bib_files/pac.bib +0 -698
  34. scitex/scholar/data/bib_files/pac_enriched.bib +0 -1061
  35. scitex/scholar/data/bib_files/pac_processed.bib +0 -0
  36. scitex/scholar/data/bib_files/pac_titles.txt +0 -75
  37. scitex/scholar/data/bib_files/paywalled.bib +0 -98
  38. scitex/scholar/data/bib_files/related-papers-by-coauthors.bib +0 -58
  39. scitex/scholar/data/bib_files/related-papers-by-coauthors_enriched.bib +0 -87
  40. scitex/scholar/data/bib_files/seizure_prediction.bib +0 -694
  41. scitex/scholar/data/bib_files/seizure_prediction_processed.bib +0 -0
  42. scitex/scholar/data/bib_files/test_complete_enriched.bib +0 -437
  43. scitex/scholar/data/bib_files/test_final_enriched.bib +0 -437
  44. scitex/scholar/data/bib_files/test_seizure.bib +0 -46
  45. scitex/scholar/data/impact_factor/JCR_IF_2022.xlsx +0 -0
  46. scitex/scholar/data/impact_factor/JCR_IF_2024.db +0 -0
  47. scitex/scholar/data/impact_factor/JCR_IF_2024.xlsx +0 -0
  48. scitex/scholar/data/impact_factor/JCR_IF_2024_v01.db +0 -0
  49. scitex/scholar/data/impact_factor.db +0 -0
  50. scitex/writer/Writer.py +0 -487
  51. scitex/writer/_clone_writer_project.py +0 -160
  52. scitex/writer/_compile/__init__.py +0 -41
  53. scitex/writer/_compile/_compile_async.py +0 -130
  54. scitex/writer/_compile/_compile_unified.py +0 -148
  55. scitex/writer/_compile/_parser.py +0 -63
  56. scitex/writer/_compile/_runner.py +0 -457
  57. scitex/writer/_compile/_validator.py +0 -46
  58. scitex/writer/_compile/manuscript.py +0 -110
  59. scitex/writer/_compile/revision.py +0 -82
  60. scitex/writer/_compile/supplementary.py +0 -100
  61. scitex/writer/_dataclasses/__init__.py +0 -44
  62. scitex/writer/_dataclasses/config/_CONSTANTS.py +0 -46
  63. scitex/writer/_dataclasses/config/_WriterConfig.py +0 -175
  64. scitex/writer/_dataclasses/config/__init__.py +0 -9
  65. scitex/writer/_dataclasses/contents/_ManuscriptContents.py +0 -236
  66. scitex/writer/_dataclasses/contents/_RevisionContents.py +0 -136
  67. scitex/writer/_dataclasses/contents/_SupplementaryContents.py +0 -114
  68. scitex/writer/_dataclasses/contents/__init__.py +0 -9
  69. scitex/writer/_dataclasses/core/_Document.py +0 -146
  70. scitex/writer/_dataclasses/core/_DocumentSection.py +0 -546
  71. scitex/writer/_dataclasses/core/__init__.py +0 -7
  72. scitex/writer/_dataclasses/results/_CompilationResult.py +0 -165
  73. scitex/writer/_dataclasses/results/_LaTeXIssue.py +0 -102
  74. scitex/writer/_dataclasses/results/_SaveSectionsResponse.py +0 -118
  75. scitex/writer/_dataclasses/results/_SectionReadResponse.py +0 -131
  76. scitex/writer/_dataclasses/results/__init__.py +0 -11
  77. scitex/writer/_dataclasses/tree/MINIMUM_FILES.md +0 -121
  78. scitex/writer/_dataclasses/tree/_ConfigTree.py +0 -86
  79. scitex/writer/_dataclasses/tree/_ManuscriptTree.py +0 -84
  80. scitex/writer/_dataclasses/tree/_RevisionTree.py +0 -97
  81. scitex/writer/_dataclasses/tree/_ScriptsTree.py +0 -118
  82. scitex/writer/_dataclasses/tree/_SharedTree.py +0 -100
  83. scitex/writer/_dataclasses/tree/_SupplementaryTree.py +0 -101
  84. scitex/writer/_dataclasses/tree/__init__.py +0 -23
  85. scitex/writer/_mcp/__init__.py +0 -4
  86. scitex/writer/_mcp/handlers.py +0 -32
  87. scitex/writer/_mcp/tool_schemas.py +0 -33
  88. scitex/writer/_project/__init__.py +0 -29
  89. scitex/writer/_project/_create.py +0 -89
  90. scitex/writer/_project/_trees.py +0 -63
  91. scitex/writer/_project/_validate.py +0 -61
  92. scitex/writer/utils/.legacy_git_retry.py +0 -164
  93. scitex/writer/utils/__init__.py +0 -24
  94. scitex/writer/utils/_converters.py +0 -635
  95. scitex/writer/utils/_parse_latex_logs.py +0 -138
  96. scitex/writer/utils/_parse_script_args.py +0 -156
  97. scitex/writer/utils/_verify_tree_structure.py +0 -205
  98. scitex/writer/utils/_watch.py +0 -96
  99. {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/WHEEL +0 -0
  100. {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/entry_points.txt +0 -0
  101. {scitex-2.16.0.dist-info → scitex-2.16.2.dist-info}/licenses/LICENSE +0 -0
@@ -1,29 +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/_project/__init__.py
5
- # ----------------------------------------
6
- from __future__ import annotations
7
- import os
8
-
9
- __FILE__ = "./src/scitex/writer/_project/__init__.py"
10
- __DIR__ = os.path.dirname(__FILE__)
11
- # ----------------------------------------
12
-
13
- """
14
- Project initialization helpers for writer module.
15
-
16
- Handles project creation, attachment, and validation.
17
- """
18
-
19
- from ._create import ensure_project_exists
20
- from ._validate import validate_structure
21
- from ._trees import create_document_trees
22
-
23
- __all__ = [
24
- "ensure_project_exists",
25
- "validate_structure",
26
- "create_document_trees",
27
- ]
28
-
29
- # EOF
@@ -1,89 +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/_project/_create.py
5
- # ----------------------------------------
6
- from __future__ import annotations
7
- import os
8
-
9
- __FILE__ = "./src/scitex/writer/_project/_create.py"
10
- __DIR__ = os.path.dirname(__FILE__)
11
- # ----------------------------------------
12
-
13
- """
14
- Project creation logic for writer module.
15
-
16
- Handles creating new writer projects from template.
17
- """
18
-
19
- from pathlib import Path
20
- from typing import Optional
21
-
22
- from scitex.logging import getLogger
23
- from scitex.writer._clone_writer_project import (
24
- clone_writer_project as _clone_writer_project,
25
- )
26
-
27
- logger = getLogger(__name__)
28
-
29
-
30
- def ensure_project_exists(
31
- project_dir: Path,
32
- project_name: str,
33
- git_strategy: Optional[str] = "child",
34
- branch: Optional[str] = None,
35
- tag: Optional[str] = None,
36
- ) -> Path:
37
- """
38
- Ensure project directory exists, creating it if necessary.
39
-
40
- Parameters
41
- ----------
42
- project_dir : Path
43
- Path to project directory
44
- project_name : str
45
- Name of the project
46
- git_strategy : str or None
47
- Git initialization strategy
48
- branch : str, optional
49
- Specific branch of template repository to clone. If None, clones the default branch.
50
- Mutually exclusive with tag parameter.
51
- tag : str, optional
52
- Specific tag/release of template repository to clone. If None, clones the default branch.
53
- Mutually exclusive with branch parameter.
54
-
55
- Returns
56
- -------
57
- Path
58
- Path to the project directory
59
-
60
- Raises
61
- ------
62
- RuntimeError
63
- If project creation fails
64
- """
65
- if project_dir.exists():
66
- logger.info(f"Attached to existing project at {project_dir.absolute()}")
67
- return project_dir
68
-
69
- logger.info(f"Creating new project '{project_name}' at {project_dir.absolute()}")
70
-
71
- # Initialize project directory structure
72
- success = _clone_writer_project(str(project_dir), git_strategy, branch, tag)
73
-
74
- if not success:
75
- logger.error(f"Failed to initialize project directory for {project_name}")
76
- raise RuntimeError(f"Could not create project directory at {project_dir}")
77
-
78
- # Verify project directory was created
79
- if not project_dir.exists():
80
- logger.error(f"Project directory {project_dir} was not created")
81
- raise RuntimeError(f"Project directory {project_dir} was not created")
82
-
83
- logger.success(f"Successfully created project at {project_dir.absolute()}")
84
- return project_dir
85
-
86
-
87
- __all__ = ["ensure_project_exists"]
88
-
89
- # 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/_project/_trees.py
5
- # ----------------------------------------
6
- from __future__ import annotations
7
- import os
8
-
9
- __FILE__ = "./src/scitex/writer/_project/_trees.py"
10
- __DIR__ = os.path.dirname(__FILE__)
11
- # ----------------------------------------
12
-
13
- """
14
- Document tree creation for writer module.
15
-
16
- Creates and initializes document tree objects for manuscript, supplementary,
17
- revision, and scripts.
18
- """
19
-
20
- from pathlib import Path
21
- from typing import Optional, Tuple
22
-
23
- from scitex.logging import getLogger
24
- from scitex.writer._dataclasses import ManuscriptTree, SupplementaryTree, RevisionTree
25
- from scitex.writer._dataclasses.tree import ScriptsTree
26
-
27
- logger = getLogger(__name__)
28
-
29
-
30
- def create_document_trees(
31
- project_dir: Path,
32
- git_root: Optional[Path],
33
- ) -> Tuple[ManuscriptTree, SupplementaryTree, RevisionTree, ScriptsTree]:
34
- """
35
- Create document tree objects for writer project.
36
-
37
- Parameters
38
- ----------
39
- project_dir : Path
40
- Path to project directory
41
- git_root : Path or None
42
- Path to git root (for efficiency)
43
-
44
- Returns
45
- -------
46
- tuple
47
- (manuscript, supplementary, revision, scripts) tree objects
48
- """
49
- manuscript = ManuscriptTree(project_dir / "01_manuscript", git_root=git_root)
50
- supplementary = SupplementaryTree(
51
- project_dir / "02_supplementary", git_root=git_root
52
- )
53
- revision = RevisionTree(project_dir / "03_revision", git_root=git_root)
54
- scripts = ScriptsTree(project_dir / "scripts", git_root=git_root)
55
-
56
- logger.success("Document trees initialized")
57
-
58
- return manuscript, supplementary, revision, scripts
59
-
60
-
61
- __all__ = ["create_document_trees"]
62
-
63
- # EOF
@@ -1,61 +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/_project/_validate.py
5
- # ----------------------------------------
6
- from __future__ import annotations
7
- import os
8
-
9
- __FILE__ = "./src/scitex/writer/_project/_validate.py"
10
- __DIR__ = os.path.dirname(__FILE__)
11
- # ----------------------------------------
12
-
13
- """
14
- Project structure validation for writer module.
15
-
16
- Verifies that writer projects have expected directory structure.
17
- """
18
-
19
- from pathlib import Path
20
-
21
- from scitex.logging import getLogger
22
-
23
- logger = getLogger(__name__)
24
-
25
-
26
- def validate_structure(project_dir: Path) -> None:
27
- """
28
- Verify attached project has expected structure.
29
-
30
- Checks:
31
- - Required directories exist (01_manuscript, 02_supplementary, 03_revision)
32
-
33
- Parameters
34
- ----------
35
- project_dir : Path
36
- Path to project directory
37
-
38
- Raises
39
- ------
40
- RuntimeError
41
- If structure is invalid
42
- """
43
- required_dirs = [
44
- project_dir / "01_manuscript",
45
- project_dir / "02_supplementary",
46
- project_dir / "03_revision",
47
- ]
48
-
49
- for dir_path in required_dirs:
50
- if not dir_path.exists():
51
- logger.error(f"Expected directory missing: {dir_path}")
52
- raise RuntimeError(
53
- f"Project structure invalid: missing {dir_path.name} directory (expected at: {dir_path})"
54
- )
55
-
56
- logger.success(f"Project structure verified at {project_dir.absolute()}")
57
-
58
-
59
- __all__ = ["validate_structure"]
60
-
61
- # EOF
@@ -1,164 +0,0 @@
1
- #!/usr/bin/env python3
2
- # Timestamp: "2025-10-28 17:10:52 (ywatanabe)"
3
- # File: /home/ywatanabe/proj/scitex-code/src/scitex/writer/git_utils.py
4
- # ----------------------------------------
5
- from __future__ import annotations
6
-
7
- import os
8
-
9
- __FILE__ = "./src/scitex/writer/git_utils.py"
10
- __DIR__ = os.path.dirname(__FILE__)
11
- # ----------------------------------------
12
-
13
- """
14
- Git utilities for Writer.
15
-
16
- Provides git lock handling and retry logic for concurrent access.
17
- """
18
-
19
- import subprocess
20
- import time
21
- from typing import Callable, TypeVar
22
-
23
- from scitex.logging import getLogger
24
-
25
- logger = getLogger(__name__)
26
-
27
- T = TypeVar("T")
28
-
29
-
30
- def git_retry(
31
- operation: Callable[[], T],
32
- max_retries: int = 5,
33
- initial_delay: float = 0.1,
34
- max_delay: float = 2.0,
35
- backoff_factor: float = 2.0,
36
- ) -> T:
37
- """
38
- Retry git operations with exponential backoff.
39
-
40
- Handles git index.lock conflicts when multiple processes access git.
41
-
42
- Args:
43
- operation: Function to retry
44
- max_retries: Maximum number of retry attempts
45
- initial_delay: Initial delay in seconds
46
- max_delay: Maximum delay between retries
47
- backoff_factor: Exponential backoff multiplier
48
-
49
- Returns:
50
- Result of operation
51
-
52
- Raises:
53
- TimeoutError: If all retries exhausted due to lock
54
- Exception: Original exception if not a lock error
55
-
56
- Example:
57
- >>> def commit_file():
58
- ... subprocess.run(["git", "commit", "-m", "msg"], check=True)
59
- >>> git_retry(commit_file)
60
- """
61
- delay = initial_delay
62
- last_exception = None
63
-
64
- for attempt in range(max_retries):
65
- try:
66
- return operation()
67
- except subprocess.CalledProcessError as e:
68
- # Check if it's a lock error
69
- stderr = (
70
- e.stderr
71
- if isinstance(e.stderr, str)
72
- else (e.stderr.decode("utf-8", errors="ignore") if e.stderr else "")
73
- )
74
-
75
- if "index.lock" in stderr and attempt < max_retries - 1:
76
- logger.debug(
77
- f"Git lock detected, retrying in {delay:.2f}s "
78
- f"(attempt {attempt + 1}/{max_retries})"
79
- )
80
- time.sleep(delay)
81
- delay = min(delay * backoff_factor, max_delay)
82
- last_exception = e
83
- continue
84
-
85
- # Not a lock error, or retries exhausted
86
- raise
87
- except Exception:
88
- # Non-git errors: don't retry
89
- raise
90
-
91
- # All retries exhausted
92
- if last_exception:
93
- raise TimeoutError(
94
- f"Could not acquire git lock after {max_retries} attempts"
95
- ) from last_exception
96
-
97
-
98
- def run_session() -> None:
99
- """Initialize scitex framework, run main function, and cleanup."""
100
- global CONFIG, CC, sys, plt, rng
101
- import sys
102
-
103
- import matplotlib.pyplot as plt
104
-
105
- import scitex as stx
106
-
107
- args = parse_args()
108
-
109
- CONFIG, sys.stdout, sys.stderr, plt, CC, rng = stx.session.start(
110
- sys,
111
- plt,
112
- args=args,
113
- file=__FILE__,
114
- sdir_suffix=None,
115
- verbose=False,
116
- agg=True,
117
- )
118
-
119
- exit_status = main(args)
120
-
121
- stx.session.close(
122
- CONFIG,
123
- verbose=False,
124
- notify=False,
125
- message="",
126
- exit_status=exit_status,
127
- )
128
-
129
-
130
- def main(args):
131
- def demo_operation():
132
- print("Simulating git operation...")
133
- return "Success"
134
-
135
- result = git_retry(demo_operation, max_retries=args.max_retries)
136
- print(f"Result: {result}")
137
- return 0
138
-
139
-
140
- def parse_args():
141
- import argparse
142
-
143
- parser = argparse.ArgumentParser(
144
- description="Demonstrate git retry with exponential backoff"
145
- )
146
- parser.add_argument(
147
- "--max-retries",
148
- type=int,
149
- default=5,
150
- help="Maximum retry attempts (default: 5)",
151
- )
152
-
153
- return parser.parse_args()
154
-
155
-
156
- if __name__ == "__main__":
157
- run_session()
158
-
159
-
160
- __all__ = ["git_retry"]
161
-
162
- # python -m scitex.writer.utils._git_retry --max-retries 3
163
-
164
- # EOF
@@ -1,24 +0,0 @@
1
- #!/usr/bin/env python3
2
- # File: /home/ywatanabe/proj/scitex-code/src/scitex/writer/utils/__init__.py
3
-
4
- """Utility functions for writer module."""
5
-
6
- from scitex.writer.utils._converters import (
7
- convert_figure,
8
- csv2latex,
9
- latex2csv,
10
- list_figures,
11
- pdf_to_images,
12
- )
13
- from scitex.writer.utils._verify_tree_structure import verify_tree_structure
14
-
15
- __all__ = [
16
- "convert_figure",
17
- "csv2latex",
18
- "latex2csv",
19
- "list_figures",
20
- "pdf_to_images",
21
- "verify_tree_structure",
22
- ]
23
-
24
- # EOF