e2b-code-interpreter 2.9.0__tar.gz → 2.9.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/PKG-INFO +8 -8
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/README.md +4 -4
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/charts.py +7 -5
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/code_interpreter_async.py +18 -3
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/code_interpreter_sync.py +18 -3
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/models.py +15 -8
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/pyproject.toml +3 -3
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/LICENSE +0 -0
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/__init__.py +0 -0
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/constants.py +0 -0
- {e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/exceptions.py +0 -0
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.3
|
|
2
2
|
Name: e2b-code-interpreter
|
|
3
|
-
Version: 2.9.
|
|
3
|
+
Version: 2.9.2
|
|
4
4
|
Summary: E2B Code Interpreter - Stateful code execution
|
|
5
|
-
Home-page: https://e2b.dev/
|
|
6
5
|
License: MIT
|
|
7
6
|
Author: e2b
|
|
8
7
|
Author-email: hello@e2b.dev
|
|
@@ -14,9 +13,10 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
14
13
|
Classifier: Programming Language :: Python :: 3.12
|
|
15
14
|
Classifier: Programming Language :: Python :: 3.13
|
|
16
15
|
Requires-Dist: attrs (>=21.3.0)
|
|
17
|
-
Requires-Dist: e2b (>=2.
|
|
16
|
+
Requires-Dist: e2b (>=2.39.1,<3.0.0)
|
|
18
17
|
Requires-Dist: httpx (>=0.20.0,<1.0.0)
|
|
19
18
|
Project-URL: Bug Tracker, https://github.com/e2b-dev/code-interpreter/issues
|
|
19
|
+
Project-URL: Homepage, https://e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=package_homepage&utm_content=e2b-code-interpreter
|
|
20
20
|
Project-URL: Repository, https://github.com/e2b-dev/code-interpreter/tree/main/python
|
|
21
21
|
Description-Content-Type: text/markdown
|
|
22
22
|
|
|
@@ -35,7 +35,7 @@ Description-Content-Type: text/markdown
|
|
|
35
35
|
<img width="100%" src="/readme-assets/preview.png" alt="Cover image">
|
|
36
36
|
--->
|
|
37
37
|
## What is E2B?
|
|
38
|
-
[E2B](https://
|
|
38
|
+
[E2B](https://e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter) is an open-source infrastructure that allows you run to AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/@e2b/code-interpreter) or [Python SDK](https://pypi.org/project/e2b_code_interpreter).
|
|
39
39
|
|
|
40
40
|
## Run your first Sandbox
|
|
41
41
|
|
|
@@ -46,8 +46,8 @@ pip install e2b-code-interpreter
|
|
|
46
46
|
```
|
|
47
47
|
|
|
48
48
|
### 2. Get your E2B API key
|
|
49
|
-
1. Sign up to E2B [here](https://e2b.dev).
|
|
50
|
-
2. Get your API key [here](https://e2b.dev/dashboard?tab=keys).
|
|
49
|
+
1. Sign up to E2B [here](https://e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter).
|
|
50
|
+
2. Get your API key [here](https://e2b.dev/dashboard?tab=keys&utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter).
|
|
51
51
|
3. Set environment variable with your API key.
|
|
52
52
|
```
|
|
53
53
|
E2B_API_KEY=e2b_***
|
|
@@ -65,7 +65,7 @@ with Sandbox.create() as sandbox:
|
|
|
65
65
|
```
|
|
66
66
|
|
|
67
67
|
### 4. Check docs
|
|
68
|
-
Visit [E2B documentation](https://e2b.dev
|
|
68
|
+
Visit [E2B documentation](https://docs.e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter).
|
|
69
69
|
|
|
70
70
|
### 5. E2B cookbook
|
|
71
71
|
Visit our [Cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
<img width="100%" src="/readme-assets/preview.png" alt="Cover image">
|
|
14
14
|
--->
|
|
15
15
|
## What is E2B?
|
|
16
|
-
[E2B](https://
|
|
16
|
+
[E2B](https://e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter) is an open-source infrastructure that allows you run to AI-generated code in secure isolated sandboxes in the cloud. To start and control sandboxes, use our [JavaScript SDK](https://www.npmjs.com/package/@e2b/code-interpreter) or [Python SDK](https://pypi.org/project/e2b_code_interpreter).
|
|
17
17
|
|
|
18
18
|
## Run your first Sandbox
|
|
19
19
|
|
|
@@ -24,8 +24,8 @@ pip install e2b-code-interpreter
|
|
|
24
24
|
```
|
|
25
25
|
|
|
26
26
|
### 2. Get your E2B API key
|
|
27
|
-
1. Sign up to E2B [here](https://e2b.dev).
|
|
28
|
-
2. Get your API key [here](https://e2b.dev/dashboard?tab=keys).
|
|
27
|
+
1. Sign up to E2B [here](https://e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter).
|
|
28
|
+
2. Get your API key [here](https://e2b.dev/dashboard?tab=keys&utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter).
|
|
29
29
|
3. Set environment variable with your API key.
|
|
30
30
|
```
|
|
31
31
|
E2B_API_KEY=e2b_***
|
|
@@ -43,7 +43,7 @@ with Sandbox.create() as sandbox:
|
|
|
43
43
|
```
|
|
44
44
|
|
|
45
45
|
### 4. Check docs
|
|
46
|
-
Visit [E2B documentation](https://e2b.dev
|
|
46
|
+
Visit [E2B documentation](https://docs.e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=readme&utm_content=code-interpreter).
|
|
47
47
|
|
|
48
48
|
### 5. E2B cookbook
|
|
49
49
|
Visit our [Cookbook](https://github.com/e2b-dev/e2b-cookbook/tree/main) to get inspired by examples with different LLMs and AI frameworks.
|
|
@@ -194,17 +194,19 @@ class BoxAndWhiskerChart(Chart2D):
|
|
|
194
194
|
class SuperChart(Chart):
|
|
195
195
|
type = ChartType.SUPERCHART
|
|
196
196
|
|
|
197
|
-
elements: List[
|
|
198
|
-
Union[LineChart, ScatterChart, BarChart, PieChart, BoxAndWhiskerChart]
|
|
199
|
-
]
|
|
197
|
+
elements: List[Chart]
|
|
200
198
|
|
|
201
199
|
def __init__(self, **kwargs):
|
|
202
200
|
super().__init__(**kwargs)
|
|
203
|
-
self.elements = [
|
|
201
|
+
self.elements = []
|
|
202
|
+
for raw_chart in kwargs["elements"]:
|
|
203
|
+
chart = _deserialize_chart(raw_chart)
|
|
204
|
+
if chart is not None:
|
|
205
|
+
self.elements.append(chart)
|
|
204
206
|
|
|
205
207
|
|
|
206
208
|
ChartTypes = Union[
|
|
207
|
-
LineChart, ScatterChart, BarChart, PieChart, BoxAndWhiskerChart, SuperChart
|
|
209
|
+
Chart, LineChart, ScatterChart, BarChart, PieChart, BoxAndWhiskerChart, SuperChart
|
|
208
210
|
]
|
|
209
211
|
|
|
210
212
|
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import httpx
|
|
3
3
|
|
|
4
|
-
from typing import Optional, Dict, overload, Union, List
|
|
4
|
+
from typing import cast, Optional, Dict, overload, Union, List
|
|
5
5
|
from httpx import AsyncClient
|
|
6
6
|
|
|
7
7
|
from e2b import (
|
|
@@ -63,7 +63,7 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
63
63
|
def _jupyter_url(self) -> str:
|
|
64
64
|
# Honors the `sandbox_url` option and the `E2B_SANDBOX_URL` environment
|
|
65
65
|
# variable, same as the base SDK does for envd requests.
|
|
66
|
-
sandbox_url = self.connection_config._sandbox_url
|
|
66
|
+
sandbox_url = cast(Optional[str], self.connection_config._sandbox_url)
|
|
67
67
|
if sandbox_url:
|
|
68
68
|
return sandbox_url
|
|
69
69
|
return f"{'http' if self.connection_config.debug else 'https'}://{self.get_host(JUPYTER_PORT)}"
|
|
@@ -219,7 +219,22 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
219
219
|
"env_vars": envs,
|
|
220
220
|
},
|
|
221
221
|
headers=headers,
|
|
222
|
-
timeout
|
|
222
|
+
# `timeout` bounds the execution, `request_timeout` only the
|
|
223
|
+
# connect. Every non-connect phase must carry `timeout`: the
|
|
224
|
+
# SDK's pyqwest-backed transport collapses the per-phase
|
|
225
|
+
# timeouts into a single whole-request deadline and takes the
|
|
226
|
+
# longest of them, so leaving `request_timeout` on the write
|
|
227
|
+
# and pool phases would raise the floor to
|
|
228
|
+
# `max(timeout, request_timeout)` and silently ignore any
|
|
229
|
+
# `timeout` shorter than it. This matches the JS SDK, which
|
|
230
|
+
# aborts the execution on a `timeout`-long timer.
|
|
231
|
+
# `timeout=0` disables the deadline entirely; the transport
|
|
232
|
+
# still bounds connect on its own.
|
|
233
|
+
timeout=(
|
|
234
|
+
httpx.Timeout(timeout, connect=request_timeout)
|
|
235
|
+
if timeout is not None
|
|
236
|
+
else httpx.Timeout(None)
|
|
237
|
+
),
|
|
223
238
|
) as response:
|
|
224
239
|
err = await aextract_exception(response)
|
|
225
240
|
if err:
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import httpx
|
|
3
3
|
|
|
4
|
-
from typing import Optional, Dict, overload, Union, List
|
|
4
|
+
from typing import cast, Optional, Dict, overload, Union, List
|
|
5
5
|
from httpx import Client
|
|
6
6
|
from e2b import Sandbox as BaseSandbox, InvalidArgumentException
|
|
7
7
|
from e2b.api.client_sync import get_transport
|
|
@@ -60,7 +60,7 @@ class Sandbox(BaseSandbox):
|
|
|
60
60
|
def _jupyter_url(self) -> str:
|
|
61
61
|
# Honors the `sandbox_url` option and the `E2B_SANDBOX_URL` environment
|
|
62
62
|
# variable, same as the base SDK does for envd requests.
|
|
63
|
-
sandbox_url = self.connection_config._sandbox_url
|
|
63
|
+
sandbox_url = cast(Optional[str], self.connection_config._sandbox_url)
|
|
64
64
|
if sandbox_url:
|
|
65
65
|
return sandbox_url
|
|
66
66
|
return f"{'http' if self.connection_config.debug else 'https'}://{self.get_host(JUPYTER_PORT)}"
|
|
@@ -214,7 +214,22 @@ class Sandbox(BaseSandbox):
|
|
|
214
214
|
"env_vars": envs,
|
|
215
215
|
},
|
|
216
216
|
headers=headers,
|
|
217
|
-
timeout
|
|
217
|
+
# `timeout` bounds the execution, `request_timeout` only the
|
|
218
|
+
# connect. Every non-connect phase must carry `timeout`: the
|
|
219
|
+
# SDK's pyqwest-backed transport collapses the per-phase
|
|
220
|
+
# timeouts into a single whole-request deadline and takes the
|
|
221
|
+
# longest of them, so leaving `request_timeout` on the write
|
|
222
|
+
# and pool phases would raise the floor to
|
|
223
|
+
# `max(timeout, request_timeout)` and silently ignore any
|
|
224
|
+
# `timeout` shorter than it. This matches the JS SDK, which
|
|
225
|
+
# aborts the execution on a `timeout`-long timer.
|
|
226
|
+
# `timeout=0` disables the deadline entirely; the transport
|
|
227
|
+
# still bounds connect on its own.
|
|
228
|
+
timeout=(
|
|
229
|
+
httpx.Timeout(timeout, connect=request_timeout)
|
|
230
|
+
if timeout is not None
|
|
231
|
+
else httpx.Timeout(None)
|
|
232
|
+
),
|
|
218
233
|
) as response:
|
|
219
234
|
err = extract_exception(response)
|
|
220
235
|
if err:
|
|
@@ -207,7 +207,7 @@ class Result:
|
|
|
207
207
|
|
|
208
208
|
return formats
|
|
209
209
|
|
|
210
|
-
def __str__(self) ->
|
|
210
|
+
def __str__(self) -> str:
|
|
211
211
|
"""
|
|
212
212
|
Returns the text representation of the data.
|
|
213
213
|
|
|
@@ -305,7 +305,12 @@ class Logs:
|
|
|
305
305
|
stderr: List[str] = field(default_factory=list)
|
|
306
306
|
"""List of strings printed to stderr by prints, subprocesses, etc."""
|
|
307
307
|
|
|
308
|
-
def __init__(
|
|
308
|
+
def __init__(
|
|
309
|
+
self,
|
|
310
|
+
stdout: Optional[List[str]] = None,
|
|
311
|
+
stderr: Optional[List[str]] = None,
|
|
312
|
+
**kwargs,
|
|
313
|
+
):
|
|
309
314
|
self.stdout = stdout or []
|
|
310
315
|
self.stderr = stderr or []
|
|
311
316
|
|
|
@@ -329,7 +334,9 @@ def serialize_results(results: List[Result]) -> List[Dict[str, str]]:
|
|
|
329
334
|
serialized_dict = {}
|
|
330
335
|
for key in result.formats():
|
|
331
336
|
if key == "chart":
|
|
332
|
-
|
|
337
|
+
chart = result.chart
|
|
338
|
+
if chart is not None:
|
|
339
|
+
serialized_dict[key] = chart.to_dict()
|
|
333
340
|
else:
|
|
334
341
|
serialized_dict[key] = result[key]
|
|
335
342
|
|
|
@@ -356,8 +363,8 @@ class Execution:
|
|
|
356
363
|
|
|
357
364
|
def __init__(
|
|
358
365
|
self,
|
|
359
|
-
results: List[Result] = None,
|
|
360
|
-
logs: Logs = None,
|
|
366
|
+
results: Optional[List[Result]] = None,
|
|
367
|
+
logs: Optional[Logs] = None,
|
|
361
368
|
error: Optional[ExecutionError] = None,
|
|
362
369
|
execution_count: Optional[int] = None,
|
|
363
370
|
**kwargs,
|
|
@@ -510,7 +517,7 @@ class Context:
|
|
|
510
517
|
@classmethod
|
|
511
518
|
def from_json(cls, data: Dict[str, str]):
|
|
512
519
|
return cls(
|
|
513
|
-
context_id=data
|
|
514
|
-
language=data
|
|
515
|
-
cwd=data
|
|
520
|
+
context_id=data["id"],
|
|
521
|
+
language=data["language"],
|
|
522
|
+
cwd=data["cwd"],
|
|
516
523
|
)
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "e2b-code-interpreter"
|
|
3
|
-
version = "2.9.
|
|
3
|
+
version = "2.9.2"
|
|
4
4
|
description = "E2B Code Interpreter - Stateful code execution"
|
|
5
5
|
authors = ["e2b <hello@e2b.dev>"]
|
|
6
6
|
license = "MIT"
|
|
7
7
|
readme = "README.md"
|
|
8
|
-
homepage = "https://e2b.dev
|
|
8
|
+
homepage = "https://e2b.dev/?utm_source=pypi&utm_medium=referral&utm_campaign=package_homepage&utm_content=e2b-code-interpreter"
|
|
9
9
|
repository = "https://github.com/e2b-dev/code-interpreter/tree/main/python"
|
|
10
10
|
packages = [{ include = "e2b_code_interpreter" }]
|
|
11
11
|
|
|
@@ -14,7 +14,7 @@ python = "^3.10"
|
|
|
14
14
|
|
|
15
15
|
httpx = ">=0.20.0, <1.0.0"
|
|
16
16
|
attrs = ">=21.3.0"
|
|
17
|
-
e2b = "^2.
|
|
17
|
+
e2b = "^2.39.1"
|
|
18
18
|
|
|
19
19
|
[tool.poetry.group.dev.dependencies]
|
|
20
20
|
pytest = "^9.0.3"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{e2b_code_interpreter-2.9.0 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/exceptions.py
RENAMED
|
File without changes
|