e2b-code-interpreter 1.5.1__tar.gz → 2.0.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: 1.5.1
3
+ Version: 2.0.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 (>=1.4.0,<2.0.0)
17
+ Requires-Dist: e2b (>=2.0.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
@@ -58,7 +58,7 @@ E2B_API_KEY=e2b_***
58
58
  ```py
59
59
  from e2b_code_interpreter import Sandbox
60
60
 
61
- with Sandbox() as sandbox:
61
+ with Sandbox.create() as sandbox:
62
62
  sandbox.run_code("x = 1")
63
63
  execution = sandbox.run_code("x+=1; x")
64
64
  print(execution.text) # outputs 2
@@ -36,7 +36,7 @@ E2B_API_KEY=e2b_***
36
36
  ```py
37
37
  from e2b_code_interpreter import Sandbox
38
38
 
39
- with Sandbox() as sandbox:
39
+ with Sandbox.create() as sandbox:
40
40
  sandbox.run_code("x = 1")
41
41
  execution = sandbox.run_code("x+=1; x")
42
42
  print(execution.text) # outputs 2
@@ -6,7 +6,6 @@ from httpx import AsyncClient
6
6
 
7
7
  from e2b import (
8
8
  AsyncSandbox as BaseAsyncSandbox,
9
- ConnectionConfig,
10
9
  InvalidArgumentException,
11
10
  )
12
11
 
@@ -189,7 +188,7 @@ class AsyncSandbox(BaseAsyncSandbox):
189
188
  )
190
189
 
191
190
  timeout = None if timeout == 0 else (timeout or DEFAULT_TIMEOUT)
192
- request_timeout = request_timeout or self._connection_config.request_timeout
191
+ request_timeout = request_timeout or self.connection_config.request_timeout
193
192
  context_id = context.id if context else None
194
193
 
195
194
  try:
@@ -202,6 +201,7 @@ class AsyncSandbox(BaseAsyncSandbox):
202
201
  "language": language,
203
202
  "env_vars": envs,
204
203
  },
204
+ headers={"X-Access-Token": self._envd_access_token},
205
205
  timeout=(request_timeout, timeout, request_timeout, request_timeout),
206
206
  ) as response:
207
207
 
@@ -253,8 +253,9 @@ class AsyncSandbox(BaseAsyncSandbox):
253
253
  try:
254
254
  response = await self._client.post(
255
255
  f"{self._jupyter_url}/contexts",
256
+ headers={"X-Access-Token": self._envd_access_token},
256
257
  json=data,
257
- timeout=request_timeout or self._connection_config.request_timeout,
258
+ timeout=request_timeout or self.connection_config.request_timeout,
258
259
  )
259
260
 
260
261
  err = await aextract_exception(response)
@@ -41,13 +41,13 @@ class Sandbox(BaseSandbox):
41
41
 
42
42
  Check docs [here](https://e2b.dev/docs).
43
43
 
44
- Use the `Sandbox()` to create a new sandbox.
44
+ Use the `Sandbox.create()` to create a new sandbox.
45
45
 
46
46
  Example:
47
47
  ```python
48
48
  from e2b_code_interpreter import Sandbox
49
49
 
50
- sandbox = Sandbox()
50
+ sandbox = Sandbox.create()
51
51
  ```
52
52
  """
53
53
 
@@ -185,7 +185,7 @@ class Sandbox(BaseSandbox):
185
185
  )
186
186
 
187
187
  timeout = None if timeout == 0 else (timeout or DEFAULT_TIMEOUT)
188
- request_timeout = request_timeout or self._connection_config.request_timeout
188
+ request_timeout = request_timeout or self.connection_config.request_timeout
189
189
  context_id = context.id if context else None
190
190
 
191
191
  try:
@@ -198,6 +198,7 @@ class Sandbox(BaseSandbox):
198
198
  "language": language,
199
199
  "env_vars": envs,
200
200
  },
201
+ headers={"X-Access-Token": self._envd_access_token},
201
202
  timeout=(request_timeout, timeout, request_timeout, request_timeout),
202
203
  ) as response:
203
204
  err = extract_exception(response)
@@ -249,7 +250,8 @@ class Sandbox(BaseSandbox):
249
250
  response = self._client.post(
250
251
  f"{self._jupyter_url}/contexts",
251
252
  json=data,
252
- timeout=request_timeout or self._connection_config.request_timeout,
253
+ headers={"X-Access-Token": self._envd_access_token},
254
+ timeout=request_timeout or self.connection_config.request_timeout,
253
255
  )
254
256
 
255
257
  err = extract_exception(response)
@@ -1,6 +1,6 @@
1
1
  [tool.poetry]
2
2
  name = "e2b-code-interpreter"
3
- version = "1.5.1"
3
+ version = "2.0.0"
4
4
  description = "E2B Code Interpreter - Stateful code execution"
5
5
  authors = ["e2b <hello@e2b.dev>"]
6
6
  license = "MIT"
@@ -14,7 +14,7 @@ python = "^3.9"
14
14
 
15
15
  httpx = ">=0.20.0, <1.0.0"
16
16
  attrs = ">=21.3.0"
17
- e2b = "^1.4.0"
17
+ e2b = "^2.0.0"
18
18
 
19
19
  [tool.poetry.group.dev.dependencies]
20
20
  pytest = "^7.4.0"