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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: watasu-code-interpreter
3
- Version: 0.1.51
3
+ Version: 0.1.52
4
4
  Summary: Code Interpreter SDK for Watasu
5
5
  Project-URL: Repository, https://github.com/watasuio/sdk
6
6
  License-Expression: MIT OR Apache-2.0
@@ -4,7 +4,7 @@ build-backend = "hatchling.build"
4
4
 
5
5
  [project]
6
6
  name = "watasu-code-interpreter"
7
- version = "0.1.51"
7
+ version = "0.1.52"
8
8
  description = "Code Interpreter SDK for Watasu"
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.9"
@@ -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
- "env_vars": envs,
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(cls, *args: Any, **kwargs: Any) -> "AsyncSandbox":
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(sync_sandbox=await asyncio.to_thread(Sandbox.create, *args, **kwargs))
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
- beta_create = create
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):