solari-e2b-compat 0.2.2__tar.gz → 0.2.3__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.
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/COMPAT.md +1 -1
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/PKG-INFO +3 -3
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/README.md +2 -2
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/pyproject.toml +1 -1
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/__init__.py +1 -1
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_config.py +7 -2
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/.gitignore +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/LICENSE +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/LICENSE-E2B +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/NOTICE +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_box.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_commands.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_filesystem.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_loop.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_redact.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_sandbox.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_sync.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_template.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/_vendor_user.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/code_interpreter.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/exceptions.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.3}/solari_e2b/models.py +0 -0
|
@@ -19,7 +19,7 @@ and the differences that are specific to Python.
|
|
|
19
19
|
| E2B | Here |
|
|
20
20
|
|---|---|
|
|
21
21
|
| `E2B_API_KEY`, `api_key=` | Only `slr_…` keys are used; see README. |
|
|
22
|
-
| `E2B_DOMAIN`, `E2B_API_URL`, `domain=`, `api_url=` | Honoured only when they point at Solari or loopback. |
|
|
22
|
+
| `E2B_DOMAIN`, `E2B_API_URL`, `domain=`, `api_url=` | Honoured only when they point at a Solari API host or loopback. |
|
|
23
23
|
| `headers=`, `api_headers=`, `proxy=` | NO. |
|
|
24
24
|
| `request_timeout=`, `debug=`, `logger=`, `validate_api_key=`, `retries=`, `http_version=`, `sandbox_url=` | Accepted, ignored (Solari's transport has its own retry policy). Every option that is accepted but ignored is marked "ignored" in this file; any other option either works or throws. |
|
|
25
25
|
| `timeout=` arguments | Seconds, as in E2B. |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: solari-e2b-compat
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.3
|
|
4
4
|
Summary: E2B-compatible Python interface (sandboxes and code interpreter) over Solari Sandboxes. Not affiliated with E2B.
|
|
5
5
|
Project-URL: Homepage, https://getsolari.com
|
|
6
6
|
Author: Solari
|
|
@@ -58,7 +58,7 @@ Do not call the blocking API from inside such a callback; use `AsyncSandbox` the
|
|
|
58
58
|
| | Order |
|
|
59
59
|
|---|---|
|
|
60
60
|
| API key | `api_key=` option, `SOLARI_API_KEY`, `E2B_API_KEY`: only an `slr_…` Solari key is ever used. A non-`slr_` value (for example a real E2B key) is skipped with a warning (the key is never printed or sent); with no Solari key the call raises |
|
|
61
|
-
| Base URL | `api_url=` / `domain=` option (Solari or loopback only, anything else raises), `SOLARI_BASE_URL`, `E2B_API_URL` / `E2B_DOMAIN` (only if they point at
|
|
61
|
+
| Base URL | `api_url=` / `domain=` option (Solari or loopback only, anything else raises), `SOLARI_BASE_URL`, `E2B_API_URL` / `E2B_DOMAIN` (only if they point at a Solari API host or loopback; otherwise ignored with a warning), default `https://api.getsolari.com` |
|
|
62
62
|
|
|
63
63
|
An E2B key does not work here: use a Solari API key.
|
|
64
64
|
|
|
@@ -86,5 +86,5 @@ numba, gensim) are not included.
|
|
|
86
86
|
## Tests
|
|
87
87
|
|
|
88
88
|
- `python -m pytest`: offline unit tests, a fake gateway.
|
|
89
|
-
- `SOLARI_API_KEY=… SOLARI_BASE_URL
|
|
89
|
+
- `SOLARI_API_KEY=… SOLARI_BASE_URL=<a non-production gateway URL> python -m pytest -m live tests/test_live_staging.py`:
|
|
90
90
|
live tests against staging. They create their own sandboxes, snapshots and templates and delete only those.
|
|
@@ -39,7 +39,7 @@ Do not call the blocking API from inside such a callback; use `AsyncSandbox` the
|
|
|
39
39
|
| | Order |
|
|
40
40
|
|---|---|
|
|
41
41
|
| API key | `api_key=` option, `SOLARI_API_KEY`, `E2B_API_KEY`: only an `slr_…` Solari key is ever used. A non-`slr_` value (for example a real E2B key) is skipped with a warning (the key is never printed or sent); with no Solari key the call raises |
|
|
42
|
-
| Base URL | `api_url=` / `domain=` option (Solari or loopback only, anything else raises), `SOLARI_BASE_URL`, `E2B_API_URL` / `E2B_DOMAIN` (only if they point at
|
|
42
|
+
| Base URL | `api_url=` / `domain=` option (Solari or loopback only, anything else raises), `SOLARI_BASE_URL`, `E2B_API_URL` / `E2B_DOMAIN` (only if they point at a Solari API host or loopback; otherwise ignored with a warning), default `https://api.getsolari.com` |
|
|
43
43
|
|
|
44
44
|
An E2B key does not work here: use a Solari API key.
|
|
45
45
|
|
|
@@ -67,5 +67,5 @@ numba, gensim) are not included.
|
|
|
67
67
|
## Tests
|
|
68
68
|
|
|
69
69
|
- `python -m pytest`: offline unit tests, a fake gateway.
|
|
70
|
-
- `SOLARI_API_KEY=… SOLARI_BASE_URL
|
|
70
|
+
- `SOLARI_API_KEY=… SOLARI_BASE_URL=<a non-production gateway URL> python -m pytest -m live tests/test_live_staging.py`:
|
|
71
71
|
live tests against staging. They create their own sandboxes, snapshots and templates and delete only those.
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "solari-e2b-compat"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.3"
|
|
8
8
|
description = "E2B-compatible Python interface (sandboxes and code interpreter) over Solari Sandboxes. Not affiliated with E2B."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -6,6 +6,7 @@ from __future__ import annotations
|
|
|
6
6
|
import asyncio
|
|
7
7
|
import logging
|
|
8
8
|
import os
|
|
9
|
+
import re
|
|
9
10
|
from dataclasses import dataclass
|
|
10
11
|
from typing import Any, Callable, Dict, Optional, Tuple
|
|
11
12
|
from urllib.parse import urlparse
|
|
@@ -32,14 +33,18 @@ IGNORED_OPTS = frozenset({"request_timeout", "debug", "logger", "validate_api_ke
|
|
|
32
33
|
_HTTP_FACTORY: Optional[Callable[[], httpx.AsyncClient]] = None
|
|
33
34
|
|
|
34
35
|
|
|
36
|
+
#: The only Solari hosts that may receive a key (the API gateways). Not every *.getsolari.com host: preview hosts (<label>-<port>.preview.getsolari.com) serve customer code.
|
|
37
|
+
SOLARI_API_HOST = re.compile(r"api(-sta(-gcp)?)?\.getsolari\.com")
|
|
38
|
+
|
|
39
|
+
|
|
35
40
|
def is_solari_base_url(raw: str) -> bool:
|
|
36
|
-
"""https on
|
|
41
|
+
"""https on a Solari API host, or loopback over http(s)."""
|
|
37
42
|
try:
|
|
38
43
|
u = urlparse(raw)
|
|
39
44
|
host = (u.hostname or "").lower().rstrip(".")
|
|
40
45
|
except ValueError:
|
|
41
46
|
return False
|
|
42
|
-
if u.scheme == "https" and (host
|
|
47
|
+
if u.scheme == "https" and SOLARI_API_HOST.fullmatch(host) is not None:
|
|
43
48
|
return True
|
|
44
49
|
return u.scheme in ("http", "https") and (host in ("localhost", "::1") or host.replace(".", "").isdigit() and host.startswith("127."))
|
|
45
50
|
|
|
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
|