watasu-code-interpreter 0.1.47__tar.gz → 0.1.48__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.
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/PKG-INFO +1 -1
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/pyproject.toml +1 -1
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/main.py +18 -30
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/.gitignore +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/README.md +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/__init__.py +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/charts.py +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/code_interpreter_async.py +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/code_interpreter_sync.py +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/constants.py +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/exceptions.py +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/models.py +0 -0
- {watasu_code_interpreter-0.1.47 → watasu_code_interpreter-0.1.48}/src/watasu_code_interpreter/py.typed +0 -0
|
@@ -25,13 +25,13 @@ class Sandbox(BaseSandbox):
|
|
|
25
25
|
self,
|
|
26
26
|
code: str,
|
|
27
27
|
language: Optional[str] = None,
|
|
28
|
-
context: Optional[
|
|
29
|
-
on_stdout: Optional[Callable[[OutputMessage],
|
|
30
|
-
on_stderr: Optional[Callable[[OutputMessage],
|
|
31
|
-
on_result: Optional[Callable[[Result],
|
|
32
|
-
on_error: Optional[Callable[[ExecutionError],
|
|
28
|
+
context: Optional[Context] = None,
|
|
29
|
+
on_stdout: Optional[Callable[[OutputMessage], Any]] = None,
|
|
30
|
+
on_stderr: Optional[Callable[[OutputMessage], Any]] = None,
|
|
31
|
+
on_result: Optional[Callable[[Result], Any]] = None,
|
|
32
|
+
on_error: Optional[Callable[[ExecutionError], Any]] = None,
|
|
33
33
|
envs: Optional[Dict[str, str]] = None,
|
|
34
|
-
timeout: Optional[
|
|
34
|
+
timeout: Optional[float] = None,
|
|
35
35
|
request_timeout: Optional[float] = None,
|
|
36
36
|
) -> Execution:
|
|
37
37
|
"""Run Python code in the sandbox and return structured execution output."""
|
|
@@ -78,21 +78,18 @@ class Sandbox(BaseSandbox):
|
|
|
78
78
|
def remove_code_context(
|
|
79
79
|
self,
|
|
80
80
|
context: Union[Context, str],
|
|
81
|
-
request_timeout: Optional[float] = None,
|
|
82
81
|
) -> None:
|
|
83
82
|
"""Remove a persistent code context."""
|
|
84
83
|
|
|
85
84
|
self._require_data_plane().delete_json(
|
|
86
85
|
f"/runtime/v1/code/contexts/{_context_path_id(context)}",
|
|
87
|
-
request_timeout=request_timeout,
|
|
88
86
|
)
|
|
89
87
|
|
|
90
|
-
def list_code_contexts(self
|
|
88
|
+
def list_code_contexts(self) -> List[Context]:
|
|
91
89
|
"""List persistent code contexts."""
|
|
92
90
|
|
|
93
91
|
response = self._require_data_plane().get_json(
|
|
94
92
|
"/runtime/v1/code/contexts",
|
|
95
|
-
request_timeout=request_timeout,
|
|
96
93
|
)
|
|
97
94
|
contexts = response if isinstance(response, list) else response.get("contexts", [])
|
|
98
95
|
return [context_from_api(item) for item in contexts]
|
|
@@ -100,14 +97,12 @@ class Sandbox(BaseSandbox):
|
|
|
100
97
|
def restart_code_context(
|
|
101
98
|
self,
|
|
102
99
|
context: Union[Context, str],
|
|
103
|
-
request_timeout: Optional[float] = None,
|
|
104
100
|
) -> None:
|
|
105
101
|
"""Restart a persistent code context."""
|
|
106
102
|
|
|
107
103
|
self._require_data_plane().post_json(
|
|
108
104
|
f"/runtime/v1/code/contexts/{_context_path_id(context)}/restart",
|
|
109
105
|
json={},
|
|
110
|
-
request_timeout=request_timeout,
|
|
111
106
|
)
|
|
112
107
|
|
|
113
108
|
|
|
@@ -151,13 +146,13 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
151
146
|
self,
|
|
152
147
|
code: str,
|
|
153
148
|
language: Optional[str] = None,
|
|
154
|
-
context: Optional[
|
|
155
|
-
on_stdout: Optional[Callable[[OutputMessage],
|
|
156
|
-
on_stderr: Optional[Callable[[OutputMessage],
|
|
157
|
-
on_result: Optional[Callable[[Result],
|
|
158
|
-
on_error: Optional[Callable[[ExecutionError],
|
|
149
|
+
context: Optional[Context] = None,
|
|
150
|
+
on_stdout: Optional[Callable[[OutputMessage], Any]] = None,
|
|
151
|
+
on_stderr: Optional[Callable[[OutputMessage], Any]] = None,
|
|
152
|
+
on_result: Optional[Callable[[Result], Any]] = None,
|
|
153
|
+
on_error: Optional[Callable[[ExecutionError], Any]] = None,
|
|
159
154
|
envs: Optional[Dict[str, str]] = None,
|
|
160
|
-
timeout: Optional[
|
|
155
|
+
timeout: Optional[float] = None,
|
|
161
156
|
request_timeout: Optional[float] = None,
|
|
162
157
|
) -> Execution:
|
|
163
158
|
"""Run Python code in the sandbox and return structured execution output."""
|
|
@@ -195,46 +190,39 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
195
190
|
async def remove_code_context(
|
|
196
191
|
self,
|
|
197
192
|
context: Union[Context, str],
|
|
198
|
-
request_timeout: Optional[float] = None,
|
|
199
193
|
) -> None:
|
|
200
194
|
"""Remove a persistent code context."""
|
|
201
195
|
|
|
202
196
|
await asyncio.to_thread(
|
|
203
197
|
self._sync.remove_code_context,
|
|
204
198
|
context,
|
|
205
|
-
request_timeout=request_timeout,
|
|
206
199
|
)
|
|
207
200
|
|
|
208
|
-
async def list_code_contexts(
|
|
209
|
-
self, request_timeout: Optional[float] = None
|
|
210
|
-
) -> List[Context]:
|
|
201
|
+
async def list_code_contexts(self) -> List[Context]:
|
|
211
202
|
"""List persistent code contexts."""
|
|
212
203
|
|
|
213
204
|
return await asyncio.to_thread(
|
|
214
205
|
self._sync.list_code_contexts,
|
|
215
|
-
request_timeout=request_timeout,
|
|
216
206
|
)
|
|
217
207
|
|
|
218
208
|
async def restart_code_context(
|
|
219
209
|
self,
|
|
220
210
|
context: Union[Context, str],
|
|
221
|
-
request_timeout: Optional[float] = None,
|
|
222
211
|
) -> None:
|
|
223
212
|
"""Restart a persistent code context."""
|
|
224
213
|
|
|
225
214
|
await asyncio.to_thread(
|
|
226
215
|
self._sync.restart_code_context,
|
|
227
216
|
context,
|
|
228
|
-
request_timeout=request_timeout,
|
|
229
217
|
)
|
|
230
218
|
|
|
231
219
|
|
|
232
220
|
def _emit_callbacks(
|
|
233
221
|
execution: Execution,
|
|
234
|
-
on_stdout: Optional[Callable[[OutputMessage],
|
|
235
|
-
on_stderr: Optional[Callable[[OutputMessage],
|
|
236
|
-
on_result: Optional[Callable[[Result],
|
|
237
|
-
on_error: Optional[Callable[[ExecutionError],
|
|
222
|
+
on_stdout: Optional[Callable[[OutputMessage], Any]],
|
|
223
|
+
on_stderr: Optional[Callable[[OutputMessage], Any]],
|
|
224
|
+
on_result: Optional[Callable[[Result], Any]],
|
|
225
|
+
on_error: Optional[Callable[[ExecutionError], Any]],
|
|
238
226
|
) -> None:
|
|
239
227
|
for message in execution.logs.stdout:
|
|
240
228
|
if on_stdout is not None:
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|