Skip to content

Commit fab3a3f

Browse files
committed
Prepare for SDK v2
1 parent a5e8ccc commit fab3a3f

19 files changed

+179
-113
lines changed

.changeset/new-kings-sleep.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
---
2+
'@e2b/code-interpreter-python': major
3+
'@e2b/code-interpreter': major
4+
---
5+
6+
SDK v2

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ Python
6161
```py
6262
from e2b_code_interpreter import Sandbox
6363

64-
with Sandbox() as sandbox:
64+
with Sandbox.create() as sandbox:
6565
sandbox.run_code("x = 1")
6666
execution = sandbox.run_code("x+=1; x")
6767
print(execution.text) # outputs 2

js/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@
6666
"vm"
6767
],
6868
"dependencies": {
69-
"e2b": "^2.0.0-rc.2"
69+
"e2b": "^2.0.0-rc.3"
7070
},
7171
"engines": {
7272
"node": ">=18"

pnpm-lock.yaml

Lines changed: 92 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ E2B_API_KEY=e2b_***
3636
```py
3737
from e2b_code_interpreter import Sandbox
3838

39-
with Sandbox() as sandbox:
39+
with Sandbox.create() as sandbox:
4040
sandbox.run_code("x = 1")
4141
execution = sandbox.run_code("x+=1; x")
4242
print(execution.text) # outputs 2

python/e2b_code_interpreter/code_interpreter_async.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
from e2b import (
88
AsyncSandbox as BaseAsyncSandbox,
9-
ConnectionConfig,
109
InvalidArgumentException,
1110
)
1211

@@ -189,7 +188,7 @@ async def run_code(
189188
)
190189

191190
timeout = None if timeout == 0 else (timeout or DEFAULT_TIMEOUT)
192-
request_timeout = request_timeout or self._connection_config.request_timeout
191+
request_timeout = request_timeout or self.connection_config.request_timeout
193192
context_id = context.id if context else None
194193

195194
try:
@@ -254,7 +253,7 @@ async def create_code_context(
254253
response = await self._client.post(
255254
f"{self._jupyter_url}/contexts",
256255
json=data,
257-
timeout=request_timeout or self._connection_config.request_timeout,
256+
timeout=request_timeout or self.connection_config.request_timeout,
258257
)
259258

260259
err = await aextract_exception(response)

python/e2b_code_interpreter/code_interpreter_sync.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,13 @@ class Sandbox(BaseSandbox):
4141
4242
Check docs [here](https://e2b.dev/docs).
4343
44-
Use the `Sandbox()` to create a new sandbox.
44+
Use the `Sandbox.create()` to create a new sandbox.
4545
4646
Example:
4747
```python
4848
from e2b_code_interpreter import Sandbox
4949
50-
sandbox = Sandbox()
50+
sandbox = Sandbox.create()
5151
```
5252
"""
5353

@@ -185,7 +185,7 @@ def run_code(
185185
)
186186

187187
timeout = None if timeout == 0 else (timeout or DEFAULT_TIMEOUT)
188-
request_timeout = request_timeout or self._connection_config.request_timeout
188+
request_timeout = request_timeout or self.connection_config.request_timeout
189189
context_id = context.id if context else None
190190

191191
try:
@@ -249,7 +249,7 @@ def create_code_context(
249249
response = self._client.post(
250250
f"{self._jupyter_url}/contexts",
251251
json=data,
252-
timeout=request_timeout or self._connection_config.request_timeout,
252+
timeout=request_timeout or self.connection_config.request_timeout,
253253
)
254254

255255
err = extract_exception(response)

python/example.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@
3434

3535

3636
async def run():
37-
sbx = Sandbox(timeout=60)
37+
sbx = Sandbox.create(timeout=60)
3838
e = sbx.run_code(code)
3939
print(e.results[0].chart)
4040

python/poetry.lock

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

python/pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ python = "^3.9"
1414

1515
httpx = ">=0.20.0, <1.0.0"
1616
attrs = ">=21.3.0"
17-
e2b = "^1.5.4"
17+
e2b = "^2.0.0rc2"
1818

1919
[tool.poetry.group.dev.dependencies]
2020
pytest = "^7.4.0"

0 commit comments

Comments
 (0)