e2b-code-interpreter 0.0.3__tar.gz → 0.0.5__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-0.0.3 → e2b_code_interpreter-0.0.5}/PKG-INFO +2 -44
- {e2b_code_interpreter-0.0.3 → e2b_code_interpreter-0.0.5}/README.md +0 -42
- e2b_code_interpreter-0.0.5/e2b_code_interpreter/__init__.py +4 -0
- {e2b_code_interpreter-0.0.3 → e2b_code_interpreter-0.0.5}/e2b_code_interpreter/main.py +2 -1
- {e2b_code_interpreter-0.0.3 → e2b_code_interpreter-0.0.5}/e2b_code_interpreter/models.py +26 -1
- {e2b_code_interpreter-0.0.3 → e2b_code_interpreter-0.0.5}/pyproject.toml +2 -3
- e2b_code_interpreter-0.0.3/e2b_code_interpreter/__init__.py +0 -2
- {e2b_code_interpreter-0.0.3 → e2b_code_interpreter-0.0.5}/e2b_code_interpreter/messaging.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: e2b-code-interpreter
|
|
3
|
-
Version: 0.0.
|
|
3
|
+
Version: 0.0.5
|
|
4
4
|
Summary: E2B Code Interpreter - Stateful code execution
|
|
5
5
|
Home-page: https://e2b.dev/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.9
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.10
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
|
-
Requires-Dist: e2b (>=0.
|
|
17
|
+
Requires-Dist: e2b (>=0.17.0)
|
|
18
18
|
Requires-Dist: pydantic (>1,<3)
|
|
19
19
|
Requires-Dist: websocket-client (>=1.7.0,<2.0.0)
|
|
20
20
|
Project-URL: Bug Tracker, https://github.com/e2b-dev/code-interpreter/issues
|
|
@@ -112,45 +112,3 @@ with CodeInterpreter() as sandbox:
|
|
|
112
112
|
sandbox.notebook.exec_cell(code, on_stdout=print, on_stderr=print, on_result=(lambda result: print(result.text)))
|
|
113
113
|
```
|
|
114
114
|
|
|
115
|
-
### Pre-installed Python packages inside the sandbox
|
|
116
|
-
|
|
117
|
-
The full and always up-to-date list can be found in the [`requirements.txt`](https://github.com/e2b-dev/E2B/blob/stateful-code-interpreter/sandboxes/code-interpreter-stateful/requirements.txt) file.
|
|
118
|
-
|
|
119
|
-
```text
|
|
120
|
-
# Jupyter server requirements
|
|
121
|
-
jupyter-server==2.13.0
|
|
122
|
-
ipykernel==6.29.3
|
|
123
|
-
ipython==8.22.2
|
|
124
|
-
|
|
125
|
-
# Other packages
|
|
126
|
-
aiohttp==3.9.3
|
|
127
|
-
beautifulsoup4==4.12.3
|
|
128
|
-
bokeh==3.3.4
|
|
129
|
-
gensim==4.3.2
|
|
130
|
-
imageio==2.34.0
|
|
131
|
-
joblib==1.3.2
|
|
132
|
-
librosa==0.10.1
|
|
133
|
-
matplotlib==3.8.3
|
|
134
|
-
nltk==3.8.1
|
|
135
|
-
numpy==1.26.4
|
|
136
|
-
opencv-python==4.9.0.80
|
|
137
|
-
openpyxl==3.1.2
|
|
138
|
-
pandas==1.5.3
|
|
139
|
-
plotly==5.19.0
|
|
140
|
-
pytest==8.1.0
|
|
141
|
-
python-docx==1.1.0
|
|
142
|
-
pytz==2024.1
|
|
143
|
-
requests==2.26.0
|
|
144
|
-
scikit-image==0.22.0
|
|
145
|
-
scikit-learn==1.4.1.post1
|
|
146
|
-
scipy==1.12.0
|
|
147
|
-
seaborn==0.13.2
|
|
148
|
-
soundfile==0.12.1
|
|
149
|
-
spacy==3.7.4
|
|
150
|
-
textblob==0.18.0
|
|
151
|
-
tornado==6.4
|
|
152
|
-
urllib3==1.26.7
|
|
153
|
-
xarray==2024.2.0
|
|
154
|
-
xlrd==2.0.1
|
|
155
|
-
```
|
|
156
|
-
|
|
@@ -88,45 +88,3 @@ print("world")
|
|
|
88
88
|
with CodeInterpreter() as sandbox:
|
|
89
89
|
sandbox.notebook.exec_cell(code, on_stdout=print, on_stderr=print, on_result=(lambda result: print(result.text)))
|
|
90
90
|
```
|
|
91
|
-
|
|
92
|
-
### Pre-installed Python packages inside the sandbox
|
|
93
|
-
|
|
94
|
-
The full and always up-to-date list can be found in the [`requirements.txt`](https://github.com/e2b-dev/E2B/blob/stateful-code-interpreter/sandboxes/code-interpreter-stateful/requirements.txt) file.
|
|
95
|
-
|
|
96
|
-
```text
|
|
97
|
-
# Jupyter server requirements
|
|
98
|
-
jupyter-server==2.13.0
|
|
99
|
-
ipykernel==6.29.3
|
|
100
|
-
ipython==8.22.2
|
|
101
|
-
|
|
102
|
-
# Other packages
|
|
103
|
-
aiohttp==3.9.3
|
|
104
|
-
beautifulsoup4==4.12.3
|
|
105
|
-
bokeh==3.3.4
|
|
106
|
-
gensim==4.3.2
|
|
107
|
-
imageio==2.34.0
|
|
108
|
-
joblib==1.3.2
|
|
109
|
-
librosa==0.10.1
|
|
110
|
-
matplotlib==3.8.3
|
|
111
|
-
nltk==3.8.1
|
|
112
|
-
numpy==1.26.4
|
|
113
|
-
opencv-python==4.9.0.80
|
|
114
|
-
openpyxl==3.1.2
|
|
115
|
-
pandas==1.5.3
|
|
116
|
-
plotly==5.19.0
|
|
117
|
-
pytest==8.1.0
|
|
118
|
-
python-docx==1.1.0
|
|
119
|
-
pytz==2024.1
|
|
120
|
-
requests==2.26.0
|
|
121
|
-
scikit-image==0.22.0
|
|
122
|
-
scikit-learn==1.4.1.post1
|
|
123
|
-
scipy==1.12.0
|
|
124
|
-
seaborn==0.13.2
|
|
125
|
-
soundfile==0.12.1
|
|
126
|
-
spacy==3.7.4
|
|
127
|
-
textblob==0.18.0
|
|
128
|
-
tornado==6.4
|
|
129
|
-
urllib3==1.26.7
|
|
130
|
-
xarray==2024.2.0
|
|
131
|
-
xlrd==2.0.1
|
|
132
|
-
```
|
|
@@ -2,10 +2,11 @@ from __future__ import annotations
|
|
|
2
2
|
|
|
3
3
|
import logging
|
|
4
4
|
import threading
|
|
5
|
+
import requests
|
|
6
|
+
|
|
5
7
|
from concurrent.futures import Future
|
|
6
8
|
from typing import Any, Callable, List, Optional, Dict
|
|
7
9
|
|
|
8
|
-
import requests
|
|
9
10
|
from e2b import EnvVars, ProcessMessage, Sandbox
|
|
10
11
|
from e2b.constants import TIMEOUT
|
|
11
12
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import copy
|
|
2
2
|
from typing import List, Optional, Iterable, Dict
|
|
3
|
-
from pydantic import BaseModel
|
|
3
|
+
from pydantic import BaseModel, field_serializer
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
class Error(BaseModel):
|
|
@@ -79,6 +79,12 @@ class Result:
|
|
|
79
79
|
self.javascript = data.pop("application/javascript", None)
|
|
80
80
|
self.extra = data
|
|
81
81
|
|
|
82
|
+
# Allows to iterate over formats()
|
|
83
|
+
def __getitem__(self, item):
|
|
84
|
+
if item in self.raw:
|
|
85
|
+
return self.raw[item]
|
|
86
|
+
return getattr(self, item)
|
|
87
|
+
|
|
82
88
|
def formats(self) -> Iterable[str]:
|
|
83
89
|
"""
|
|
84
90
|
Returns all available formats of the result.
|
|
@@ -228,6 +234,25 @@ class Execution(BaseModel):
|
|
|
228
234
|
if d.is_main_result:
|
|
229
235
|
return d.text
|
|
230
236
|
|
|
237
|
+
def to_json(self) -> str:
|
|
238
|
+
"""
|
|
239
|
+
Returns the JSON representation of the Execution object.
|
|
240
|
+
"""
|
|
241
|
+
return self.model_dump_json(exclude_none=True)
|
|
242
|
+
|
|
243
|
+
@field_serializer("results", when_used="json")
|
|
244
|
+
def serialize_results(results: List[Result]) -> List[Dict[str, str]]:
|
|
245
|
+
"""
|
|
246
|
+
Serializes the results to JSON.
|
|
247
|
+
This method is used by the Pydantic JSON encoder.
|
|
248
|
+
"""
|
|
249
|
+
serialized = []
|
|
250
|
+
for result in results:
|
|
251
|
+
serialized_dict = {key: result[key] for key in result.formats()}
|
|
252
|
+
serialized_dict['text'] = result.text
|
|
253
|
+
serialized.append(serialized_dict)
|
|
254
|
+
return serialized
|
|
255
|
+
|
|
231
256
|
|
|
232
257
|
class KernelException(Exception):
|
|
233
258
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "e2b-code-interpreter"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.5"
|
|
4
4
|
description = "E2B Code Interpreter - Stateful code execution"
|
|
5
5
|
authors = ["e2b <hello@e2b.dev>"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -12,9 +12,9 @@ packages = [{ include = "e2b_code_interpreter" }]
|
|
|
12
12
|
[tool.poetry.dependencies]
|
|
13
13
|
python = "^3.8"
|
|
14
14
|
|
|
15
|
-
e2b = ">=0.14.11"
|
|
16
15
|
pydantic = ">1, <3"
|
|
17
16
|
websocket-client = "^1.7.0"
|
|
17
|
+
e2b = ">=0.17.0"
|
|
18
18
|
|
|
19
19
|
[tool.poetry.group.dev.dependencies]
|
|
20
20
|
black = "^24.3.0"
|
|
@@ -22,7 +22,6 @@ pytest = "^7.4.0"
|
|
|
22
22
|
python-dotenv = "^1.0.0"
|
|
23
23
|
pytest-dotenv = "^0.5.2"
|
|
24
24
|
|
|
25
|
-
|
|
26
25
|
[build-system]
|
|
27
26
|
requires = ["poetry-core"]
|
|
28
27
|
build-backend = "poetry.core.masonry.api"
|
|
File without changes
|