arrayview 0.59.0__tar.gz → 0.59.1__tar.gz
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.
- {arrayview-0.59.0 → arrayview-0.59.1}/PKG-INFO +1 -1
- {arrayview-0.59.0 → arrayview-0.59.1}/pyproject.toml +1 -1
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_platform.py +3 -1
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_rex.py +43 -1
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_vscode_extension.py +1 -1
- arrayview-0.59.1/src/arrayview/arrayview-opener.vsix +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_rex_remote.py +26 -0
- arrayview-0.59.0/src/arrayview/arrayview-opener.vsix +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/.gitignore +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/LICENSE +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/README.md +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/ARCHITECTURE.md +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/__init__.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/__main__.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_analysis.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_app.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_bootstrap_app.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_config.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_diagnostics.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_dicom.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_diff.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_extra_ports.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_icon.png +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_imaging.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_instance_registry.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_io.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_launch_plan.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_launch_trace.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_launcher.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_lifecycle.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_overlays.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_peer_guard.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_qmri_colormaps/lipari.csv +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_qmri_colormaps/navia.csv +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_render.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_analysis.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_drop.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_export.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_loading.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_persistence.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_preferences.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_preload.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_query.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_rendering.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_segmentation.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_state.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_vectorfield.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_routes_websocket.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_segmentation.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_server.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_session.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_session_spec.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_shell.html +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_source_safety.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_synthetic_mri.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_torch.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_tutorial.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_vectorfield.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_view_memory.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_viewer.html +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_vscode.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_vscode_browser.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_vscode_signal.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/_watch.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/gsap.min.js +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/src/arrayview/todo.md +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/capture_patient_loading.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/capture_v_animation.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/conftest.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/make_vectorfield_test_arrays.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_1d_arrays.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_api.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_backend_shared.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_cli.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_config.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_dicom.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_drop_import.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_first_slice_warmup.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_instance_registry.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_io.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_large_arrays.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_launch_blackbox.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_nifti_meta.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_nifti_series.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_peer_guard.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_safe_server_stop.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_shared_home_registrations.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_source_safety.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_torch.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_tutorial.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_view_memory.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_viewer_port.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/test_vsix_bundle.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/ui_audit.py +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/v_anim_frames/.gitkeep +0 -0
- {arrayview-0.59.0 → arrayview-0.59.1}/tests/visual_smoke.py +0 -0
|
@@ -717,7 +717,9 @@ def _in_rex_remote() -> bool:
|
|
|
717
717
|
if _rex_remote_cache is not None:
|
|
718
718
|
return _rex_remote_cache
|
|
719
719
|
_rex_remote_cache = False
|
|
720
|
-
|
|
720
|
+
# REX_SERVER is not a reliable marker: a systemd socket-activated Rex server
|
|
721
|
+
# (what ``rex server install`` sets up on Linux) leaves it unset.
|
|
722
|
+
if os.environ.get("TERM_PROGRAM") != "rex":
|
|
721
723
|
return False
|
|
722
724
|
import json
|
|
723
725
|
import shutil
|
|
@@ -22,6 +22,7 @@ from __future__ import annotations
|
|
|
22
22
|
import base64
|
|
23
23
|
import json
|
|
24
24
|
import os
|
|
25
|
+
import re
|
|
25
26
|
import shutil
|
|
26
27
|
import subprocess
|
|
27
28
|
import sys
|
|
@@ -114,6 +115,45 @@ def _connected_endpoints() -> set[str]:
|
|
|
114
115
|
return endpoints
|
|
115
116
|
|
|
116
117
|
|
|
118
|
+
def _app_tunnel_address(endpoint: str, ps_output: str | None = None) -> str | None:
|
|
119
|
+
"""``unix://`` address of the tunnel the Rex app already holds to *endpoint*.
|
|
120
|
+
|
|
121
|
+
Every ``rex -S ssh://host`` command logs in to the host again, which takes
|
|
122
|
+
many seconds on some machines. The app keeps one ssh tunnel per host, whose
|
|
123
|
+
local socket reaches the same server at once, so commands sent through it
|
|
124
|
+
skip the login. None when no such tunnel is found; callers then use
|
|
125
|
+
*endpoint* itself.
|
|
126
|
+
"""
|
|
127
|
+
if ps_output is None:
|
|
128
|
+
try:
|
|
129
|
+
ps_output = subprocess.run(
|
|
130
|
+
["ps", "-axo", "pid=,ppid=,args="],
|
|
131
|
+
capture_output=True,
|
|
132
|
+
text=True,
|
|
133
|
+
timeout=5,
|
|
134
|
+
).stdout
|
|
135
|
+
except Exception:
|
|
136
|
+
return None
|
|
137
|
+
rows = []
|
|
138
|
+
for line in ps_output.splitlines():
|
|
139
|
+
parts = line.split(None, 2)
|
|
140
|
+
if len(parts) == 3 and parts[0].isdigit() and parts[1].isdigit():
|
|
141
|
+
rows.append((int(parts[0]), int(parts[1]), parts[2]))
|
|
142
|
+
tunnels = {
|
|
143
|
+
pid
|
|
144
|
+
for pid, _, args in rows
|
|
145
|
+
if args.endswith(f" __internal ssh-tunnel {endpoint}")
|
|
146
|
+
}
|
|
147
|
+
for _, ppid, args in rows:
|
|
148
|
+
if ppid not in tunnels:
|
|
149
|
+
continue
|
|
150
|
+
# The socket path may contain spaces ("Application Support").
|
|
151
|
+
match = re.search(r" -L (/.+?\.sock):/", args)
|
|
152
|
+
if match and os.path.exists(match.group(1)):
|
|
153
|
+
return "unix://" + urllib.parse.quote(match.group(1))
|
|
154
|
+
return None
|
|
155
|
+
|
|
156
|
+
|
|
117
157
|
def _report_from_event(event: dict) -> tuple[str, str] | None:
|
|
118
158
|
"""(viewer URL, "native" | "browser") from an ArrayView status report."""
|
|
119
159
|
if event.get("type") != "session_event":
|
|
@@ -216,9 +256,11 @@ class Watcher:
|
|
|
216
256
|
# -- forwarding and display ------------------------------------------
|
|
217
257
|
|
|
218
258
|
def _start_forward(self, endpoint: str, remote_port: int) -> tuple[subprocess.Popen, int] | None:
|
|
259
|
+
# Through the app's open tunnel when there is one: no new ssh login.
|
|
260
|
+
server = _app_tunnel_address(endpoint) or endpoint
|
|
219
261
|
proc = subprocess.Popen(
|
|
220
262
|
[
|
|
221
|
-
self.rex, "-S",
|
|
263
|
+
self.rex, "-S", server, "forward", "open", "--no-open",
|
|
222
264
|
"--port", "0", str(remote_port),
|
|
223
265
|
],
|
|
224
266
|
stdout=subprocess.PIPE,
|
|
@@ -59,7 +59,7 @@ _VSCODE_EXT_FRESH_INSTALL = False # True if we just installed it this session
|
|
|
59
59
|
_VSCODE_EXT_RELOAD_REQUIRED = False # installed files are newer than the live host
|
|
60
60
|
_VSCODE_EXT_INSTALL_FAILED = False # automatic install could not complete safely
|
|
61
61
|
_VSCODE_EXT_NO_LIVE_WINDOW = False # no live host claims this terminal's window id
|
|
62
|
-
_VSCODE_EXT_VERSION = "0.15.
|
|
62
|
+
_VSCODE_EXT_VERSION = "0.15.81" # current bundled extension version
|
|
63
63
|
_VSCODE_CONFIGURED_PORTS: set[int] = set()
|
|
64
64
|
# Version-skew notices already printed, so a long-lived process (Jupyter, a
|
|
65
65
|
# script opening several arrays) states the mismatch once instead of per call.
|
|
Binary file
|
|
@@ -65,6 +65,13 @@ def test_app_reaching_server_through_sshd_is_remote(rex_env):
|
|
|
65
65
|
assert _platform._in_rex_remote() is True
|
|
66
66
|
|
|
67
67
|
|
|
68
|
+
def test_remote_without_rex_server_variable(rex_env, monkeypatch):
|
|
69
|
+
# A systemd socket-activated Rex server does not set REX_SERVER.
|
|
70
|
+
monkeypatch.delenv("REX_SERVER")
|
|
71
|
+
rex_env(_clients(4242), "sshd")
|
|
72
|
+
assert _platform._in_rex_remote() is True
|
|
73
|
+
|
|
74
|
+
|
|
68
75
|
def test_app_over_network_is_remote(rex_env):
|
|
69
76
|
rex_env(_clients(4242, transport="tcp"), "anything")
|
|
70
77
|
assert _platform._in_rex_remote() is True
|
|
@@ -201,3 +208,22 @@ def test_window_browser_plans_explicit_browser():
|
|
|
201
208
|
facts,
|
|
202
209
|
)
|
|
203
210
|
assert "explicit_browser" in plan.reasons
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
def test_mac_helper_reuses_the_apps_tunnel(tmp_path):
|
|
214
|
+
from arrayview import _rex
|
|
215
|
+
|
|
216
|
+
sock = tmp_path / "Application Support" / "abc.sock"
|
|
217
|
+
sock.parent.mkdir()
|
|
218
|
+
sock.write_text("")
|
|
219
|
+
ps = (
|
|
220
|
+
" 4732 90382 /Apps/Rex Server.app/Contents/MacOS/rex __internal ssh-tunnel ssh://gpu\n"
|
|
221
|
+
f" 4733 4732 /usr/bin/ssh -N -T -o ControlPath=none -L {sock}:/run/user/1/rex/server.sock -- ssh://gpu\n"
|
|
222
|
+
# A tunnel of some other rex command, and one to another host.
|
|
223
|
+
f" 4850 4849 /usr/bin/ssh -N -T -L {tmp_path}/other.sock:/run/user/1/rex/server.sock -- ssh://gpu\n"
|
|
224
|
+
" 5000 90382 /Apps/Rex Server.app/Contents/MacOS/rex __internal ssh-tunnel ssh://other\n"
|
|
225
|
+
)
|
|
226
|
+
address = _rex._app_tunnel_address("ssh://gpu", ps)
|
|
227
|
+
assert address == "unix://" + str(sock).replace(" ", "%20")
|
|
228
|
+
assert _rex._app_tunnel_address("ssh://other", ps) is None
|
|
229
|
+
assert _rex._app_tunnel_address("ssh://missing", ps) is None
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|