scitex 2.17.0__py3-none-any.whl → 2.17.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/_dev/__init__.py +122 -0
- scitex/_dev/_config.py +391 -0
- scitex/_dev/_dashboard/__init__.py +11 -0
- scitex/_dev/_dashboard/_app.py +89 -0
- scitex/_dev/_dashboard/_routes.py +169 -0
- scitex/_dev/_dashboard/_scripts.py +301 -0
- scitex/_dev/_dashboard/_styles.py +205 -0
- scitex/_dev/_dashboard/_templates.py +117 -0
- scitex/_dev/_dashboard/static/version-dashboard-favicon.svg +12 -0
- scitex/_dev/_ecosystem.py +109 -0
- scitex/_dev/_github.py +360 -0
- scitex/_dev/_mcp/__init__.py +11 -0
- scitex/_dev/_mcp/handlers.py +182 -0
- scitex/_dev/_ssh.py +332 -0
- scitex/_dev/_versions.py +272 -0
- scitex/_mcp_tools/__init__.py +2 -0
- scitex/_mcp_tools/dev.py +186 -0
- scitex/audio/_audio_check.py +84 -41
- scitex/cli/capture.py +45 -22
- scitex/cli/dev.py +494 -0
- scitex/cli/main.py +2 -0
- scitex/cli/stats.py +48 -20
- scitex/cli/verify.py +33 -36
- scitex/plt/__init__.py +16 -6
- 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/template/__init__.py +18 -1
- scitex/template/clone_research_minimal.py +111 -0
- scitex/verify/README.md +0 -12
- scitex/verify/__init__.py +0 -4
- scitex/verify/_visualize.py +0 -4
- scitex/verify/_viz/__init__.py +0 -18
- {scitex-2.17.0.dist-info → scitex-2.17.3.dist-info}/METADATA +2 -1
- {scitex-2.17.0.dist-info → scitex-2.17.3.dist-info}/RECORD +41 -49
- 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/verify/_viz/_plotly.py +0 -193
- {scitex-2.17.0.dist-info → scitex-2.17.3.dist-info}/WHEEL +0 -0
- {scitex-2.17.0.dist-info → scitex-2.17.3.dist-info}/entry_points.txt +0 -0
- {scitex-2.17.0.dist-info → scitex-2.17.3.dist-info}/licenses/LICENSE +0 -0
scitex/_dev/_versions.py
ADDED
|
@@ -0,0 +1,272 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Timestamp: 2026-02-02
|
|
3
|
+
# File: scitex/_dev/_versions.py
|
|
4
|
+
|
|
5
|
+
"""Core version checking logic for the scitex ecosystem."""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import re
|
|
10
|
+
import subprocess
|
|
11
|
+
from pathlib import Path
|
|
12
|
+
from typing import Any
|
|
13
|
+
|
|
14
|
+
from ._ecosystem import ECOSYSTEM, get_all_packages, get_local_path
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def get_version_from_toml(path: Path) -> str | None:
|
|
18
|
+
"""Read version from pyproject.toml."""
|
|
19
|
+
toml_path = path / "pyproject.toml"
|
|
20
|
+
if not toml_path.exists():
|
|
21
|
+
return None
|
|
22
|
+
|
|
23
|
+
try:
|
|
24
|
+
# Python 3.11+
|
|
25
|
+
import tomllib
|
|
26
|
+
|
|
27
|
+
with open(toml_path, "rb") as f:
|
|
28
|
+
data = tomllib.load(f)
|
|
29
|
+
except ImportError:
|
|
30
|
+
try:
|
|
31
|
+
import tomli
|
|
32
|
+
|
|
33
|
+
with open(toml_path, "rb") as f:
|
|
34
|
+
data = tomli.load(f)
|
|
35
|
+
except ImportError:
|
|
36
|
+
# Fallback: regex parse
|
|
37
|
+
content = toml_path.read_text()
|
|
38
|
+
match = re.search(
|
|
39
|
+
r'^version\s*=\s*["\']([^"\']+)["\']', content, re.MULTILINE
|
|
40
|
+
)
|
|
41
|
+
return match.group(1) if match else None
|
|
42
|
+
|
|
43
|
+
return data.get("project", {}).get("version")
|
|
44
|
+
|
|
45
|
+
|
|
46
|
+
def get_version_installed(package: str) -> str | None:
|
|
47
|
+
"""Get version from importlib.metadata."""
|
|
48
|
+
try:
|
|
49
|
+
from importlib.metadata import version
|
|
50
|
+
|
|
51
|
+
return version(package)
|
|
52
|
+
except Exception:
|
|
53
|
+
return None
|
|
54
|
+
|
|
55
|
+
|
|
56
|
+
def get_git_latest_tag(path: Path) -> str | None:
|
|
57
|
+
"""Get latest git tag (version tags only)."""
|
|
58
|
+
if not path.exists():
|
|
59
|
+
return None
|
|
60
|
+
|
|
61
|
+
try:
|
|
62
|
+
result = subprocess.run(
|
|
63
|
+
["git", "describe", "--tags", "--abbrev=0", "--match", "v*"],
|
|
64
|
+
cwd=path,
|
|
65
|
+
capture_output=True,
|
|
66
|
+
text=True,
|
|
67
|
+
timeout=5,
|
|
68
|
+
)
|
|
69
|
+
if result.returncode == 0:
|
|
70
|
+
return result.stdout.strip()
|
|
71
|
+
except Exception:
|
|
72
|
+
pass
|
|
73
|
+
|
|
74
|
+
# Fallback: list all tags
|
|
75
|
+
try:
|
|
76
|
+
result = subprocess.run(
|
|
77
|
+
["git", "tag", "-l", "v*", "--sort=-v:refname"],
|
|
78
|
+
cwd=path,
|
|
79
|
+
capture_output=True,
|
|
80
|
+
text=True,
|
|
81
|
+
timeout=5,
|
|
82
|
+
)
|
|
83
|
+
if result.returncode == 0 and result.stdout.strip():
|
|
84
|
+
return result.stdout.strip().split("\n")[0]
|
|
85
|
+
except Exception:
|
|
86
|
+
pass
|
|
87
|
+
|
|
88
|
+
return None
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
def get_git_branch(path: Path) -> str | None:
|
|
92
|
+
"""Get current git branch."""
|
|
93
|
+
if not path.exists():
|
|
94
|
+
return None
|
|
95
|
+
|
|
96
|
+
try:
|
|
97
|
+
result = subprocess.run(
|
|
98
|
+
["git", "rev-parse", "--abbrev-ref", "HEAD"],
|
|
99
|
+
cwd=path,
|
|
100
|
+
capture_output=True,
|
|
101
|
+
text=True,
|
|
102
|
+
timeout=5,
|
|
103
|
+
)
|
|
104
|
+
if result.returncode == 0:
|
|
105
|
+
return result.stdout.strip()
|
|
106
|
+
except Exception:
|
|
107
|
+
pass
|
|
108
|
+
|
|
109
|
+
return None
|
|
110
|
+
|
|
111
|
+
|
|
112
|
+
def get_pypi_version(package: str) -> str | None:
|
|
113
|
+
"""Fetch latest version from PyPI API."""
|
|
114
|
+
try:
|
|
115
|
+
import urllib.request
|
|
116
|
+
|
|
117
|
+
url = f"https://pypi.org/pypi/{package}/json"
|
|
118
|
+
with urllib.request.urlopen(url, timeout=5) as response:
|
|
119
|
+
import json
|
|
120
|
+
|
|
121
|
+
data = json.loads(response.read().decode())
|
|
122
|
+
return data.get("info", {}).get("version")
|
|
123
|
+
except Exception:
|
|
124
|
+
return None
|
|
125
|
+
|
|
126
|
+
|
|
127
|
+
def _normalize_version(v: str | None) -> str | None:
|
|
128
|
+
"""Normalize version string (strip v prefix)."""
|
|
129
|
+
if v is None:
|
|
130
|
+
return None
|
|
131
|
+
return v.lstrip("v")
|
|
132
|
+
|
|
133
|
+
|
|
134
|
+
def _compare_versions(v1: str | None, v2: str | None) -> int:
|
|
135
|
+
"""Compare two version strings. Returns -1, 0, or 1."""
|
|
136
|
+
if v1 is None or v2 is None:
|
|
137
|
+
return 0
|
|
138
|
+
|
|
139
|
+
from packaging.version import Version
|
|
140
|
+
|
|
141
|
+
try:
|
|
142
|
+
ver1 = Version(_normalize_version(v1))
|
|
143
|
+
ver2 = Version(_normalize_version(v2))
|
|
144
|
+
if ver1 < ver2:
|
|
145
|
+
return -1
|
|
146
|
+
if ver1 > ver2:
|
|
147
|
+
return 1
|
|
148
|
+
return 0
|
|
149
|
+
except Exception:
|
|
150
|
+
# Fallback: string comparison
|
|
151
|
+
return 0
|
|
152
|
+
|
|
153
|
+
|
|
154
|
+
def _determine_status(info: dict[str, Any]) -> tuple[str, list[str]]:
|
|
155
|
+
"""Determine version status and issues."""
|
|
156
|
+
issues = []
|
|
157
|
+
|
|
158
|
+
toml_ver = info.get("local", {}).get("pyproject_toml")
|
|
159
|
+
installed_ver = info.get("local", {}).get("installed")
|
|
160
|
+
tag_ver = _normalize_version(info.get("git", {}).get("latest_tag"))
|
|
161
|
+
pypi_ver = info.get("remote", {}).get("pypi")
|
|
162
|
+
|
|
163
|
+
# Check local consistency
|
|
164
|
+
if toml_ver and installed_ver and toml_ver != installed_ver:
|
|
165
|
+
issues.append(f"pyproject.toml ({toml_ver}) != installed ({installed_ver})")
|
|
166
|
+
|
|
167
|
+
# Check if toml matches tag
|
|
168
|
+
if toml_ver and tag_ver and toml_ver != tag_ver:
|
|
169
|
+
issues.append(f"pyproject.toml ({toml_ver}) != git tag ({tag_ver})")
|
|
170
|
+
|
|
171
|
+
# Check pypi status
|
|
172
|
+
if toml_ver and pypi_ver:
|
|
173
|
+
cmp = _compare_versions(toml_ver, pypi_ver)
|
|
174
|
+
if cmp > 0:
|
|
175
|
+
issues.append(f"local ({toml_ver}) > pypi ({pypi_ver}) - ready to release")
|
|
176
|
+
return "unreleased", issues
|
|
177
|
+
if cmp < 0:
|
|
178
|
+
issues.append(f"local ({toml_ver}) < pypi ({pypi_ver}) - outdated")
|
|
179
|
+
return "outdated", issues
|
|
180
|
+
|
|
181
|
+
if issues:
|
|
182
|
+
return "mismatch", issues
|
|
183
|
+
|
|
184
|
+
if not toml_ver:
|
|
185
|
+
return "unavailable", ["package not found locally"]
|
|
186
|
+
|
|
187
|
+
return "ok", []
|
|
188
|
+
|
|
189
|
+
|
|
190
|
+
def list_versions(packages: list[str] | None = None) -> dict[str, Any]:
|
|
191
|
+
"""List versions for all ecosystem packages.
|
|
192
|
+
|
|
193
|
+
Parameters
|
|
194
|
+
----------
|
|
195
|
+
packages : list[str] | None
|
|
196
|
+
List of package names to check. If None, checks all ecosystem packages.
|
|
197
|
+
|
|
198
|
+
Returns
|
|
199
|
+
-------
|
|
200
|
+
dict
|
|
201
|
+
Version information for each package.
|
|
202
|
+
"""
|
|
203
|
+
if packages is None:
|
|
204
|
+
packages = get_all_packages()
|
|
205
|
+
|
|
206
|
+
result = {}
|
|
207
|
+
for pkg in packages:
|
|
208
|
+
if pkg not in ECOSYSTEM:
|
|
209
|
+
result[pkg] = {"status": "unknown", "issues": [f"'{pkg}' not in ecosystem"]}
|
|
210
|
+
continue
|
|
211
|
+
|
|
212
|
+
info: dict[str, Any] = {"local": {}, "git": {}, "remote": {}}
|
|
213
|
+
local_path = get_local_path(pkg)
|
|
214
|
+
pypi_name = ECOSYSTEM[pkg].get("pypi_name", pkg)
|
|
215
|
+
|
|
216
|
+
# Local sources
|
|
217
|
+
if local_path and local_path.exists():
|
|
218
|
+
info["local"]["pyproject_toml"] = get_version_from_toml(local_path)
|
|
219
|
+
info["local"]["installed"] = get_version_installed(pypi_name)
|
|
220
|
+
|
|
221
|
+
# Git sources
|
|
222
|
+
if local_path and local_path.exists():
|
|
223
|
+
info["git"]["latest_tag"] = get_git_latest_tag(local_path)
|
|
224
|
+
info["git"]["branch"] = get_git_branch(local_path)
|
|
225
|
+
|
|
226
|
+
# Remote sources
|
|
227
|
+
info["remote"]["pypi"] = get_pypi_version(pypi_name)
|
|
228
|
+
|
|
229
|
+
# Determine status
|
|
230
|
+
status, issues = _determine_status(info)
|
|
231
|
+
info["status"] = status
|
|
232
|
+
info["issues"] = issues
|
|
233
|
+
|
|
234
|
+
result[pkg] = info
|
|
235
|
+
|
|
236
|
+
return result
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def check_versions(packages: list[str] | None = None) -> dict[str, Any]:
|
|
240
|
+
"""Check version consistency and return detailed status.
|
|
241
|
+
|
|
242
|
+
Parameters
|
|
243
|
+
----------
|
|
244
|
+
packages : list[str] | None
|
|
245
|
+
List of package names to check. If None, checks all ecosystem packages.
|
|
246
|
+
|
|
247
|
+
Returns
|
|
248
|
+
-------
|
|
249
|
+
dict
|
|
250
|
+
Detailed version check results with overall summary.
|
|
251
|
+
"""
|
|
252
|
+
versions = list_versions(packages)
|
|
253
|
+
|
|
254
|
+
summary = {
|
|
255
|
+
"total": len(versions),
|
|
256
|
+
"ok": 0,
|
|
257
|
+
"mismatch": 0,
|
|
258
|
+
"unreleased": 0,
|
|
259
|
+
"outdated": 0,
|
|
260
|
+
"unavailable": 0,
|
|
261
|
+
"unknown": 0,
|
|
262
|
+
}
|
|
263
|
+
|
|
264
|
+
for _pkg, info in versions.items():
|
|
265
|
+
status = info.get("status", "unknown")
|
|
266
|
+
if status in summary:
|
|
267
|
+
summary[status] += 1
|
|
268
|
+
|
|
269
|
+
return {"packages": versions, "summary": summary}
|
|
270
|
+
|
|
271
|
+
|
|
272
|
+
# EOF
|
scitex/_mcp_tools/__init__.py
CHANGED
|
@@ -9,6 +9,7 @@ from .audio import register_audio_tools
|
|
|
9
9
|
from .canvas import register_canvas_tools
|
|
10
10
|
from .capture import register_capture_tools
|
|
11
11
|
from .dataset import register_dataset_tools
|
|
12
|
+
from .dev import register_dev_tools
|
|
12
13
|
from .diagram import register_diagram_tools
|
|
13
14
|
from .introspect import register_introspect_tools
|
|
14
15
|
from .plt import register_plt_tools
|
|
@@ -29,6 +30,7 @@ def register_all_tools(mcp) -> None:
|
|
|
29
30
|
register_canvas_tools(mcp)
|
|
30
31
|
register_capture_tools(mcp)
|
|
31
32
|
register_dataset_tools(mcp)
|
|
33
|
+
register_dev_tools(mcp)
|
|
32
34
|
register_diagram_tools(mcp)
|
|
33
35
|
register_introspect_tools(mcp)
|
|
34
36
|
register_plt_tools(mcp)
|
scitex/_mcp_tools/dev.py
ADDED
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
# Timestamp: 2026-02-02
|
|
3
|
+
# File: scitex/_mcp_tools/dev.py
|
|
4
|
+
|
|
5
|
+
"""MCP tool registration for developer utilities."""
|
|
6
|
+
|
|
7
|
+
from __future__ import annotations
|
|
8
|
+
|
|
9
|
+
import json
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def _json(obj) -> str:
|
|
13
|
+
"""Serialize object to JSON string."""
|
|
14
|
+
return json.dumps(obj, indent=2, default=str)
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def register_dev_tools(mcp) -> None:
|
|
18
|
+
"""Register developer tools with FastMCP server."""
|
|
19
|
+
|
|
20
|
+
@mcp.tool()
|
|
21
|
+
async def dev_list_versions(
|
|
22
|
+
packages: list[str] | None = None,
|
|
23
|
+
) -> str:
|
|
24
|
+
"""[dev] List versions across the scitex ecosystem.
|
|
25
|
+
|
|
26
|
+
Shows version information from multiple sources:
|
|
27
|
+
- pyproject.toml (local source)
|
|
28
|
+
- installed package (importlib.metadata)
|
|
29
|
+
- git tag (latest version tag)
|
|
30
|
+
- git branch (current branch)
|
|
31
|
+
- PyPI (remote published version)
|
|
32
|
+
|
|
33
|
+
Parameters
|
|
34
|
+
----------
|
|
35
|
+
packages : list[str] | None
|
|
36
|
+
List of package names to check. If None, checks all ecosystem packages.
|
|
37
|
+
Available packages: scitex, scitex-cloud, scitex-writer, scitex-dataset,
|
|
38
|
+
figrecipe, crossref-local, openalex-local, socialia
|
|
39
|
+
|
|
40
|
+
Returns
|
|
41
|
+
-------
|
|
42
|
+
str
|
|
43
|
+
JSON with version information for each package.
|
|
44
|
+
"""
|
|
45
|
+
from scitex._dev._mcp.handlers import list_versions_handler
|
|
46
|
+
|
|
47
|
+
result = await list_versions_handler(packages)
|
|
48
|
+
return _json(result)
|
|
49
|
+
|
|
50
|
+
@mcp.tool()
|
|
51
|
+
async def dev_check_versions(
|
|
52
|
+
packages: list[str] | None = None,
|
|
53
|
+
) -> str:
|
|
54
|
+
"""[dev] Check version consistency across the scitex ecosystem.
|
|
55
|
+
|
|
56
|
+
Checks for version mismatches between sources and returns a summary.
|
|
57
|
+
|
|
58
|
+
Status values:
|
|
59
|
+
- ok: All versions consistent
|
|
60
|
+
- mismatch: Local sources disagree
|
|
61
|
+
- unreleased: Local > PyPI (ready to release)
|
|
62
|
+
- outdated: Local < PyPI (should update)
|
|
63
|
+
- unavailable: Package not found locally
|
|
64
|
+
|
|
65
|
+
Parameters
|
|
66
|
+
----------
|
|
67
|
+
packages : list[str] | None
|
|
68
|
+
List of package names to check. If None, checks all ecosystem packages.
|
|
69
|
+
|
|
70
|
+
Returns
|
|
71
|
+
-------
|
|
72
|
+
str
|
|
73
|
+
JSON with detailed version check results and summary.
|
|
74
|
+
"""
|
|
75
|
+
from scitex._dev._mcp.handlers import check_versions_handler
|
|
76
|
+
|
|
77
|
+
result = await check_versions_handler(packages)
|
|
78
|
+
return _json(result)
|
|
79
|
+
|
|
80
|
+
@mcp.tool()
|
|
81
|
+
async def dev_check_hosts(
|
|
82
|
+
packages: list[str] | None = None,
|
|
83
|
+
hosts: list[str] | None = None,
|
|
84
|
+
) -> str:
|
|
85
|
+
"""[dev] Check package versions on SSH hosts.
|
|
86
|
+
|
|
87
|
+
Connects to configured SSH hosts and checks installed package versions.
|
|
88
|
+
Hosts are configured in ~/.scitex/dev_config.yaml or via SCITEX_DEV_HOSTS.
|
|
89
|
+
|
|
90
|
+
Parameters
|
|
91
|
+
----------
|
|
92
|
+
packages : list[str] | None
|
|
93
|
+
List of package names to check. If None, checks all ecosystem packages.
|
|
94
|
+
hosts : list[str] | None
|
|
95
|
+
List of host names to check. If None, checks all enabled hosts.
|
|
96
|
+
|
|
97
|
+
Returns
|
|
98
|
+
-------
|
|
99
|
+
str
|
|
100
|
+
JSON with host -> package -> version mapping.
|
|
101
|
+
"""
|
|
102
|
+
from scitex._dev._mcp.handlers import check_hosts_handler
|
|
103
|
+
|
|
104
|
+
result = await check_hosts_handler(packages, hosts)
|
|
105
|
+
return _json(result)
|
|
106
|
+
|
|
107
|
+
@mcp.tool()
|
|
108
|
+
async def dev_check_remotes(
|
|
109
|
+
packages: list[str] | None = None,
|
|
110
|
+
remotes: list[str] | None = None,
|
|
111
|
+
) -> str:
|
|
112
|
+
"""[dev] Check package versions on GitHub remotes.
|
|
113
|
+
|
|
114
|
+
Fetches tags and releases from configured GitHub organizations.
|
|
115
|
+
Remotes are configured in ~/.scitex/dev_config.yaml.
|
|
116
|
+
|
|
117
|
+
Parameters
|
|
118
|
+
----------
|
|
119
|
+
packages : list[str] | None
|
|
120
|
+
List of package names to check. If None, checks all ecosystem packages.
|
|
121
|
+
remotes : list[str] | None
|
|
122
|
+
List of remote names to check. If None, checks all enabled remotes.
|
|
123
|
+
|
|
124
|
+
Returns
|
|
125
|
+
-------
|
|
126
|
+
str
|
|
127
|
+
JSON with remote -> package -> version mapping.
|
|
128
|
+
"""
|
|
129
|
+
from scitex._dev._mcp.handlers import check_remotes_handler
|
|
130
|
+
|
|
131
|
+
result = await check_remotes_handler(packages, remotes)
|
|
132
|
+
return _json(result)
|
|
133
|
+
|
|
134
|
+
@mcp.tool()
|
|
135
|
+
async def dev_get_config() -> str:
|
|
136
|
+
"""[dev] Get current developer configuration.
|
|
137
|
+
|
|
138
|
+
Returns the configuration from ~/.scitex/dev_config.yaml including:
|
|
139
|
+
- Packages to track
|
|
140
|
+
- SSH hosts
|
|
141
|
+
- GitHub remotes
|
|
142
|
+
- Branches to track
|
|
143
|
+
|
|
144
|
+
Returns
|
|
145
|
+
-------
|
|
146
|
+
str
|
|
147
|
+
JSON with current configuration.
|
|
148
|
+
"""
|
|
149
|
+
from scitex._dev._mcp.handlers import get_config_handler
|
|
150
|
+
|
|
151
|
+
result = await get_config_handler()
|
|
152
|
+
return _json(result)
|
|
153
|
+
|
|
154
|
+
@mcp.tool()
|
|
155
|
+
async def dev_full_versions(
|
|
156
|
+
packages: list[str] | None = None,
|
|
157
|
+
include_hosts: bool = False,
|
|
158
|
+
include_remotes: bool = True,
|
|
159
|
+
) -> str:
|
|
160
|
+
"""[dev] Get comprehensive version data from all sources.
|
|
161
|
+
|
|
162
|
+
Combines local, host, and GitHub remote version information.
|
|
163
|
+
|
|
164
|
+
Parameters
|
|
165
|
+
----------
|
|
166
|
+
packages : list[str] | None
|
|
167
|
+
List of package names to check. If None, checks all ecosystem packages.
|
|
168
|
+
include_hosts : bool
|
|
169
|
+
Include SSH host version checks (slower, requires SSH access).
|
|
170
|
+
include_remotes : bool
|
|
171
|
+
Include GitHub remote version checks.
|
|
172
|
+
|
|
173
|
+
Returns
|
|
174
|
+
-------
|
|
175
|
+
str
|
|
176
|
+
JSON with combined version data.
|
|
177
|
+
"""
|
|
178
|
+
from scitex._dev._mcp.handlers import get_full_versions_handler
|
|
179
|
+
|
|
180
|
+
result = await get_full_versions_handler(
|
|
181
|
+
packages, include_hosts, include_remotes
|
|
182
|
+
)
|
|
183
|
+
return _json(result)
|
|
184
|
+
|
|
185
|
+
|
|
186
|
+
# EOF
|
scitex/audio/_audio_check.py
CHANGED
|
@@ -7,9 +7,75 @@ before attempting to play audio.
|
|
|
7
7
|
|
|
8
8
|
from __future__ import annotations
|
|
9
9
|
|
|
10
|
+
import os
|
|
11
|
+
import shutil
|
|
10
12
|
import subprocess
|
|
11
13
|
|
|
12
|
-
__all__ = ["check_local_audio_available"]
|
|
14
|
+
__all__ = ["check_local_audio_available", "check_wsl_windows_audio_available"]
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
def check_wsl_windows_audio_available() -> dict:
|
|
18
|
+
"""Check if WSL Windows audio playback is available.
|
|
19
|
+
|
|
20
|
+
In WSL, audio can be played via PowerShell's System.Media.SoundPlayer
|
|
21
|
+
even when PulseAudio is unavailable or SUSPENDED.
|
|
22
|
+
|
|
23
|
+
Returns
|
|
24
|
+
-------
|
|
25
|
+
dict with keys:
|
|
26
|
+
- available: bool - True if Windows playback via PowerShell is possible
|
|
27
|
+
- reason: str - Human-readable explanation
|
|
28
|
+
"""
|
|
29
|
+
if not os.path.exists("/mnt/c/Windows"):
|
|
30
|
+
return {"available": False, "reason": "Not running in WSL"}
|
|
31
|
+
|
|
32
|
+
if not shutil.which("powershell.exe"):
|
|
33
|
+
return {"available": False, "reason": "powershell.exe not found in PATH"}
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
"available": True,
|
|
37
|
+
"reason": "WSL Windows playback available via PowerShell",
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
|
|
41
|
+
def _try_wsl_fallback(
|
|
42
|
+
state: str, reason: str, pulseaudio_state: str | None = None
|
|
43
|
+
) -> dict:
|
|
44
|
+
"""Try WSL Windows fallback, return appropriate result dict."""
|
|
45
|
+
wsl_check = check_wsl_windows_audio_available()
|
|
46
|
+
if wsl_check["available"]:
|
|
47
|
+
result = {
|
|
48
|
+
"available": True,
|
|
49
|
+
"state": "WSL_WINDOWS",
|
|
50
|
+
"reason": wsl_check["reason"],
|
|
51
|
+
"fallback": "windows_powershell",
|
|
52
|
+
}
|
|
53
|
+
if pulseaudio_state:
|
|
54
|
+
result["pulseaudio_state"] = pulseaudio_state
|
|
55
|
+
return result
|
|
56
|
+
return {"available": False, "state": state, "reason": reason}
|
|
57
|
+
|
|
58
|
+
|
|
59
|
+
def _parse_pulseaudio_state(output: str) -> dict:
|
|
60
|
+
"""Parse PulseAudio sink state from pactl output."""
|
|
61
|
+
for line in output.strip().split("\n"):
|
|
62
|
+
parts = line.split("\t")
|
|
63
|
+
if len(parts) >= 5:
|
|
64
|
+
state = parts[4]
|
|
65
|
+
if state == "SUSPENDED":
|
|
66
|
+
return _try_wsl_fallback(
|
|
67
|
+
"SUSPENDED",
|
|
68
|
+
"Audio sink SUSPENDED (no active output device)",
|
|
69
|
+
pulseaudio_state="SUSPENDED",
|
|
70
|
+
)
|
|
71
|
+
if state in ("RUNNING", "IDLE"):
|
|
72
|
+
return {
|
|
73
|
+
"available": True,
|
|
74
|
+
"state": state,
|
|
75
|
+
"reason": f"Audio sink is {state}",
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
return _try_wsl_fallback("UNKNOWN", "Could not determine sink state")
|
|
13
79
|
|
|
14
80
|
|
|
15
81
|
def check_local_audio_available() -> dict:
|
|
@@ -18,11 +84,15 @@ def check_local_audio_available() -> dict:
|
|
|
18
84
|
Checks PulseAudio sink state to determine if audio can actually be heard.
|
|
19
85
|
On NAS or headless servers, the sink is typically SUSPENDED.
|
|
20
86
|
|
|
21
|
-
|
|
87
|
+
In WSL environments, also checks for Windows playback fallback via PowerShell.
|
|
88
|
+
|
|
89
|
+
Returns
|
|
90
|
+
-------
|
|
22
91
|
dict with keys:
|
|
23
92
|
- available: bool - True if local audio output is likely to work
|
|
24
93
|
- state: str - 'RUNNING', 'IDLE', 'SUSPENDED', 'NO_SINK', etc.
|
|
25
94
|
- reason: str - Human-readable explanation
|
|
95
|
+
- fallback: str (optional) - Fallback method if primary unavailable
|
|
26
96
|
"""
|
|
27
97
|
try:
|
|
28
98
|
result = subprocess.run(
|
|
@@ -32,45 +102,22 @@ def check_local_audio_available() -> dict:
|
|
|
32
102
|
timeout=5,
|
|
33
103
|
)
|
|
34
104
|
if result.returncode != 0:
|
|
35
|
-
return
|
|
36
|
-
"available": False,
|
|
37
|
-
"state": "NO_PACTL",
|
|
38
|
-
"reason": "PulseAudio not available",
|
|
39
|
-
}
|
|
105
|
+
return _try_wsl_fallback("NO_PACTL", "PulseAudio not available")
|
|
40
106
|
|
|
41
107
|
if not result.stdout.strip():
|
|
42
|
-
return
|
|
43
|
-
"available": False,
|
|
44
|
-
"state": "NO_SINK",
|
|
45
|
-
"reason": "No audio sinks found",
|
|
46
|
-
}
|
|
108
|
+
return _try_wsl_fallback("NO_SINK", "No audio sinks found")
|
|
47
109
|
|
|
48
|
-
|
|
49
|
-
for line in result.stdout.strip().split("\n"):
|
|
50
|
-
parts = line.split("\t")
|
|
51
|
-
if len(parts) >= 5:
|
|
52
|
-
state = parts[4]
|
|
53
|
-
if state == "SUSPENDED":
|
|
54
|
-
return {
|
|
55
|
-
"available": False,
|
|
56
|
-
"state": "SUSPENDED",
|
|
57
|
-
"reason": "Audio sink SUSPENDED (no active output device)",
|
|
58
|
-
}
|
|
59
|
-
elif state in ("RUNNING", "IDLE"):
|
|
60
|
-
return {
|
|
61
|
-
"available": True,
|
|
62
|
-
"state": state,
|
|
63
|
-
"reason": f"Audio sink is {state}",
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
return {
|
|
67
|
-
"available": False,
|
|
68
|
-
"state": "UNKNOWN",
|
|
69
|
-
"reason": "Could not determine sink state",
|
|
70
|
-
}
|
|
110
|
+
return _parse_pulseaudio_state(result.stdout)
|
|
71
111
|
|
|
72
112
|
except FileNotFoundError:
|
|
73
|
-
|
|
113
|
+
wsl_check = check_wsl_windows_audio_available()
|
|
114
|
+
if wsl_check["available"]:
|
|
115
|
+
return {
|
|
116
|
+
"available": True,
|
|
117
|
+
"state": "WSL_WINDOWS",
|
|
118
|
+
"reason": wsl_check["reason"],
|
|
119
|
+
"fallback": "windows_powershell",
|
|
120
|
+
}
|
|
74
121
|
return {
|
|
75
122
|
"available": True,
|
|
76
123
|
"state": "NO_PACTL",
|
|
@@ -83,11 +130,7 @@ def check_local_audio_available() -> dict:
|
|
|
83
130
|
"reason": "PulseAudio query timed out",
|
|
84
131
|
}
|
|
85
132
|
except Exception as e:
|
|
86
|
-
return {
|
|
87
|
-
"available": False,
|
|
88
|
-
"state": "ERROR",
|
|
89
|
-
"reason": str(e),
|
|
90
|
-
}
|
|
133
|
+
return {"available": False, "state": "ERROR", "reason": str(e)}
|
|
91
134
|
|
|
92
135
|
|
|
93
136
|
# EOF
|