solari-e2b-compat 0.2.8__tar.gz → 0.2.9__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.8 → solari_e2b_compat-0.2.9}/COMPAT.md +1 -1
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/PKG-INFO +2 -2
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/pyproject.toml +2 -2
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/__init__.py +1 -1
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_box.py +9 -3
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_sync.py +22 -1
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/.gitignore +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/LICENSE +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/LICENSE-E2B +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/NOTICE +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/README.md +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_commands.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_config.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_filesystem.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_git.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_loop.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_redact.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_request.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_sandbox.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_template.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_vendor_user.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/_volume.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/__init__.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/charts.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/client.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/code_interpreter_async.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/code_interpreter_sync.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/constants.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/exceptions.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/models.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/exceptions.py +0 -0
- {solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/models.py +0 -0
|
@@ -74,7 +74,7 @@ and the differences that are specific to Python.
|
|
|
74
74
|
## Filesystem
|
|
75
75
|
| Call | Status | Notes |
|
|
76
76
|
|---|---|---|
|
|
77
|
-
| `read(path, format='text' \| 'bytes' \| 'stream')` | OK, live | Relative paths resolve against the guest's `$HOME
|
|
77
|
+
| `read(path, format='text' \| 'bytes' \| 'stream')` | OK, live | Relative paths resolve against the guest's `$HOME` and every path is normalised (no `.`, `..` or doubled slashes; `files.list('.')` entries are `/home/user/x`, not `/home/user/./x`). `bytes` returns a `bytearray`. `stream` returns a reader with one chunk: async-iterable in the async API, a plain iterator of `bytes` in the blocking API. A missing file raises `FileNotFoundException`. |
|
|
78
78
|
| `write(path, data)`, `write_files(entries)` | OK, live | `str`, `bytes` or a file-like object. Parent directories are created. `metadata=`: NO. `gzip`, `use_octet_stream`: how E2B encodes the HTTP upload; Solari writes over its control channel, so they change nothing (the file is the same). Likewise `read(gzip=, stream_idle_timeout=)`. |
|
|
79
79
|
| `list(path, depth)`, `get_info` | OK, live | Every symlink (also a dangling one) is returned as itself: `type=FileType.SYMLINK`, `symlink_target`, `permissions` like `Lrwxrwxrwx`, and it is not descended into by `depth`. `owner` and `group` are filled in. One extra shell command per listing does this (it needs `/bin/sh`; without it the plain listing is used: links are followed, `owner` / `group` are empty, and a dangling link raises). |
|
|
80
80
|
| `exists`, `make_dir`, `rename`, `remove` | OK, live | |
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: solari-e2b-compat
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.9
|
|
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
|
|
@@ -10,7 +10,7 @@ License-File: LICENSE-E2B
|
|
|
10
10
|
License-File: NOTICE
|
|
11
11
|
Keywords: code-interpreter,compatibility,e2b,sandbox,solari
|
|
12
12
|
Requires-Python: >=3.9
|
|
13
|
-
Requires-Dist: solari-core>=0.
|
|
13
|
+
Requires-Dist: solari-core>=0.7.11
|
|
14
14
|
Requires-Dist: solari-sandbox>=0.6.1
|
|
15
15
|
Provides-Extra: test
|
|
16
16
|
Requires-Dist: pytest-asyncio>=0.23; extra == 'test'
|
|
@@ -4,14 +4,14 @@ build-backend = "hatchling.build"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "solari-e2b-compat"
|
|
7
|
-
version = "0.2.
|
|
7
|
+
version = "0.2.9"
|
|
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"
|
|
11
11
|
license = { text = "MIT" }
|
|
12
12
|
authors = [{ name = "Solari" }]
|
|
13
13
|
keywords = ["solari", "sandbox", "e2b", "code-interpreter", "compatibility"]
|
|
14
|
-
dependencies = ["solari-sandbox>=0.6.1", "solari-core>=0.
|
|
14
|
+
dependencies = ["solari-sandbox>=0.6.1", "solari-core>=0.7.11"]
|
|
15
15
|
|
|
16
16
|
[project.optional-dependencies]
|
|
17
17
|
test = ["pytest>=7", "pytest-asyncio>=0.23"]
|
|
@@ -5,6 +5,7 @@ from __future__ import annotations
|
|
|
5
5
|
|
|
6
6
|
import asyncio
|
|
7
7
|
import inspect
|
|
8
|
+
import posixpath
|
|
8
9
|
from typing import Any, Awaitable, Callable, List, Optional, Tuple, TypeVar
|
|
9
10
|
from urllib.parse import quote
|
|
10
11
|
|
|
@@ -20,6 +21,10 @@ DEFAULT_HOME = "/home/user"
|
|
|
20
21
|
NATIVE_SHELL_SCRIPT = 'if [ -x /bin/bash ]; then exec /bin/bash -c "$1"; else exec /bin/sh -c "$1"; fi'
|
|
21
22
|
|
|
22
23
|
|
|
24
|
+
def _norm(path: str) -> str:
|
|
25
|
+
return "/" + posixpath.normpath(path).lstrip("/")
|
|
26
|
+
|
|
27
|
+
|
|
23
28
|
def shell_args(native: bool, command: str) -> Tuple[str, List[str]]:
|
|
24
29
|
"""``(program, args)`` for an E2B-style shell string: ``bash -lc`` normally, native-image safe otherwise."""
|
|
25
30
|
if native:
|
|
@@ -145,11 +150,12 @@ class Box:
|
|
|
145
150
|
return home
|
|
146
151
|
|
|
147
152
|
async def abs(self, path: str) -> str:
|
|
153
|
+
"""An absolute, normalised path (no ``.``, ``..`` or doubled slashes), like the paths E2B returns."""
|
|
148
154
|
if path.startswith("/"):
|
|
149
|
-
return path
|
|
155
|
+
return _norm(path)
|
|
150
156
|
home = await self.home()
|
|
151
157
|
if path == "~":
|
|
152
158
|
return home
|
|
153
159
|
if path.startswith("~/"):
|
|
154
|
-
return f"{home}/{path[2:]}"
|
|
155
|
-
return f"{home}/{path}"
|
|
160
|
+
return _norm(f"{home}/{path[2:]}")
|
|
161
|
+
return _norm(f"{home}/{path}")
|
|
@@ -11,7 +11,7 @@ import inspect
|
|
|
11
11
|
from typing import Any, Callable, Dict, Iterable, Iterator, List, Optional, Tuple, Union
|
|
12
12
|
|
|
13
13
|
from ._commands import BUFFER_EVENTS, DEFAULT_COMMAND_TIMEOUT, AsyncCommandHandle, AsyncCommandInputHandle, AsyncCommands, AsyncPty
|
|
14
|
-
from ._filesystem import AsyncFilesystem, AsyncWatchHandle
|
|
14
|
+
from ._filesystem import AsyncFileStreamReader, AsyncFilesystem, AsyncWatchHandle
|
|
15
15
|
from ._git import AsyncGit
|
|
16
16
|
from ._loop import LOOP
|
|
17
17
|
from ._request import bounded
|
|
@@ -206,7 +206,28 @@ for _m in [n for n in dir(AsyncGit) if not n.startswith("_") and inspect.iscorou
|
|
|
206
206
|
del _m
|
|
207
207
|
|
|
208
208
|
|
|
209
|
+
class FileStreamReader:
|
|
210
|
+
"""E2B's blocking ``files.read(format='stream')``: an iterator of bytes chunks."""
|
|
211
|
+
|
|
212
|
+
def __init__(self, reader: AsyncFileStreamReader) -> None:
|
|
213
|
+
self._r = reader
|
|
214
|
+
|
|
215
|
+
def __iter__(self) -> "FileStreamReader":
|
|
216
|
+
return self
|
|
217
|
+
|
|
218
|
+
def __next__(self) -> bytes:
|
|
219
|
+
try:
|
|
220
|
+
return LOOP.run(self._r.__anext__())
|
|
221
|
+
except StopAsyncIteration:
|
|
222
|
+
raise StopIteration from None
|
|
223
|
+
|
|
224
|
+
def close(self) -> None:
|
|
225
|
+
LOOP.run(self._r.aclose())
|
|
226
|
+
|
|
227
|
+
|
|
209
228
|
def wrap(v: Any) -> Any:
|
|
229
|
+
if isinstance(v, AsyncFileStreamReader):
|
|
230
|
+
return FileStreamReader(v)
|
|
210
231
|
if isinstance(v, AsyncFilesystem):
|
|
211
232
|
return SyncFilesystem(v)
|
|
212
233
|
if isinstance(v, AsyncCommands):
|
|
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
|
|
File without changes
|
|
File without changes
|
{solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/constants.py
RENAMED
|
File without changes
|
{solari_e2b_compat-0.2.8 → solari_e2b_compat-0.2.9}/solari_e2b/code_interpreter/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|