solari-runloop-compat 0.1.2__tar.gz → 0.2.0__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.
Potentially problematic release.
This version of solari-runloop-compat might be problematic. Click here for more details.
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/COMPAT.md +1 -1
- solari_runloop_compat-0.2.0/LICENSE +21 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/PKG-INFO +3 -3
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/README.md +1 -2
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/pyproject.toml +1 -1
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/__init__.py +1 -1
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_config.py +21 -8
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/test_config.py +17 -5
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/.gitignore +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/BLUEPRINTS.md +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/GATEWAY-ENDPOINTS.md +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/NOTICE +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_branding.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_client.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_context.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_dockerfile.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_exceptions.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_gateway.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_loop.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_mapping.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_models.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_resources.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/_sync.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/lib/__init__.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/lib/polling.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/pagination.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/sdk.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/__init__.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/blueprint_build_log.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/blueprint_build_logs_list_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/blueprint_build_parameters.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/blueprint_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devbox_async_execution_detail_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devbox_execution_detail_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devbox_snapshot_list_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devbox_snapshot_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devbox_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devboxes/__init__.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devboxes/devbox_logs_list_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/secret_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/__init__.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/after_idle.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/code_mount_parameters.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/launch_parameters.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/lifecycle_configuration.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/lifecycle_hooks.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/resume_triggers.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/tunnel_view.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/run_runloop_examples.sh +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/test_context.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/test_dockerfile.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/test_gateway_wire.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/test_live_staging.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/test_mapping.py +0 -0
- {solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/tests/test_surface.py +0 -0
|
@@ -15,7 +15,7 @@ gateway endpoint (see `GATEWAY-ENDPOINTS.md`); **NO** raises `SolariCompatUnsupp
|
|
|
15
15
|
| Runloop | Here |
|
|
16
16
|
|---|---|
|
|
17
17
|
| `Runloop(bearer_token=...)` / env `RUNLOOP_API_KEY` | OK, with a safety rule: sources are tried in order (argument, `SOLARI_API_KEY`, `RUNLOOP_API_KEY`) and **a key that does not start with `slr_` is never used or sent** (it is probably a Runloop secret): it is skipped with a warning that does not print it, and if no `slr_` key remains the constructor raises `RunloopError`. An `slr_` key is accepted from any source. |
|
|
18
|
-
| `base_url` / env `RUNLOOP_BASE_URL` (default `https://api.runloop.ai`) | OK. Order: argument, `SOLARI_BASE_URL`, `RUNLOOP_BASE_URL`, default `https://api.getsolari.com`. |
|
|
18
|
+
| `base_url` / env `RUNLOOP_BASE_URL` (default `https://api.runloop.ai`) | OK. Order: argument, `SOLARI_BASE_URL`, `RUNLOOP_BASE_URL`, default `https://api.getsolari.com`. The argument and `SOLARI_BASE_URL` must point at getsolari.com (https) or loopback, otherwise `RunloopError` ("Refusing to send a Solari API key to …"); `RUNLOOP_BASE_URL` is ignored with a warning unless it does. |
|
|
19
19
|
| `timeout`, `default_headers`, `http_client`, `with_options()` | Accepted, ignored. |
|
|
20
20
|
| `max_retries` | OK (default 5), Solari's own policy: idempotent calls retry on network errors, 502/503/504/507 and `retryable` bodies. |
|
|
21
21
|
| Sync and async (`Runloop`/`AsyncRunloop`, `RunloopSDK`/`AsyncRunloopSDK`) | OK. The sync API drives the async core on one background thread per client (`_loop.py`); don't call it from inside a callback it invoked. |
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Solari Desktop
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -1,10 +1,11 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: solari-runloop-compat
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.2.0
|
|
4
4
|
Summary: Runloop-compatible Python interface over Solari Sandboxes. Not affiliated with Runloop.
|
|
5
5
|
Project-URL: Homepage, https://getsolari.com
|
|
6
6
|
Author: Solari
|
|
7
7
|
License: MIT
|
|
8
|
+
License-File: LICENSE
|
|
8
9
|
License-File: NOTICE
|
|
9
10
|
Keywords: compatibility,runloop,sandbox,solari
|
|
10
11
|
Requires-Python: >=3.9
|
|
@@ -36,8 +37,7 @@ with runloop.devbox.create(name="my-devbox") as devbox:
|
|
|
36
37
|
under Runloop's names. **COMPAT.md** lists exactly what is supported, what differs, and what raises
|
|
37
38
|
`SolariCompatUnsupported`. Unsupported features never fail silently.
|
|
38
39
|
|
|
39
|
-
*Not affiliated with Runloop.*
|
|
40
|
-
Do not publish: this is a draft for review.
|
|
40
|
+
*Not affiliated with, endorsed by, or sponsored by Runloop.* "Runloop" is the name of Runloop's product; it appears here only to describe API compatibility.
|
|
41
41
|
|
|
42
42
|
## Develop
|
|
43
43
|
```
|
|
@@ -18,8 +18,7 @@ with runloop.devbox.create(name="my-devbox") as devbox:
|
|
|
18
18
|
under Runloop's names. **COMPAT.md** lists exactly what is supported, what differs, and what raises
|
|
19
19
|
`SolariCompatUnsupported`. Unsupported features never fail silently.
|
|
20
20
|
|
|
21
|
-
*Not affiliated with Runloop.*
|
|
22
|
-
Do not publish: this is a draft for review.
|
|
21
|
+
*Not affiliated with, endorsed by, or sponsored by Runloop.* "Runloop" is the name of Runloop's product; it appears here only to describe API compatibility.
|
|
23
22
|
|
|
24
23
|
## Develop
|
|
25
24
|
```
|
|
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "solari-runloop-compat"
|
|
7
|
-
version = "0.
|
|
7
|
+
version = "0.2.0"
|
|
8
8
|
description = "Runloop-compatible Python interface over Solari Sandboxes. Not affiliated with Runloop."
|
|
9
9
|
readme = "README.md"
|
|
10
10
|
requires-python = ">=3.9"
|
|
@@ -4,6 +4,7 @@ from __future__ import annotations
|
|
|
4
4
|
|
|
5
5
|
import logging
|
|
6
6
|
import os
|
|
7
|
+
import re
|
|
7
8
|
from urllib.parse import urlparse
|
|
8
9
|
from typing import Optional, Tuple
|
|
9
10
|
|
|
@@ -22,16 +23,23 @@ def _first_env(names: Tuple[str, ...]) -> Optional[str]: # base URLs only; keys
|
|
|
22
23
|
|
|
23
24
|
|
|
24
25
|
def _is_solari_host(url: str) -> bool:
|
|
25
|
-
|
|
26
|
-
|
|
26
|
+
"""https on getsolari.com or a subdomain, or loopback over http(s): where a Solari key may be sent."""
|
|
27
|
+
try:
|
|
28
|
+
u = urlparse(url)
|
|
29
|
+
host = (u.hostname or "").lower().rstrip(".")
|
|
30
|
+
except ValueError:
|
|
31
|
+
return False
|
|
32
|
+
if not host or not u.scheme:
|
|
33
|
+
return False
|
|
34
|
+
if u.scheme == "https" and (host == "getsolari.com" or host.endswith(".getsolari.com")):
|
|
35
|
+
return True
|
|
36
|
+
loopback = host in ("localhost", "::1") or re.fullmatch(r"127(\.\d{1,3}){3}", host) is not None
|
|
37
|
+
return loopback and u.scheme in ("http", "https")
|
|
27
38
|
|
|
28
39
|
|
|
29
40
|
def _env_base_url() -> Optional[str]:
|
|
30
|
-
"""``
|
|
31
|
-
|
|
32
|
-
v = os.environ.get("SOLARI_BASE_URL")
|
|
33
|
-
if v:
|
|
34
|
-
return v
|
|
41
|
+
"""``RUNLOOP_BASE_URL`` (a Runloop variable, commonly ``https://api.runloop.ai``) is only honoured for getsolari.com or
|
|
42
|
+
loopback hosts: otherwise the Solari key would be sent to a third party."""
|
|
35
43
|
v = os.environ.get("RUNLOOP_BASE_URL")
|
|
36
44
|
if v and not _is_solari_host(v):
|
|
37
45
|
log.warning("Ignoring RUNLOOP_BASE_URL: its host is not a Solari host, and the Solari API key must not be sent there.")
|
|
@@ -48,7 +56,12 @@ def resolve(bearer_token: Optional[str], base_url: Optional[str]) -> Tuple[str,
|
|
|
48
56
|
if not value:
|
|
49
57
|
continue
|
|
50
58
|
if value.startswith(KEY_PREFIX):
|
|
51
|
-
|
|
59
|
+
# The Solari key is sent to this URL, so an explicit value must point at Solari (or loopback) as well.
|
|
60
|
+
given = str(base_url) if base_url else os.environ.get("SOLARI_BASE_URL")
|
|
61
|
+
if given and not _is_solari_host(given):
|
|
62
|
+
host = urlparse(given).hostname or "an unparsable URL"
|
|
63
|
+
raise RunloopError(f"Refusing to send a Solari API key to {host}: it does not point at Solari (getsolari.com or loopback).")
|
|
64
|
+
url = given or _env_base_url() or DEFAULT_BASE_URL
|
|
52
65
|
return value, url.rstrip("/")
|
|
53
66
|
log.warning("Ignoring %s: it does not start with %r, so it is not a Solari key and will not be sent to Solari.", source, KEY_PREFIX)
|
|
54
67
|
raise RunloopError(
|
|
@@ -17,15 +17,15 @@ def clean_env(monkeypatch):
|
|
|
17
17
|
|
|
18
18
|
def test_explicit_wins(monkeypatch):
|
|
19
19
|
monkeypatch.setenv("SOLARI_API_KEY", "slr_env")
|
|
20
|
-
assert _config.resolve("slr_arg", "https://x.
|
|
20
|
+
assert _config.resolve("slr_arg", "https://x.getsolari.com/") == ("slr_arg", "https://x.getsolari.com")
|
|
21
21
|
|
|
22
22
|
|
|
23
23
|
def test_solari_env_beats_runloop_env(monkeypatch):
|
|
24
24
|
monkeypatch.setenv("RUNLOOP_API_KEY", "slr_runloop")
|
|
25
25
|
monkeypatch.setenv("SOLARI_API_KEY", "slr_solari")
|
|
26
26
|
monkeypatch.setenv("RUNLOOP_BASE_URL", "https://r.getsolari.com")
|
|
27
|
-
monkeypatch.setenv("SOLARI_BASE_URL", "https://s.
|
|
28
|
-
assert _config.resolve(None, None) == ("slr_solari", "https://s.
|
|
27
|
+
monkeypatch.setenv("SOLARI_BASE_URL", "https://s.getsolari.com")
|
|
28
|
+
assert _config.resolve(None, None) == ("slr_solari", "https://s.getsolari.com")
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
def test_runloop_env_is_the_fallback(monkeypatch):
|
|
@@ -90,9 +90,21 @@ def test_a_runloop_base_url_for_a_solari_or_loopback_host_is_used(monkeypatch, u
|
|
|
90
90
|
assert _config.resolve(None, None)[1] == url.rstrip("/")
|
|
91
91
|
|
|
92
92
|
|
|
93
|
-
|
|
93
|
+
@pytest.mark.parametrize("url", ["https://my.proxy.internal", "https://api.runloop.ai", "https://getsolari.com.evil.example", "http://api.getsolari.com", "http://169.254.169.254", "not a url"])
|
|
94
|
+
def test_an_explicit_base_url_for_a_foreign_host_is_refused(monkeypatch, url):
|
|
94
95
|
monkeypatch.setenv("SOLARI_API_KEY", "slr_k")
|
|
95
|
-
|
|
96
|
+
with pytest.raises(_config.RunloopError, match="Refusing to send a Solari API key"):
|
|
97
|
+
_config.resolve(None, url)
|
|
98
|
+
monkeypatch.delenv("SOLARI_BASE_URL", raising=False)
|
|
99
|
+
monkeypatch.setenv("SOLARI_BASE_URL", url)
|
|
100
|
+
with pytest.raises(_config.RunloopError, match="Refusing to send a Solari API key"):
|
|
101
|
+
_config.resolve(None, None)
|
|
102
|
+
|
|
103
|
+
|
|
104
|
+
def test_an_explicit_base_url_for_a_solari_or_loopback_host_is_used(monkeypatch):
|
|
105
|
+
monkeypatch.setenv("SOLARI_API_KEY", "slr_k")
|
|
106
|
+
assert _config.resolve(None, "https://x.getsolari.com/")[1] == "https://x.getsolari.com"
|
|
107
|
+
assert _config.resolve(None, "http://127.0.0.1:4010")[1] == "http://127.0.0.1:4010"
|
|
96
108
|
|
|
97
109
|
|
|
98
110
|
def test_solari_base_url_beats_runloop_base_url(monkeypatch):
|
|
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
|
{solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/blueprint_view.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/devbox_view.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/secret_view.py
RENAMED
|
File without changes
|
{solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/shared/__init__.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{solari_runloop_compat-0.1.2 → solari_runloop_compat-0.2.0}/solari_runloop/types/tunnel_view.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|