e2b-code-interpreter 2.2.1__tar.gz → 2.4.0__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.2.1 → e2b_code_interpreter-2.4.0}/PKG-INFO +2 -2
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/code_interpreter_async.py +87 -1
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/code_interpreter_sync.py +87 -1
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/pyproject.toml +4 -4
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/LICENSE +0 -0
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/README.md +0 -0
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/__init__.py +0 -0
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/charts.py +0 -0
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/constants.py +0 -0
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/exceptions.py +0 -0
- {e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/models.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: e2b-code-interpreter
|
|
3
|
-
Version: 2.
|
|
3
|
+
Version: 2.4.0
|
|
4
4
|
Summary: E2B Code Interpreter - Stateful code execution
|
|
5
5
|
Home-page: https://e2b.dev/
|
|
6
6
|
License: MIT
|
|
@@ -14,7 +14,7 @@ Classifier: Programming Language :: Python :: 3.10
|
|
|
14
14
|
Classifier: Programming Language :: Python :: 3.11
|
|
15
15
|
Classifier: Programming Language :: Python :: 3.12
|
|
16
16
|
Requires-Dist: attrs (>=21.3.0)
|
|
17
|
-
Requires-Dist: e2b (>=2.
|
|
17
|
+
Requires-Dist: e2b (>=2.7.0,<3.0.0)
|
|
18
18
|
Requires-Dist: httpx (>=0.20.0,<1.0.0)
|
|
19
19
|
Project-URL: Bug Tracker, https://github.com/e2b-dev/code-interpreter/issues
|
|
20
20
|
Project-URL: Repository, https://github.com/e2b-dev/code-interpreter/tree/main/python
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import httpx
|
|
3
3
|
|
|
4
|
-
from typing import Optional, Dict, overload, Union, Literal
|
|
4
|
+
from typing import Optional, Dict, overload, Union, Literal, List
|
|
5
5
|
from httpx import AsyncClient
|
|
6
6
|
|
|
7
7
|
from e2b import (
|
|
@@ -273,3 +273,89 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
273
273
|
return Context.from_json(data)
|
|
274
274
|
except httpx.TimeoutException:
|
|
275
275
|
raise format_request_timeout_error()
|
|
276
|
+
|
|
277
|
+
async def remove_code_context(
|
|
278
|
+
self,
|
|
279
|
+
context: Union[Context, str],
|
|
280
|
+
) -> None:
|
|
281
|
+
"""
|
|
282
|
+
Removes a context.
|
|
283
|
+
|
|
284
|
+
:param context: Context to remove. Can be a Context object or a context ID string.
|
|
285
|
+
|
|
286
|
+
:return: None
|
|
287
|
+
"""
|
|
288
|
+
context_id = context.id if isinstance(context, Context) else context
|
|
289
|
+
|
|
290
|
+
headers: Dict[str, str] = {}
|
|
291
|
+
if self._envd_access_token:
|
|
292
|
+
headers = {"X-Access-Token": self._envd_access_token}
|
|
293
|
+
|
|
294
|
+
try:
|
|
295
|
+
response = await self._client.delete(
|
|
296
|
+
f"{self._jupyter_url}/contexts/{context_id}",
|
|
297
|
+
headers=headers,
|
|
298
|
+
timeout=self.connection_config.request_timeout,
|
|
299
|
+
)
|
|
300
|
+
|
|
301
|
+
err = await aextract_exception(response)
|
|
302
|
+
if err:
|
|
303
|
+
raise err
|
|
304
|
+
except httpx.TimeoutException:
|
|
305
|
+
raise format_request_timeout_error()
|
|
306
|
+
|
|
307
|
+
async def list_code_contexts(self) -> List[Context]:
|
|
308
|
+
"""
|
|
309
|
+
List all contexts.
|
|
310
|
+
|
|
311
|
+
:return: List of contexts.
|
|
312
|
+
"""
|
|
313
|
+
headers: Dict[str, str] = {}
|
|
314
|
+
if self._envd_access_token:
|
|
315
|
+
headers = {"X-Access-Token": self._envd_access_token}
|
|
316
|
+
|
|
317
|
+
try:
|
|
318
|
+
response = await self._client.get(
|
|
319
|
+
f"{self._jupyter_url}/contexts",
|
|
320
|
+
headers=headers,
|
|
321
|
+
timeout=self.connection_config.request_timeout,
|
|
322
|
+
)
|
|
323
|
+
|
|
324
|
+
err = await aextract_exception(response)
|
|
325
|
+
if err:
|
|
326
|
+
raise err
|
|
327
|
+
|
|
328
|
+
data = response.json()
|
|
329
|
+
return [Context.from_json(context_data) for context_data in data]
|
|
330
|
+
except httpx.TimeoutException:
|
|
331
|
+
raise format_request_timeout_error()
|
|
332
|
+
|
|
333
|
+
async def restart_code_context(
|
|
334
|
+
self,
|
|
335
|
+
context: Union[Context, str],
|
|
336
|
+
) -> None:
|
|
337
|
+
"""
|
|
338
|
+
Restart a context.
|
|
339
|
+
|
|
340
|
+
:param context: Context to restart. Can be a Context object or a context ID string.
|
|
341
|
+
|
|
342
|
+
:return: None
|
|
343
|
+
"""
|
|
344
|
+
context_id = context.id if isinstance(context, Context) else context
|
|
345
|
+
|
|
346
|
+
headers: Dict[str, str] = {}
|
|
347
|
+
if self._envd_access_token:
|
|
348
|
+
headers = {"X-Access-Token": self._envd_access_token}
|
|
349
|
+
|
|
350
|
+
try:
|
|
351
|
+
response = await self._client.post(
|
|
352
|
+
f"{self._jupyter_url}/contexts/{context_id}/restart",
|
|
353
|
+
headers=headers,
|
|
354
|
+
timeout=self.connection_config.request_timeout,
|
|
355
|
+
)
|
|
356
|
+
|
|
357
|
+
err = await aextract_exception(response)
|
|
358
|
+
if err:
|
|
359
|
+
raise err
|
|
360
|
+
except httpx.TimeoutException:
|
|
361
|
+
raise format_request_timeout_error()
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import logging
|
|
2
2
|
import httpx
|
|
3
3
|
|
|
4
|
-
from typing import Optional, Dict, overload, Literal, Union
|
|
4
|
+
from typing import Optional, Dict, overload, Literal, Union, List
|
|
5
5
|
from httpx import Client
|
|
6
6
|
from e2b import Sandbox as BaseSandbox, InvalidArgumentException
|
|
7
7
|
|
|
@@ -270,3 +270,89 @@ class Sandbox(BaseSandbox):
|
|
|
270
270
|
return Context.from_json(data)
|
|
271
271
|
except httpx.TimeoutException:
|
|
272
272
|
raise format_request_timeout_error()
|
|
273
|
+
|
|
274
|
+
def remove_code_context(
|
|
275
|
+
self,
|
|
276
|
+
context: Union[Context, str],
|
|
277
|
+
) -> None:
|
|
278
|
+
"""
|
|
279
|
+
Removes a context.
|
|
280
|
+
|
|
281
|
+
:param context: Context to remove. Can be a Context object or a context ID string.
|
|
282
|
+
|
|
283
|
+
:return: None
|
|
284
|
+
"""
|
|
285
|
+
context_id = context.id if isinstance(context, Context) else context
|
|
286
|
+
|
|
287
|
+
headers: Dict[str, str] = {}
|
|
288
|
+
if self._envd_access_token:
|
|
289
|
+
headers = {"X-Access-Token": self._envd_access_token}
|
|
290
|
+
|
|
291
|
+
try:
|
|
292
|
+
response = self._client.delete(
|
|
293
|
+
f"{self._jupyter_url}/contexts/{context_id}",
|
|
294
|
+
headers=headers,
|
|
295
|
+
timeout=self.connection_config.request_timeout,
|
|
296
|
+
)
|
|
297
|
+
|
|
298
|
+
err = extract_exception(response)
|
|
299
|
+
if err:
|
|
300
|
+
raise err
|
|
301
|
+
except httpx.TimeoutException:
|
|
302
|
+
raise format_request_timeout_error()
|
|
303
|
+
|
|
304
|
+
def list_code_contexts(self) -> List[Context]:
|
|
305
|
+
"""
|
|
306
|
+
List all contexts.
|
|
307
|
+
|
|
308
|
+
:return: List of contexts.
|
|
309
|
+
"""
|
|
310
|
+
headers: Dict[str, str] = {}
|
|
311
|
+
if self._envd_access_token:
|
|
312
|
+
headers = {"X-Access-Token": self._envd_access_token}
|
|
313
|
+
|
|
314
|
+
try:
|
|
315
|
+
response = self._client.get(
|
|
316
|
+
f"{self._jupyter_url}/contexts",
|
|
317
|
+
headers=headers,
|
|
318
|
+
timeout=self.connection_config.request_timeout,
|
|
319
|
+
)
|
|
320
|
+
|
|
321
|
+
err = extract_exception(response)
|
|
322
|
+
if err:
|
|
323
|
+
raise err
|
|
324
|
+
|
|
325
|
+
data = response.json()
|
|
326
|
+
return [Context.from_json(context_data) for context_data in data]
|
|
327
|
+
except httpx.TimeoutException:
|
|
328
|
+
raise format_request_timeout_error()
|
|
329
|
+
|
|
330
|
+
def restart_code_context(
|
|
331
|
+
self,
|
|
332
|
+
context: Union[Context, str],
|
|
333
|
+
) -> None:
|
|
334
|
+
"""
|
|
335
|
+
Restart a context.
|
|
336
|
+
|
|
337
|
+
:param context: Context to restart. Can be a Context object or a context ID string.
|
|
338
|
+
|
|
339
|
+
:return: None
|
|
340
|
+
"""
|
|
341
|
+
context_id = context.id if isinstance(context, Context) else context
|
|
342
|
+
|
|
343
|
+
headers: Dict[str, str] = {}
|
|
344
|
+
if self._envd_access_token:
|
|
345
|
+
headers = {"X-Access-Token": self._envd_access_token}
|
|
346
|
+
|
|
347
|
+
try:
|
|
348
|
+
response = self._client.post(
|
|
349
|
+
f"{self._jupyter_url}/contexts/{context_id}/restart",
|
|
350
|
+
headers=headers,
|
|
351
|
+
timeout=self.connection_config.request_timeout,
|
|
352
|
+
)
|
|
353
|
+
|
|
354
|
+
err = extract_exception(response)
|
|
355
|
+
if err:
|
|
356
|
+
raise err
|
|
357
|
+
except httpx.TimeoutException:
|
|
358
|
+
raise format_request_timeout_error()
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[tool.poetry]
|
|
2
2
|
name = "e2b-code-interpreter"
|
|
3
|
-
version = "2.
|
|
3
|
+
version = "2.4.0"
|
|
4
4
|
description = "E2B Code Interpreter - Stateful code execution"
|
|
5
5
|
authors = ["e2b <hello@e2b.dev>"]
|
|
6
6
|
license = "MIT"
|
|
@@ -14,13 +14,13 @@ python = "^3.9"
|
|
|
14
14
|
|
|
15
15
|
httpx = ">=0.20.0, <1.0.0"
|
|
16
16
|
attrs = ">=21.3.0"
|
|
17
|
-
e2b = "^2.
|
|
17
|
+
e2b = "^2.7.0"
|
|
18
18
|
|
|
19
19
|
[tool.poetry.group.dev.dependencies]
|
|
20
|
-
pytest = "^
|
|
20
|
+
pytest = "^8.2.0"
|
|
21
21
|
python-dotenv = "^1.0.0"
|
|
22
22
|
pytest-dotenv = "^0.5.2"
|
|
23
|
-
pytest-asyncio = "^0.
|
|
23
|
+
pytest-asyncio = "^0.24.0"
|
|
24
24
|
pytest-xdist = "^3.6.1"
|
|
25
25
|
pydoc-markdown = "^4.8.2"
|
|
26
26
|
matplotlib = "^3.8.0"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{e2b_code_interpreter-2.2.1 → e2b_code_interpreter-2.4.0}/e2b_code_interpreter/exceptions.py
RENAMED
|
File without changes
|
|
File without changes
|