arrayview 0.59.0__py3-none-any.whl → 0.59.1__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.
arrayview/_platform.py CHANGED
@@ -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
- if os.environ.get("TERM_PROGRAM") != "rex" or not os.environ.get("REX_SERVER"):
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
arrayview/_rex.py CHANGED
@@ -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", endpoint, "forward", "open", "--no-open",
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.80" # current bundled extension version
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: arrayview
3
- Version: 0.59.0
3
+ Version: 0.59.1
4
4
  Summary: Fast multi-dimensional array viewer
5
5
  Project-URL: Home, https://github.com/oscarvanderheide/arrayview
6
6
  Project-URL: Source, https://github.com/oscarvanderheide/arrayview
@@ -19,9 +19,9 @@ arrayview/_launcher.py,sha256=KKjtoPxJUYOVCTYP1iPfADU7rAIkFcwOn5w66HbMAGM,259685
19
19
  arrayview/_lifecycle.py,sha256=bqG0oKr-e-5S1ssCTlGmF-yBE47ilrpO1S_Owfjs9Z8,5365
20
20
  arrayview/_overlays.py,sha256=r3oEmbwkvuPp1GN_n49BxuimQWBfUInWYDqTCck3TkE,5720
21
21
  arrayview/_peer_guard.py,sha256=gq2JXVLqq-HDE7a5gMHWVudnjxUWlQ_xE4hUfYzuptc,7170
22
- arrayview/_platform.py,sha256=XYcqodKXfzfjU19HNZLzlSnCOHSODmnILQ7RENklukU,33488
22
+ arrayview/_platform.py,sha256=VpLnN_7CKVlfF1miaKH7DH_JPOriPkTP_WMMGPFO8yU,33603
23
23
  arrayview/_render.py,sha256=NwbqxhK7BRxWg0GdmtF28Xtl4sj8hz8vcJ1B3IXC74M,45593
24
- arrayview/_rex.py,sha256=dWPN3Tp-QYsa5_ISMv1XTWpnHgnlFF3cm7Jfeh-ulqM,18325
24
+ arrayview/_rex.py,sha256=1d_g1rKmUKIin31EF7ZT0necUyr1Sfh8exGiokgADPQ,19975
25
25
  arrayview/_routes_analysis.py,sha256=F0m7lMN2KF0XtaLoSu6bIzfeUnIsKecqj2zTXoLv_w4,47560
26
26
  arrayview/_routes_drop.py,sha256=FC4e7STdCo3hYIA0C4Yy9Ka2UKFx7nLDU5dkujmc1Vo,12477
27
27
  arrayview/_routes_export.py,sha256=q3ySRsJLW6ZpxtmjBYQzJ0KBeRNbhpKg9QKDVD310wo,4113
@@ -49,16 +49,16 @@ arrayview/_view_memory.py,sha256=w2_zKyrucJInK9531aWnWSBfcmagT32CgI7s3LLM6kY,324
49
49
  arrayview/_viewer.html,sha256=DJ9cKWb8-GA379bzS2UCgWJUlpMT-B6xN7Nl5cuk67s,2871995
50
50
  arrayview/_vscode.py,sha256=EKnGN2zrjlybc4FQOmYA8BvYdtkcJbLHDEdgtvO7ul4,837
51
51
  arrayview/_vscode_browser.py,sha256=KgUcFi_0lK-txky6oVFG_Uwb7bkGF7EvqI5sCFO3NV4,21484
52
- arrayview/_vscode_extension.py,sha256=S_9Jm92ZqWbDnBXvryuHR-NMId1ldxnCRkYQrgu0L5Q,53977
52
+ arrayview/_vscode_extension.py,sha256=heUX_kIPERSBb9FinLixC8jz8h6vpOn3cTKEEcGoxXo,53977
53
53
  arrayview/_vscode_signal.py,sha256=Top6gHDM3aI0JqWfbCnk-2o2KWM_PGxpALGNJBH7KL8,56957
54
54
  arrayview/_watch.py,sha256=Vsfcwg_VZLzh2u9XmsZPV3NiaGOCVUETHCmYge74BYc,2368
55
- arrayview/arrayview-opener.vsix,sha256=nLQQ3GGvO-jpGUScRGeOyGF64B81mWS6PmdDAg6SARM,65384
55
+ arrayview/arrayview-opener.vsix,sha256=1ZtQ1qp6g_mo1D7-T01c6na4RMhwAhmeoLA7sCa-dQM,67727
56
56
  arrayview/gsap.min.js,sha256=VGihm4idI0E1uqrWezWsiScB9F_jMosn7qs6pPSkeac,72304
57
57
  arrayview/todo.md,sha256=KhnRzpn6_jezR0nDDB61-zhox-rbOmEGW-A7Z0_7FnU,622
58
58
  arrayview/_qmri_colormaps/lipari.csv,sha256=Q1hskDo2A5-23ILMlv9EYAaZlsWAhs6_QZ3yzMQ-FhE,6911
59
59
  arrayview/_qmri_colormaps/navia.csv,sha256=ecYjW0IaEg4kaU36xnu7y8IaP67QqKfHKtjTx8Qay_s,6912
60
- arrayview-0.59.0.dist-info/METADATA,sha256=ZtS_N8vGsccGqVUL4hfcHE9Pzi57ZaBtHxXBsa16k2I,2390
61
- arrayview-0.59.0.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
62
- arrayview-0.59.0.dist-info/entry_points.txt,sha256=-0s08axutXkTbINiKs0Q7iv-33aWuTaamUg2q2-NyQ4,60
63
- arrayview-0.59.0.dist-info/licenses/LICENSE,sha256=34OivjM9faB2QaPjZpMRTIiSx31V3U9cEyQ6F2k-bH0,1062
64
- arrayview-0.59.0.dist-info/RECORD,,
60
+ arrayview-0.59.1.dist-info/METADATA,sha256=ozkanLgHl_xfdAPZE6s0XrlpPx-sZ3850-lqCRpaVjQ,2390
61
+ arrayview-0.59.1.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
62
+ arrayview-0.59.1.dist-info/entry_points.txt,sha256=-0s08axutXkTbINiKs0Q7iv-33aWuTaamUg2q2-NyQ4,60
63
+ arrayview-0.59.1.dist-info/licenses/LICENSE,sha256=34OivjM9faB2QaPjZpMRTIiSx31V3U9cEyQ6F2k-bH0,1062
64
+ arrayview-0.59.1.dist-info/RECORD,,