e2b-code-interpreter 2.6.2__tar.gz → 2.7.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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: e2b-code-interpreter
3
- Version: 2.6.2
3
+ Version: 2.7.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.11
14
14
  Classifier: Programming Language :: Python :: 3.12
15
15
  Classifier: Programming Language :: Python :: 3.13
16
16
  Requires-Dist: attrs (>=21.3.0)
17
- Requires-Dist: e2b (>=2.20.3,<3.0.0)
17
+ Requires-Dist: e2b (>=2.23.1,<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
@@ -8,6 +8,7 @@ from e2b import (
8
8
  AsyncSandbox as BaseAsyncSandbox,
9
9
  InvalidArgumentException,
10
10
  )
11
+ from e2b.api.client_async import get_transport
11
12
 
12
13
  from e2b_code_interpreter.constants import (
13
14
  DEFAULT_TEMPLATE,
@@ -63,7 +64,24 @@ class AsyncSandbox(BaseAsyncSandbox):
63
64
 
64
65
  @property
65
66
  def _client(self) -> AsyncClient:
66
- return AsyncClient(transport=self._transport)
67
+ # TODO: Remove later
68
+ # Use a dedicated HTTP/1.1 transport for Jupyter requests.
69
+ #
70
+ # The base SDK's shared transport now defaults to http2=True. With
71
+ # HTTP/2, multiple requests are multiplexed over a single TCP
72
+ # connection, so when a client cancels a request (e.g. the caller
73
+ # disconnects from the streaming `/execute` endpoint) the server
74
+ # may not detect the disconnect: only the HTTP/2 stream is
75
+ # cancelled, the underlying TCP connection stays open.
76
+ #
77
+ # Forcing HTTP/1.1 here keeps the 1:1 mapping between TCP
78
+ # connection and request, so client disconnects propagate to the
79
+ # server as a TCP close and long-running executions can be
80
+ # cancelled reliably. The helper also caches the transport
81
+ # per-event-loop for async.
82
+ return AsyncClient(
83
+ transport=get_transport(self.connection_config, http2=False),
84
+ )
67
85
 
68
86
  @overload
69
87
  async def run_code(
@@ -4,6 +4,7 @@ import httpx
4
4
  from typing import Optional, Dict, overload, Union, List
5
5
  from httpx import Client
6
6
  from e2b import Sandbox as BaseSandbox, InvalidArgumentException
7
+ from e2b.api.client_sync import get_transport
7
8
 
8
9
  from e2b_code_interpreter.constants import (
9
10
  DEFAULT_TEMPLATE,
@@ -60,7 +61,21 @@ class Sandbox(BaseSandbox):
60
61
 
61
62
  @property
62
63
  def _client(self) -> Client:
63
- return Client(transport=self._transport)
64
+ # TODO: Remove later
65
+ # Use a dedicated HTTP/1.1 transport for Jupyter requests.
66
+ #
67
+ # The base SDK's shared transport now defaults to http2=True. With
68
+ # HTTP/2, multiple requests are multiplexed over a single TCP
69
+ # connection, so when a client cancels a request (e.g. the caller
70
+ # disconnects from the streaming `/execute` endpoint) the server
71
+ # may not detect the disconnect: only the HTTP/2 stream is
72
+ # cancelled, the underlying TCP connection stays open.
73
+ #
74
+ # Forcing HTTP/1.1 here keeps the 1:1 mapping between TCP
75
+ # connection and request, so client disconnects propagate to the
76
+ # server as a TCP close and long-running executions can be
77
+ # cancelled reliably.
78
+ return Client(transport=get_transport(self.connection_config, http2=False))
64
79
 
65
80
  @overload
66
81
  def run_code(
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "e2b-code-interpreter"
3
- version = "2.6.2"
3
+ version = "2.7.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.10"
14
14
 
15
15
  httpx = ">=0.20.0, <1.0.0"
16
16
  attrs = ">=21.3.0"
17
- e2b = "^2.20.3"
17
+ e2b = "^2.23.1"
18
18
 
19
19
  [tool.poetry.group.dev.dependencies]
20
- pytest = "^8.2.0"
20
+ pytest = "^9.0.3"
21
21
  python-dotenv = "^1.0.0"
22
22
  pytest-dotenv = "^0.5.2"
23
- pytest-asyncio = "^0.24.0"
23
+ pytest-asyncio = "^1.3.0"
24
24
  pytest-xdist = "^3.6.1"
25
25
  matplotlib = "^3.8.0"
26
26
  ruff = "^0.11.12"