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.2.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.2.0
File Size Uploaded Provenance
solari_e2b_compat-0.2.0.tar.gz 35.1 kB Without provenance Details

Built distribution (wheel)

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

Total release size: 72.6 kB

Release files / solari_e2b_compat-0.2.0.tar.gz

Download URL solari_e2b_compat-0.2.0.tar.gz
Size 35.1 kB
Tags Source
SHA-256 checksum
How to use checksums
449184a40cc7f5c16c381384a69cab5528a65796e5178ab08907ef38d63d9f9f
BLAKE2b-256 checksum
How to use checksums
a9b0048146fcf170abb169772dd5937a9c02d7d6fefd604b3878ebc763616960
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

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

Download URL solari_e2b_compat-0.2.0-py3-none-any.whl
Size 37.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
545e28e7d601e7b07cb51902892a268fe38b33c4fcd6b20b50b2749117977a24
BLAKE2b-256 checksum
How to use checksums
97a99d03d87bd82660f31b79d599388b6c8d0caa215ea799ca9ad8f6984bf3b9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.15

Security for solari-e2b-compat 0.2.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