hypha-debugger 0.2.2__tar.gz → 0.2.4__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.
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/PKG-INFO +1 -1
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/__init__.py +1 -1
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/debugger.py +21 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/services/source.py +4 -3
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger.egg-info/PKG-INFO +1 -1
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/pyproject.toml +1 -1
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/tests/test_services.py +17 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/README.md +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/__main__.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/cli.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/services/__init__.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/services/execute.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/services/filesystem.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/services/info.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/services/inspect_vars.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/services/shell.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/utils/__init__.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger/utils/env.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger.egg-info/SOURCES.txt +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger.egg-info/dependency_links.txt +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger.egg-info/entry_points.txt +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger.egg-info/requires.txt +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/hypha_debugger.egg-info/top_level.txt +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/setup.cfg +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/tests/test_cli.py +0 -0
- {hypha_debugger-0.2.2 → hypha_debugger-0.2.4}/tests/test_shell.py +0 -0
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
import asyncio
|
|
4
4
|
import logging
|
|
5
|
+
import os
|
|
5
6
|
import secrets
|
|
6
7
|
import threading
|
|
7
8
|
from dataclasses import dataclass, field
|
|
@@ -21,6 +22,24 @@ from hypha_debugger.services.source import get_source, get_skill_md
|
|
|
21
22
|
logger = logging.getLogger("hypha_debugger")
|
|
22
23
|
|
|
23
24
|
|
|
25
|
+
def _ensure_ssl_certs() -> None:
|
|
26
|
+
"""Point OpenSSL at certifi's CA bundle when the system trust store is
|
|
27
|
+
unconfigured — otherwise the hypha websocket TLS handshake fails with
|
|
28
|
+
CERTIFICATE_VERIFY_FAILED (macOS framework Python, minimal containers, fresh
|
|
29
|
+
venvs). Only sets the env vars if the user hasn't already; must run before
|
|
30
|
+
the first TLS connection (SSLContext reads these at creation time)."""
|
|
31
|
+
if os.environ.get("SSL_CERT_FILE"):
|
|
32
|
+
return
|
|
33
|
+
try:
|
|
34
|
+
import certifi
|
|
35
|
+
|
|
36
|
+
bundle = certifi.where()
|
|
37
|
+
os.environ["SSL_CERT_FILE"] = bundle
|
|
38
|
+
os.environ.setdefault("SSL_CERT_DIR", os.path.dirname(bundle))
|
|
39
|
+
except Exception:
|
|
40
|
+
pass
|
|
41
|
+
|
|
42
|
+
|
|
24
43
|
def _build_service_url(server_url: str, service_id: str) -> str:
|
|
25
44
|
"""Build the HTTP service URL from server URL and full service ID.
|
|
26
45
|
|
|
@@ -200,6 +219,7 @@ async def start_debugger(
|
|
|
200
219
|
Returns:
|
|
201
220
|
A DebugSession with service_id, workspace, server, service_url, and token.
|
|
202
221
|
"""
|
|
222
|
+
_ensure_ssl_certs()
|
|
203
223
|
from hypha_rpc import connect_to_server
|
|
204
224
|
|
|
205
225
|
effective_id, effective_visibility = _resolve_id_and_visibility(
|
|
@@ -290,6 +310,7 @@ def start_debugger_sync(
|
|
|
290
310
|
Returns:
|
|
291
311
|
A DebugSession with service_id, workspace, server, service_url, and token.
|
|
292
312
|
"""
|
|
313
|
+
_ensure_ssl_certs()
|
|
293
314
|
from hypha_rpc.sync import connect_to_server
|
|
294
315
|
|
|
295
316
|
effective_id, effective_visibility = _resolve_id_and_visibility(
|
|
@@ -116,9 +116,10 @@ hyd py 'import sys; sys.version' # run Python via execute_code
|
|
|
116
116
|
hyd status # confirm it's connected
|
|
117
117
|
```
|
|
118
118
|
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
119
|
+
Install tip: `pipx install hypha-debugger` is the most reliable — it always puts
|
|
120
|
+
`hyd` on your PATH. If instead you used `pip install --user` and `hyd` isn't found,
|
|
121
|
+
either add the user bin dir to PATH, or just use `python -m hypha_debugger.cli` in
|
|
122
|
+
place of `hyd` — identical arguments (`python -m hypha_debugger.cli sh 'pwd'`).
|
|
122
123
|
|
|
123
124
|
Key ideas:
|
|
124
125
|
- **The remote is stateless.** The "current directory" and "current profile" live
|
|
@@ -342,3 +342,20 @@ def test_debug_session_print_instructions(capsys):
|
|
|
342
342
|
assert "get_skill_md" in captured.out
|
|
343
343
|
assert isinstance(result, str)
|
|
344
344
|
assert "py-debugger-abc" in result
|
|
345
|
+
|
|
346
|
+
|
|
347
|
+
def test_ensure_ssl_certs_sets_when_unset(monkeypatch):
|
|
348
|
+
import os
|
|
349
|
+
from hypha_debugger.debugger import _ensure_ssl_certs
|
|
350
|
+
monkeypatch.delenv("SSL_CERT_FILE", raising=False)
|
|
351
|
+
_ensure_ssl_certs()
|
|
352
|
+
# certifi is a dependency, so a real CA bundle path should now be set
|
|
353
|
+
assert os.environ.get("SSL_CERT_FILE") and os.path.exists(os.environ["SSL_CERT_FILE"])
|
|
354
|
+
|
|
355
|
+
|
|
356
|
+
def test_ensure_ssl_certs_respects_existing(monkeypatch):
|
|
357
|
+
import os
|
|
358
|
+
from hypha_debugger.debugger import _ensure_ssl_certs
|
|
359
|
+
monkeypatch.setenv("SSL_CERT_FILE", "/custom/ca-bundle.pem")
|
|
360
|
+
_ensure_ssl_certs()
|
|
361
|
+
assert os.environ["SSL_CERT_FILE"] == "/custom/ca-bundle.pem"
|
|
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
|