runtime-sdk 0.4.16__tar.gz → 0.4.17__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: runtime-sdk
3
- Version: 0.4.16
3
+ Version: 0.4.17
4
4
  Summary: Runtime Python SDK and CLI
5
5
  Project-URL: Repository, https://github.com/The-Money-Company-Limited/runtimevm
6
6
  Project-URL: Issues, https://github.com/The-Money-Company-Limited/runtimevm/issues
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "runtime-sdk"
3
- version = "0.4.16"
3
+ version = "0.4.17"
4
4
  description = "Runtime Python SDK and CLI"
5
5
  readme = "README.md"
6
6
  requires-python = ">=3.11"
@@ -2,6 +2,7 @@ from __future__ import annotations
2
2
 
3
3
  import argparse
4
4
  import contextlib
5
+ import importlib
5
6
  import json
6
7
  import os
7
8
  import select
@@ -11,10 +12,8 @@ import signal
11
12
  import socket
12
13
  import subprocess
13
14
  import sys
14
- import termios
15
15
  import threading
16
16
  import time
17
- import tty
18
17
  import webbrowser
19
18
  from datetime import datetime, timezone
20
19
  from pathlib import Path
@@ -2311,12 +2310,25 @@ def _enter_computer(config: RuntimeConfig, computer_id: str) -> int:
2311
2310
  return report_error(f"terminal failed: {exc}")
2312
2311
 
2313
2312
 
2313
+ def _load_posix_tty_modules() -> tuple[Any, Any]:
2314
+ try:
2315
+ termios_mod = importlib.import_module("termios")
2316
+ tty_mod = importlib.import_module("tty")
2317
+ except ModuleNotFoundError as exc:
2318
+ raise RuntimeAPIError(
2319
+ "interactive console is not supported on this platform yet; use `runtime run` for one-shot commands"
2320
+ ) from exc
2321
+ return termios_mod, tty_mod
2322
+
2323
+
2324
+
2314
2325
  def _run_terminal_session(ws_url: str) -> int:
2315
2326
  if not sys.stdin.isatty() or not sys.stdout.isatty():
2316
2327
  return report_error("enter requires an interactive terminal")
2317
2328
 
2329
+ termios_mod, tty_mod = _load_posix_tty_modules()
2318
2330
  fd = sys.stdin.fileno()
2319
- old_settings = termios.tcgetattr(fd)
2331
+ old_settings = termios_mod.tcgetattr(fd)
2320
2332
  stop = threading.Event()
2321
2333
  result: dict[str, Any] = {"code": 0, "error": None}
2322
2334
  output_state: dict[str, Any] = {"buffer": "", "suppressing_preamble": True}
@@ -2369,7 +2381,7 @@ def _run_terminal_session(ws_url: str) -> int:
2369
2381
 
2370
2382
  last_size = shutil.get_terminal_size((100, 24))
2371
2383
  try:
2372
- tty.setraw(fd)
2384
+ tty_mod.setraw(fd)
2373
2385
  while not stop.is_set():
2374
2386
  current_size = shutil.get_terminal_size((100, 24))
2375
2387
  if current_size != last_size:
@@ -2388,7 +2400,7 @@ def _run_terminal_session(ws_url: str) -> int:
2388
2400
  stop.set()
2389
2401
  with contextlib.suppress(Exception):
2390
2402
  ws.close()
2391
- termios.tcsetattr(fd, termios.TCSADRAIN, old_settings)
2403
+ termios_mod.tcsetattr(fd, termios_mod.TCSADRAIN, old_settings)
2392
2404
  recv_thread.join(timeout=1)
2393
2405
 
2394
2406
  sys.stdout.write("\n")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: runtime-sdk
3
- Version: 0.4.16
3
+ Version: 0.4.17
4
4
  Summary: Runtime Python SDK and CLI
5
5
  Project-URL: Repository, https://github.com/The-Money-Company-Limited/runtimevm
6
6
  Project-URL: Issues, https://github.com/The-Money-Company-Limited/runtimevm/issues
File without changes
File without changes