e2b-code-interpreter 0.0.11b2__tar.gz → 0.0.11b4__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.11b2 → e2b_code_interpreter-0.0.11b4}/PKG-INFO +2 -2
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/code_interpreter_async.py +11 -5
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/code_interpreter_sync.py +12 -5
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/models.py +5 -2
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/pyproject.toml +2 -2
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/README.md +0 -0
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/__init__.py +0 -0
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/constants.py +0 -0
- {e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/exceptions.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.11b4
|
|
4
4
|
Summary: E2B Code Interpreter - Stateful code execution
|
|
5
5
|
Home-page: https://e2b.dev/
|
|
6
6
|
License: Apache-2.0
|
|
@@ -15,7 +15,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.11
|
|
16
16
|
Classifier: Programming Language :: Python :: 3.12
|
|
17
17
|
Requires-Dist: attrs (>=21.3.0)
|
|
18
|
-
Requires-Dist: e2b (
|
|
18
|
+
Requires-Dist: e2b (>=0.17.2a50,<0.18.0)
|
|
19
19
|
Requires-Dist: httpx (>=0.20.0,<0.28.0)
|
|
20
20
|
Project-URL: Bug Tracker, https://github.com/e2b-dev/code-interpreter/issues
|
|
21
21
|
Project-URL: Repository, https://github.com/e2b-dev/e2b-code-interpreter/tree/python
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import httpx
|
|
3
3
|
|
|
4
|
-
from typing import Optional, List
|
|
4
|
+
from typing import Optional, List, Dict
|
|
5
5
|
from httpx import AsyncHTTPTransport, AsyncClient
|
|
6
6
|
|
|
7
7
|
from e2b import AsyncSandbox, ConnectionConfig
|
|
@@ -52,6 +52,7 @@ class JupyterExtension:
|
|
|
52
52
|
on_stdout: Optional[OutputHandler[OutputMessage]] = None,
|
|
53
53
|
on_stderr: Optional[OutputHandler[OutputMessage]] = None,
|
|
54
54
|
on_result: Optional[OutputHandler[Result]] = None,
|
|
55
|
+
envs: Optional[Dict[str, str]] = None,
|
|
55
56
|
timeout: Optional[float] = None,
|
|
56
57
|
request_timeout: Optional[float] = None,
|
|
57
58
|
) -> Execution:
|
|
@@ -67,6 +68,7 @@ class JupyterExtension:
|
|
|
67
68
|
json={
|
|
68
69
|
"code": code,
|
|
69
70
|
"context_id": kernel_id,
|
|
71
|
+
"env_vars": envs,
|
|
70
72
|
},
|
|
71
73
|
timeout=(request_timeout, timeout, request_timeout, request_timeout),
|
|
72
74
|
) as response:
|
|
@@ -97,14 +99,17 @@ class JupyterExtension:
|
|
|
97
99
|
cwd: Optional[str] = None,
|
|
98
100
|
kernel_name: Optional[str] = None,
|
|
99
101
|
request_timeout: Optional[float] = None,
|
|
102
|
+
envs: Optional[Dict[str, str]] = None,
|
|
100
103
|
) -> str:
|
|
101
|
-
logger.debug(f"Creating new kernel
|
|
104
|
+
logger.debug(f"Creating new kernel {kernel_name}")
|
|
102
105
|
|
|
103
106
|
data = {}
|
|
104
107
|
if kernel_name:
|
|
105
108
|
data["name"] = kernel_name
|
|
106
109
|
if cwd:
|
|
107
110
|
data["cwd"] = cwd
|
|
111
|
+
if envs:
|
|
112
|
+
data["env_vars"] = envs
|
|
108
113
|
|
|
109
114
|
try:
|
|
110
115
|
response = await self._client.post(
|
|
@@ -127,9 +132,10 @@ class JupyterExtension:
|
|
|
127
132
|
kernel_id: Optional[str] = None,
|
|
128
133
|
request_timeout: Optional[float] = None,
|
|
129
134
|
) -> None:
|
|
135
|
+
kernel_id = kernel_id or DEFAULT_KERNEL_ID
|
|
136
|
+
|
|
130
137
|
logger.debug(f"Shutting down a kernel with id {kernel_id}")
|
|
131
138
|
|
|
132
|
-
kernel_id = kernel_id or DEFAULT_KERNEL_ID
|
|
133
139
|
try:
|
|
134
140
|
response = await self._client.delete(
|
|
135
141
|
url=f"{self._url}/contexts/{kernel_id}",
|
|
@@ -147,10 +153,10 @@ class JupyterExtension:
|
|
|
147
153
|
kernel_id: Optional[str] = None,
|
|
148
154
|
request_timeout: Optional[float] = None,
|
|
149
155
|
) -> None:
|
|
150
|
-
logger.debug(f"Restarting kernel: {kernel_id}")
|
|
151
|
-
|
|
152
156
|
kernel_id = kernel_id or DEFAULT_KERNEL_ID
|
|
153
157
|
|
|
158
|
+
logger.debug(f"Restarting kernel {kernel_id}")
|
|
159
|
+
|
|
154
160
|
try:
|
|
155
161
|
response = await self._client.post(
|
|
156
162
|
f"{self._url}/contexts/{kernel_id}/restart",
|
|
@@ -51,6 +51,7 @@ class JupyterExtension:
|
|
|
51
51
|
on_stdout: Optional[OutputHandler[OutputMessage]] = None,
|
|
52
52
|
on_stderr: Optional[OutputHandler[OutputMessage]] = None,
|
|
53
53
|
on_result: Optional[OutputHandler[Result]] = None,
|
|
54
|
+
envs: Optional[Dict[str, str]] = None,
|
|
54
55
|
timeout: Optional[float] = None,
|
|
55
56
|
request_timeout: Optional[float] = None,
|
|
56
57
|
) -> Execution:
|
|
@@ -66,6 +67,7 @@ class JupyterExtension:
|
|
|
66
67
|
json={
|
|
67
68
|
"code": code,
|
|
68
69
|
"context_id": kernel_id,
|
|
70
|
+
"env_vars": envs,
|
|
69
71
|
},
|
|
70
72
|
timeout=(request_timeout, timeout, request_timeout, request_timeout),
|
|
71
73
|
) as response:
|
|
@@ -96,7 +98,7 @@ class JupyterExtension:
|
|
|
96
98
|
kernel_name: Optional[str] = None,
|
|
97
99
|
request_timeout: Optional[float] = None,
|
|
98
100
|
) -> str:
|
|
99
|
-
logger.debug(f"Creating new kernel
|
|
101
|
+
logger.debug(f"Creating new kernel {kernel_name}")
|
|
100
102
|
|
|
101
103
|
data = {}
|
|
102
104
|
if kernel_name:
|
|
@@ -125,10 +127,10 @@ class JupyterExtension:
|
|
|
125
127
|
kernel_id: Optional[str] = None,
|
|
126
128
|
request_timeout: Optional[float] = None,
|
|
127
129
|
) -> None:
|
|
128
|
-
logger.debug(f"Shutting down a kernel with id {kernel_id}")
|
|
129
|
-
|
|
130
130
|
kernel_id = kernel_id or DEFAULT_KERNEL_ID
|
|
131
131
|
|
|
132
|
+
logger.debug(f"Shutting down a kernel with id {kernel_id}")
|
|
133
|
+
|
|
132
134
|
try:
|
|
133
135
|
response = self._client.delete(
|
|
134
136
|
url=f"{self._url}/contexts/{kernel_id}",
|
|
@@ -145,9 +147,10 @@ class JupyterExtension:
|
|
|
145
147
|
kernel_id: Optional[str] = None,
|
|
146
148
|
request_timeout: Optional[float] = None,
|
|
147
149
|
) -> None:
|
|
148
|
-
logger.debug(f"Creating new kernel for language: {kernel_id}")
|
|
149
|
-
|
|
150
150
|
kernel_id = kernel_id or DEFAULT_KERNEL_ID
|
|
151
|
+
|
|
152
|
+
logger.debug(f"Restarting kernel {kernel_id}")
|
|
153
|
+
|
|
151
154
|
try:
|
|
152
155
|
response = self._client.post(
|
|
153
156
|
f"{self._url}/contexts/{kernel_id}/restart",
|
|
@@ -164,6 +167,8 @@ class JupyterExtension:
|
|
|
164
167
|
self,
|
|
165
168
|
request_timeout: Optional[float] = None,
|
|
166
169
|
) -> List[Kernel]:
|
|
170
|
+
logger.debug("Listing kernels")
|
|
171
|
+
|
|
167
172
|
try:
|
|
168
173
|
response = self._client.get(
|
|
169
174
|
f"{self._url}/contexts",
|
|
@@ -192,6 +197,7 @@ class CodeInterpreter(Sandbox):
|
|
|
192
197
|
template: Optional[str] = None,
|
|
193
198
|
timeout: Optional[int] = None,
|
|
194
199
|
metadata: Optional[Dict[str, str]] = None,
|
|
200
|
+
envs: Optional[Dict[str, str]] = None,
|
|
195
201
|
api_key: Optional[str] = None,
|
|
196
202
|
domain: Optional[str] = None,
|
|
197
203
|
debug: Optional[bool] = None,
|
|
@@ -202,6 +208,7 @@ class CodeInterpreter(Sandbox):
|
|
|
202
208
|
template=template,
|
|
203
209
|
timeout=timeout,
|
|
204
210
|
metadata=metadata,
|
|
211
|
+
envs=envs,
|
|
205
212
|
api_key=api_key,
|
|
206
213
|
domain=domain,
|
|
207
214
|
debug=debug,
|
{e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/models.py
RENAMED
|
@@ -136,10 +136,13 @@ class Result:
|
|
|
136
136
|
|
|
137
137
|
:return: The text representation of the data.
|
|
138
138
|
"""
|
|
139
|
-
return self.
|
|
139
|
+
return self.__repr__()
|
|
140
140
|
|
|
141
141
|
def __repr__(self) -> str:
|
|
142
|
-
|
|
142
|
+
if self.text:
|
|
143
|
+
return f"Result({self.text})"
|
|
144
|
+
else:
|
|
145
|
+
return "Result(Formats: " + ", ".join(self.formats()) + ")"
|
|
143
146
|
|
|
144
147
|
def _repr_html_(self) -> Optional[str]:
|
|
145
148
|
"""
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "e2b-code-interpreter"
|
|
3
|
-
version = "0.0.
|
|
3
|
+
version = "0.0.11b4"
|
|
4
4
|
description = "E2B Code Interpreter - Stateful code execution"
|
|
5
5
|
authors = ["e2b <hello@e2b.dev>"]
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -14,7 +14,7 @@ python = "^3.8"
|
|
|
14
14
|
|
|
15
15
|
httpx = ">=0.20.0,<0.28.0"
|
|
16
16
|
attrs = ">=21.3.0"
|
|
17
|
-
e2b = "0.17.
|
|
17
|
+
e2b = "^0.17.2a50"
|
|
18
18
|
|
|
19
19
|
[tool.poetry.group.dev.dependencies]
|
|
20
20
|
black = "^24.3.0"
|
|
File without changes
|
{e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/__init__.py
RENAMED
|
File without changes
|
{e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/constants.py
RENAMED
|
File without changes
|
{e2b_code_interpreter-0.0.11b2 → e2b_code_interpreter-0.0.11b4}/e2b_code_interpreter/exceptions.py
RENAMED
|
File without changes
|