solari-e2b-compat 0.2.10__tar.gz → 0.2.11__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.
Files changed (32) hide show
  1. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/.gitignore +7 -0
  2. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/COMPAT.md +2 -1
  3. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/PKG-INFO +1 -1
  4. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/pyproject.toml +1 -1
  5. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/__init__.py +1 -1
  6. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_filesystem.py +12 -0
  7. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/__init__.py +6 -1
  8. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/LICENSE +0 -0
  9. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/LICENSE-E2B +0 -0
  10. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/NOTICE +0 -0
  11. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/README.md +0 -0
  12. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_box.py +0 -0
  13. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_commands.py +0 -0
  14. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_config.py +0 -0
  15. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_git.py +0 -0
  16. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_loop.py +0 -0
  17. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_redact.py +0 -0
  18. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_request.py +0 -0
  19. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_sandbox.py +0 -0
  20. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_sync.py +0 -0
  21. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_template.py +0 -0
  22. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_vendor_user.py +0 -0
  23. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/_volume.py +0 -0
  24. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/charts.py +0 -0
  25. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/client.py +0 -0
  26. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/code_interpreter_async.py +0 -0
  27. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/code_interpreter_sync.py +0 -0
  28. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/constants.py +0 -0
  29. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/exceptions.py +0 -0
  30. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/code_interpreter/models.py +0 -0
  31. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/exceptions.py +0 -0
  32. {solari_e2b_compat-0.2.10 → solari_e2b_compat-0.2.11}/solari_e2b/models.py +0 -0
@@ -70,3 +70,10 @@ infra/terraform/snapshots-volumes/.build/
70
70
  # (ASIA... + X-Amz-Security-Token). Never commit. Also stale PHASE_* here makes
71
71
  # a bare re-run skip bake+verify and exit 0 with zero assertions.
72
72
  infra/.deploy-e2e/
73
+
74
+ # Local Cloud Hypervisor fork checkout (patch series lives in patches/cloud-hypervisor-v43)
75
+ third_party/cloud-hypervisor/
76
+
77
+ # Build outputs accidentally committed on perf branches (excluded by staging/bare-metal-int)
78
+ /host-agent/host-agent
79
+ /bench/step-park/microbench
@@ -76,6 +76,7 @@ and the differences that are specific to Python.
76
76
  |---|---|---|
