e2b-code-interpreter 2.9.1__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.1 → e2b_code_interpreter-2.9.2}/PKG-INFO +6 -6
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/README.md +4 -4
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/charts.py +7 -5
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/code_interpreter_async.py +2 -2
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/code_interpreter_sync.py +2 -2
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/models.py +15 -8
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/pyproject.toml +2 -2
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/LICENSE +0 -0
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/__init__.py +0 -0
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/constants.py +0 -0
- {e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/exceptions.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
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
5
|
License: MIT
|
|
6
6
|
Author: e2b
|
|
@@ -16,7 +16,7 @@ Requires-Dist: attrs (>=21.3.0)
|
|
|
16
16
|
Requires-Dist: e2b (>=2.39.1,<3.0.0)
|
|
17
17
|
Requires-Dist: httpx (>=0.20.0,<1.0.0)
|
|
18
18
|
Project-URL: Bug Tracker, https://github.com/e2b-dev/code-interpreter/issues
|
|
19
|
-
Project-URL: Homepage, https://e2b.dev
|
|
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)}"
|
|
@@ -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)}"
|
|
@@ -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
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{e2b_code_interpreter-2.9.1 → e2b_code_interpreter-2.9.2}/e2b_code_interpreter/exceptions.py
RENAMED
|
File without changes
|