watasu-code-interpreter 0.1.51__tar.gz → 0.1.52__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.51 → watasu_code_interpreter-0.1.52}/PKG-INFO +1 -1
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/pyproject.toml +1 -1
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/__init__.py +2 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/main.py +66 -4
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/models.py +5 -1
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/.gitignore +0 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/README.md +0 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/charts.py +0 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/code_interpreter_async.py +0 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/code_interpreter_sync.py +0 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/constants.py +0 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/exceptions.py +0 -0
- {watasu_code_interpreter-0.1.51 → watasu_code_interpreter-0.1.52}/src/watasu_code_interpreter/py.typed +0 -0
|
@@ -14,6 +14,7 @@ from .models import (
|
|
|
14
14
|
OutputHandler,
|
|
15
15
|
OutputMessage,
|
|
16
16
|
Result,
|
|
17
|
+
RunCodeLanguage,
|
|
17
18
|
)
|
|
18
19
|
|
|
19
20
|
_code_interpreter_all = [
|
|
@@ -32,6 +33,7 @@ _code_interpreter_all = [
|
|
|
32
33
|
"OutputHandler",
|
|
33
34
|
"OutputMessage",
|
|
34
35
|
"Result",
|
|
36
|
+
"RunCodeLanguage",
|
|
35
37
|
"Sandbox",
|
|
36
38
|
]
|
|
37
39
|
|
|
@@ -46,7 +46,7 @@ class Sandbox(BaseSandbox):
|
|
|
46
46
|
"code": code,
|
|
47
47
|
"language": language,
|
|
48
48
|
"context_id": _context_id(context),
|
|
49
|
-
"
|
|
49
|
+
"envs": envs,
|
|
50
50
|
"timeout_seconds": timeout,
|
|
51
51
|
}
|
|
52
52
|
)
|
|
@@ -120,12 +120,74 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
120
120
|
default_template = Sandbox.default_template
|
|
121
121
|
|
|
122
122
|
@classmethod
|
|
123
|
-
async def create(
|
|
123
|
+
async def create(
|
|
124
|
+
cls,
|
|
125
|
+
template: Optional[str] = None,
|
|
126
|
+
timeout: Optional[int] = None,
|
|
127
|
+
metadata: Optional[Dict[str, str]] = None,
|
|
128
|
+
envs: Optional[Dict[str, str]] = None,
|
|
129
|
+
secure: bool = True,
|
|
130
|
+
allow_internet_access: bool = True,
|
|
131
|
+
mcp: Optional[Dict[str, Any]] = None,
|
|
132
|
+
network=None,
|
|
133
|
+
volume_mounts: Optional[Dict[str, Any]] = None,
|
|
134
|
+
lifecycle=None,
|
|
135
|
+
**opts: ApiParams,
|
|
136
|
+
) -> "AsyncSandbox":
|
|
124
137
|
"""Create a code-interpreter sandbox and return async helpers."""
|
|
125
138
|
|
|
126
|
-
return cls(
|
|
139
|
+
return cls(
|
|
140
|
+
sync_sandbox=await asyncio.to_thread(
|
|
141
|
+
Sandbox.create,
|
|
142
|
+
template=template,
|
|
143
|
+
timeout=timeout,
|
|
144
|
+
metadata=metadata,
|
|
145
|
+
envs=envs,
|
|
146
|
+
secure=secure,
|
|
147
|
+
allow_internet_access=allow_internet_access,
|
|
148
|
+
mcp=mcp,
|
|
149
|
+
network=network,
|
|
150
|
+
volume_mounts=volume_mounts,
|
|
151
|
+
lifecycle=lifecycle,
|
|
152
|
+
**opts,
|
|
153
|
+
)
|
|
154
|
+
)
|
|
155
|
+
|
|
156
|
+
@classmethod
|
|
157
|
+
async def beta_create(
|
|
158
|
+
cls,
|
|
159
|
+
template: Optional[str] = None,
|
|
160
|
+
timeout: Optional[int] = None,
|
|
161
|
+
auto_pause: bool = False,
|
|
162
|
+
metadata: Optional[Dict[str, str]] = None,
|
|
163
|
+
envs: Optional[Dict[str, str]] = None,
|
|
164
|
+
secure: bool = True,
|
|
165
|
+
allow_internet_access: bool = True,
|
|
166
|
+
mcp: Optional[Dict[str, Any]] = None,
|
|
167
|
+
network=None,
|
|
168
|
+
volume_mounts: Optional[Dict[str, Any]] = None,
|
|
169
|
+
lifecycle=None,
|
|
170
|
+
**opts: ApiParams,
|
|
171
|
+
) -> "AsyncSandbox":
|
|
172
|
+
"""Create a code-interpreter sandbox with beta lifecycle options."""
|
|
127
173
|
|
|
128
|
-
|
|
174
|
+
return cls(
|
|
175
|
+
sync_sandbox=await asyncio.to_thread(
|
|
176
|
+
Sandbox.beta_create,
|
|
177
|
+
template=template,
|
|
178
|
+
timeout=timeout,
|
|
179
|
+
auto_pause=auto_pause,
|
|
180
|
+
metadata=metadata,
|
|
181
|
+
envs=envs,
|
|
182
|
+
secure=secure,
|
|
183
|
+
allow_internet_access=allow_internet_access,
|
|
184
|
+
mcp=mcp,
|
|
185
|
+
network=network,
|
|
186
|
+
volume_mounts=volume_mounts,
|
|
187
|
+
lifecycle=lifecycle,
|
|
188
|
+
**opts,
|
|
189
|
+
)
|
|
190
|
+
)
|
|
129
191
|
|
|
130
192
|
async def _connect_instance(
|
|
131
193
|
self, timeout: Optional[int] = None, **opts: ApiParams
|
|
@@ -3,12 +3,16 @@ from __future__ import annotations
|
|
|
3
3
|
import json as jsonlib
|
|
4
4
|
import time
|
|
5
5
|
from dataclasses import dataclass, field
|
|
6
|
-
from typing import Any, Callable, Dict, List, Optional, TypeVar
|
|
6
|
+
from typing import Any, Callable, Dict, List, Literal, Optional, TypeVar, Union
|
|
7
7
|
|
|
8
8
|
from .charts import ChartTypes, _deserialize_chart
|
|
9
9
|
|
|
10
10
|
T = TypeVar("T")
|
|
11
11
|
OutputHandler = Callable[[T], Any]
|
|
12
|
+
RunCodeLanguage = Union[
|
|
13
|
+
Literal["python", "javascript", "typescript", "r", "java", "bash"],
|
|
14
|
+
str,
|
|
15
|
+
]
|
|
12
16
|
|
|
13
17
|
|
|
14
18
|
class MIMEType(str):
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|