77
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
+ | `write` over 32 MiB | One write is one frame on the control channel, so more than 32 MiB raises `InvalidArgumentException` before anything is sent. Get a signed URL with `sandbox.upload_url(path)` and PUT the bytes to it (E2B has no `files.upload`). |
79
80
  | `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
81
  | `exists`, `make_dir`, `rename`, `remove` | OK, live | |
81
82
  | `watch_dir(path, on_event, recursive=)` | DIFF, live | `FilesystemEvent.name` is relative to the watched path. Solari reports creates as `write`. `include_entry=True` adds the entry (best effort: none when the path is already gone). `allow_network_mounts` has no effect (Solari's watcher has no such limit). A watch ends after `timeout` seconds (default 60; 0 disables); `on_exit(None)` is called once, whether it timed out or you called `stop()`. |
@@ -93,7 +94,7 @@ and the differences that are specific to Python.
93
94
  | `Result` formats | DIFF | `text`, `html`, `markdown`, `svg`, `png`, `jpeg`, `latex`, `json` (as given by the kernel), `chart`. `pdf`, `javascript`, `data` and `extra` are not produced. `chart` is E2B's class for its type (`LineChart`, `ScatterChart`, `BarChart`, `SuperChart`, ... in `solari_e2b.code_interpreter.charts`) and appears when the guest kernel extracts a structured chart (not for every figure). |
94
95
  | `envs=` per run | NO | |
95
96
  | `timeout=` | DIFF | Stops waiting and raises `TimeoutException`; the kernel keeps running the code. No default timeout (E2B's is 300 s). |
96
- | `create_code_context(cwd, language)` | OK, live | Python only. |
97
+ | `create_code_context(cwd, language)` | OK, live | Python only. A `cwd` that cannot be entered raises `InvalidArgumentException` (it used to leave the context in `$HOME` silently). |
97
98
  | `list_code_contexts`, `remove_code_context`, `restart_code_context` | DIFF, live | Solari cannot list or destroy kernels. `list` returns contexts created by this process; `remove` forgets the context (the kernel stays until the sandbox ends); `restart` clears the context's variables and working directory without restarting the process. |
98
99
  | Default template | DIFF | `code-interpreter-v2` is built into your org on first `Sandbox.create()` without a template: about 90 seconds (two timed builds on 2026-11-07 took 92 s and 95 s), billed as a template build, and two processes that both find it missing each start a build. `build_code_interpreter_template()` (async) / `build_code_interpreter_template_sync()` prebuild it. |
99
100
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.5
2
2
  Name: solari-e2b-compat
3
- Version: 0.2.10
3
+ Version: 0.2.11
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
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "solari-e2b-compat"
7
- version = "0.2.10"
7
+ version = "0.2.11"
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"
@@ -76,4 +76,4 @@ class _UnsupportedModule:
76
76
 
77
77
  client = _UnsupportedModule()
78
78
 
79
- __version__ = "0.2.10"
79
+ __version__ = "0.2.11"
@@ -8,6 +8,8 @@ import io
8
8
  from datetime import datetime, timezone
9
9
  from typing import Any, AsyncIterator, Callable, Dict, List, Optional, Union
10
10
 
11
+ from solari_core.handle import MAX_SINGLE_CALL_BYTES
12
+
11
13
  from ._box import Box, fire
12
14
  from ._request import bounded
13
15
  from .exceptions import FileNotFoundException, InvalidArgumentException, SolariCompatUnsupported
@@ -44,6 +46,13 @@ exit 0
44
46
  """
45
47
 
46
48
 
49
+ def too_large_message(n: int) -> str:
50
+ return (
51
+ f"file too large for one files.write call ({n} bytes, max {MAX_SINGLE_CALL_BYTES}): "
52
+ "get a signed URL with sandbox.upload_url(path) and PUT the bytes to it, or write the file in parts"
53
+ )
54
+
55
+
47
56
  class _Meta:
48
57
  """What the shell helper learned about one path."""
49
58
 
@@ -206,6 +215,9 @@ class AsyncFilesystem:
206
215
  _reject(user, "files.write", metadata)
207
216
  abs_ = await self._box.abs(path)
208
217
  raw = _to_bytes(data)
218
+ # Core's own message points at files.upload(), which the E2B API does not have; E2B callers have upload_url().
219
+ if len(raw) > MAX_SINGLE_CALL_BYTES:
220
+ raise InvalidArgumentException(too_large_message(len(raw)))
209
221
 
210
222
  async def _w(sb: Any) -> None:
211
223
  # E2B creates missing parent directories.
@@ -555,7 +555,12 @@ class AsyncSandbox(_AsyncBase):
555
555
  async def make() -> Context:
556
556
  cid = await self._box.on(lambda sb: sb.create_code_context("python"))
557
557
  if cwd:
558
- await self._box.on(lambda sb: sb.run_code(f"import os\nos.chdir({json.dumps(cwd)})\n", language="python", context_id=cid))
558
+ # run_code reports a failed chdir in ``error`` (it does not raise); without this check a bad cwd silently left the context in $HOME.
559
+ r = await self._box.on(lambda sb: sb.run_code(f"import os\nos.chdir({json.dumps(cwd)})\n", language="python", context_id=cid))
560
+ if r.error:
561
+ msg = r.error if isinstance(r.error, str) else getattr(r.error, "message", None) or getattr(r.error, "name", None) or str(r.error)
562
+ msg = ([ln for ln in str(msg).splitlines() if ln.strip()] or [str(msg)])[-1].strip() # a traceback: its last line names the error
563
+ raise InvalidArgumentException(f"create_code_context: cwd {json.dumps(cwd)} cannot be used: {msg}")
559
564
  ctx = Context(cid, "python", cwd or await self._box.home())
560
565
  _ctx_of(self.sandbox_id)[cid] = ctx
561
566
  return ctx