Skip to main content

solari-e2b-compat

An E2B-compatible Python API on top of Solari Sandbox. Change the import, keep your sandbox code.

Not affiliated with, endorsed by, or sponsored by E2B. "E2B" is E2B's product name; it appears here only to describe API compatibility. The API shapes follow the MIT-licensed e2b and e2b-code-interpreter SDKs, see NOTICE. Do not look for this package under e2b*.

# before: from e2b_code_interpreter import Sandbox
from solari_e2b.code_interpreter import Sandbox

sbx = Sandbox.create()                      # SOLARI_API_KEY in the environment
execution = sbx.run_code("x = 1\nx + 1")
print(execution.text)                       # "2"
print(sbx.commands.run("echo hello").stdout)
sbx.files.write("/tmp/a.txt", "hi")
sbx.kill()

The plain e2b package maps to solari_e2b:

# before: from e2b import Sandbox, AsyncSandbox, Template
from solari_e2b import Sandbox, AsyncSandbox, Template

Exports: Sandbox (blocking) and AsyncSandbox (create, connect, list, kill, pause, snapshots, fork, commands, files, pty), Template / AsyncTemplate and the template builder, the E2B exception classes (SandboxException, TimeoutException, NotFoundException, FileNotFoundException, CommandExitException, AuthenticationException, ...), SolariCompatUnsupported, and from solari_e2b.code_interpreter: Sandbox / AsyncSandbox with run_code and code contexts, Execution, Result, Context.

The blocking API runs the async client on one background thread; callbacks you pass (on_stdout, ...) run on that thread. Do not call the blocking API from inside such a callback; use AsyncSandbox there.

Configuration

Order
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
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 getsolari.com or loopback; otherwise ignored with a warning), default https://api.getsolari.com

An E2B key does not work here: use a Solari API key.

The code-interpreter template

e2b_code_interpreter runs in a template with a data-analysis stack (pandas, numpy, scipy, scikit-learn, seaborn, plotly, ...). Solari builds the equivalent, code-interpreter-v1, into your org the first time Sandbox.create() is called without a template (about 80 seconds, once). To do it ahead of time:

from solari_e2b.code_interpreter import build_code_interpreter_template_sync
build_code_interpreter_template_sync()      # or: await build_code_interpreter_template()

SOLARI_CODE_INTERPRETER_TEMPLATE overrides the template (a name or tpl_… id). The package list is CODE_INTERPRETER_PACKAGES; the very large audio, NLP and computer-vision wheels E2B ships (spacy, librosa, opencv, numba, gensim) are not included.

What works, what does not

COMPAT.md is the support matrix. Anything Solari cannot do raises SolariCompatUnsupported (a SandboxException) naming the feature; nothing is silently ignored. The sibling TypeScript package is sdk/packages/e2b-compat (@solarisdk/e2b-compat) and follows the same rules.

Tests

  • python -m pytest: offline unit tests, a fake gateway.
  • SOLARI_API_KEY=… SOLARI_BASE_URL=https://api-sta.getsolari.com python -m pytest -m live tests/test_live_staging.py: live tests against staging. They create their own sandboxes, snapshots and templates and delete only those.

Metadata

Release files for solari-e2b-compat 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for solari-e2b-compat 0.1.0
File Size Uploaded Provenance
solari_e2b_compat-0.1.0.tar.gz 34.1 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for solari-e2b-compat 0.1.0
File Interpreter ABI Platform
solari_e2b_compat-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 69.9 kB

Release files / solari_e2b_compat-0.1.0.tar.gz

Download URL solari_e2b_compat-0.1.0.tar.gz
Size 34.1 kB
Tags Source
SHA-256 checksum
How to use checksums
a24f153d8cd4d3c41a65b5e593ed0dbc062b0f0160cd76956164ec7eb7f99dd8
BLAKE2b-256 checksum
How to use checksums
c17b469a2b9b8ead1a254cb63c28aa887f17d4b3289889ea985cb6af68d0763f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Release files / solari_e2b_compat-0.1.0-py3-none-any.whl

Download URL solari_e2b_compat-0.1.0-py3-none-any.whl
Size 35.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
11960922bc276183a3aa88bb9ed86c1967abc3b746f35591287b10c353644bf2
BLAKE2b-256 checksum
How to use checksums
ef631a861f14af7fd27e02c414dc224e4fd17eba9fd1160b64c339023a5164dd
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.14.4

Security for solari-e2b-compat 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page