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.3

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.3
File Size Uploaded Provenance Actions
solari_e2b_compat-0.2.3.tar.gz 39.7 kB Without provenance Details for solari_e2b_compat-0.2.3.tar.gz

Built distribution (wheel)

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

Total release size: 81.6 kB

Release files / solari_e2b_compat-0.2.3.tar.gz

Download URL solari_e2b_compat-0.2.3.tar.gz
Size 39.7 kB
Tags Source
SHA-256 checksum
How to use checksums
c5d217fe16d21d00b77e1de543726909ee58b6b38204b63cb062d05e312bff94
BLAKE2b-256 checksum
How to use checksums
886bc1bbef1b2864ec3c9dbbebffe9c47f0f4c4006daf8479d6b7b6bed6937cf
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.3-py3-none-any.whl

Download URL solari_e2b_compat-0.2.3-py3-none-any.whl
Size 41.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
634bfb2fbf596c93826c01cd03dfb97787ff3b7a686f2063b5a96b12715e6373
BLAKE2b-256 checksum
How to use checksums
67275e2c5e3a0d3b4ce2c581b9bf9d145811779aa2303c7539e7cc27e05db1c6
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.3

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