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 a Solari API host 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-v2, 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=<a non-production gateway URL> 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.4

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.4
File Size Uploaded Provenance Actions
solari_e2b_compat-0.2.4.tar.gz 39.8 kB Without provenance Details for solari_e2b_compat-0.2.4.tar.gz

Built distribution (wheel)

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

Total release size: 87.8 kB

Release files / solari_e2b_compat-0.2.4.tar.gz

Download URL solari_e2b_compat-0.2.4.tar.gz
Size 39.8 kB
Tags Source
SHA-256 checksum
How to use checksums
4233296ffd8a04225d37a6c3991cb28e4abac5a0d26c7fe2f21d9c9c9ad97405
BLAKE2b-256 checksum
How to use checksums
ad330cfe24cb78c763fa8ed68c24081b72bbe45cd311a183f11b9444ae9e7364
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.4-py3-none-any.whl

Download URL solari_e2b_compat-0.2.4-py3-none-any.whl
Size 48.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
0cbf5edb2ac9fb33232b89611da4a06b323e351b6bbb53f7e92f1c8f321782db
BLAKE2b-256 checksum
How to use checksums
5ab4674b43642f6c18f1f75d064d06cafb77aa12d0854a23b7020b27c8fd9cc6
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.4

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