solari-e2b-compat 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.
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/COMPAT.md +3 -3
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/PKG-INFO +3 -3
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/README.md +2 -2
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/pyproject.toml +4 -1
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/__init__.py +1 -1
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_config.py +7 -2
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/.gitignore +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/LICENSE +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/LICENSE-E2B +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/NOTICE +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_box.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_commands.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_filesystem.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_loop.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_redact.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_sandbox.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_sync.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_template.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/_vendor_user.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/code_interpreter.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/solari_e2b/exceptions.py +0 -0
- {solari_e2b_compat-0.2.2 → solari_e2b_compat-0.2.4}/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. |
|
|
@@ -98,9 +98,9 @@ and the differences that are specific to Python.
|
|
|
98
98
|
- Tested on Python 3.14; the code avoids syntax newer than 3.9 but only 3.14 is exercised here.
|
|
99
99
|
|
|
100
100
|
## Default user and home directory (matching E2B)
|
|
101
|
-
**
|
|
101
|
+
**Sandboxes run as `user` in `/home/user` on the hosted Solari API, matching E2B's default** (checked on staging and production on 2026-11-03). Only a gateway or a template that predates user support falls back to root, as below.
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
Here, E2B sandboxes run as `user` in `/home/user`; commands, code and files all start there, and relative paths resolve against it. This package
|
|
104
104
|
asks the gateway for exactly that at create time (`user: "user"`, `cwd: "/home/user"`; the gateway creates the user at first boot with passwordless
|
|
105
105
|
sudo). Restores from a snapshot keep the snapshot's own user.
|
|
106
106
|
- **Gateway that predates `user` / `cwd`** (it answers 400 naming them, or ignores them): the plain create is used and the sandbox runs as **root in
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: solari-e2b-compat
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4
|
|
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.4"
|
|
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"
|
|
@@ -21,6 +21,9 @@ Homepage = "https://getsolari.com"
|
|
|
21
21
|
|
|
22
22
|
[tool.hatch.build.targets.wheel]
|
|
23
23
|
packages = ["solari_e2b"]
|
|
24
|
+
# The docs and error messages point at COMPAT.md, so the wheel carries it next to the package.
|
|
25
|
+
[tool.hatch.build.targets.wheel.force-include]
|
|
26
|
+
"COMPAT.md" = "solari_e2b/COMPAT.md"
|
|
24
27
|
|
|
25
28
|
[tool.hatch.build.targets.sdist]
|
|
26
29
|
include = ["solari_e2b", "README.md", "COMPAT.md", "NOTICE", "LICENSE", "LICENSE-E2B"]
|
|
@@ -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
|