scalebox-sdk 0.1.13__py3-none-any.whl → 0.1.15__py3-none-any.whl
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.
- scalebox/__init__.py +1 -1
- scalebox/api/__init__.py +3 -3
- scalebox/api/client/__init__.py +1 -1
- scalebox/code_interpreter/code_interpreter_async.py +3 -3
- scalebox/code_interpreter/code_interpreter_sync.py +2 -2
- scalebox/csx_desktop/main.py +12 -12
- scalebox/test/CODE_INTERPRETER_TESTS_READY.md +256 -256
- scalebox/test/README.md +164 -164
- scalebox/test/code_interpreter_test.py +34 -34
- scalebox/test/code_interpreter_test_sync.py +34 -34
- scalebox/test/testcomputeuse.py +243 -245
- scalebox/version.py +2 -2
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.15.dist-info}/METADATA +99 -96
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.15.dist-info}/RECORD +18 -21
- scalebox/test/test_code_interpreter_e2basync_comprehensive.py +0 -2655
- scalebox/test/test_code_interpreter_e2bsync_comprehensive.py +0 -3416
- scalebox/test/test_e2b_first.py +0 -11
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.15.dist-info}/WHEEL +0 -0
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.15.dist-info}/entry_points.txt +0 -0
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.15.dist-info}/licenses/LICENSE +0 -0
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.15.dist-info}/top_level.txt +0 -0
scalebox/__init__.py
CHANGED
scalebox/api/__init__.py
CHANGED
|
@@ -67,8 +67,8 @@ class ApiClient(AuthenticatedClient):
|
|
|
67
67
|
if config.api_key is None:
|
|
68
68
|
raise AuthenticationException(
|
|
69
69
|
"API key is required, please visit the Team tab at https://dev/dashboard to get your API key. "
|
|
70
|
-
"You can either set the environment variable `
|
|
71
|
-
'or you can pass it directly to the sandbox like Sandbox(api_key="
|
|
70
|
+
"You can either set the environment variable `SBX_API_KEY` "
|
|
71
|
+
'or you can pass it directly to the sandbox like Sandbox(api_key="sbx_...")',
|
|
72
72
|
)
|
|
73
73
|
token = config.api_key
|
|
74
74
|
|
|
@@ -76,7 +76,7 @@ class ApiClient(AuthenticatedClient):
|
|
|
76
76
|
if config.access_token is None:
|
|
77
77
|
raise AuthenticationException(
|
|
78
78
|
"Access token is required, please visit the Personal tab at https://dev/dashboard to get your access token. "
|
|
79
|
-
"You can set the environment variable `
|
|
79
|
+
"You can set the environment variable `SBX_ACCESS_TOKEN` or pass the `access_token` in options.",
|
|
80
80
|
)
|
|
81
81
|
token = config.access_token
|
|
82
82
|
|
scalebox/api/client/__init__.py
CHANGED
|
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
|
|
|
28
28
|
|
|
29
29
|
class AsyncSandbox(BaseAsyncSandbox):
|
|
30
30
|
"""
|
|
31
|
-
|
|
31
|
+
Scalebox cloud sandbox is a secure and isolated cloud environment.
|
|
32
32
|
|
|
33
33
|
The sandbox allows you to:
|
|
34
34
|
- Access Linux OS
|
|
@@ -37,13 +37,13 @@ class AsyncSandbox(BaseAsyncSandbox):
|
|
|
37
37
|
- Run isolated code
|
|
38
38
|
- Access the internet
|
|
39
39
|
|
|
40
|
-
Check docs
|
|
40
|
+
Check docs for more information.
|
|
41
41
|
|
|
42
42
|
Use the `AsyncSandbox.create()` to create a new sandbox.
|
|
43
43
|
|
|
44
44
|
Example:
|
|
45
45
|
```python
|
|
46
|
-
from
|
|
46
|
+
from scalebox.code_interpreter import AsyncSandbox
|
|
47
47
|
sandbox = await AsyncSandbox.create()
|
|
48
48
|
```
|
|
49
49
|
"""
|
|
@@ -27,7 +27,7 @@ logger = logging.getLogger(__name__)
|
|
|
27
27
|
|
|
28
28
|
class Sandbox(BaseSandbox):
|
|
29
29
|
"""
|
|
30
|
-
|
|
30
|
+
Scalebox cloud sandbox is a secure and isolated cloud environment.
|
|
31
31
|
|
|
32
32
|
The sandbox allows you to:
|
|
33
33
|
- Access Linux OS
|
|
@@ -36,7 +36,7 @@ class Sandbox(BaseSandbox):
|
|
|
36
36
|
- Run isolated code
|
|
37
37
|
- Access the internet
|
|
38
38
|
|
|
39
|
-
Check docs
|
|
39
|
+
Check docs for more information.
|
|
40
40
|
|
|
41
41
|
Use the `Sandbox()` to create a new sandbox.
|
|
42
42
|
|
scalebox/csx_desktop/main.py
CHANGED
|
@@ -228,10 +228,10 @@ class Sandbox(SandboxBase):
|
|
|
228
228
|
# :param timeout: Timeout for the sandbox in **seconds**, default to 300 seconds. Maximum time a sandbox can be kept alive is 24 hours (86_400 seconds) for Pro users and 1 hour (3_600 seconds) for Hobby users
|
|
229
229
|
# :param metadata: Custom metadata for the sandbox
|
|
230
230
|
# :param envs: Custom environment variables for the sandbox
|
|
231
|
-
# :param api_key:
|
|
232
|
-
# :param domain:
|
|
233
|
-
# :param debug: If True, the sandbox will be created in debug mode, defaults to `
|
|
234
|
-
# :param sandbox_id: Sandbox ID to connect to, defaults to `
|
|
231
|
+
# :param api_key: API Key to use for authentication, defaults to `SBX_API_KEY` environment variable
|
|
232
|
+
# :param domain: Domain to use for authentication, defaults to `SBX_DOMAIN` environment variable
|
|
233
|
+
# :param debug: If True, the sandbox will be created in debug mode, defaults to `SBX_DEBUG` environment variable
|
|
234
|
+
# :param sandbox_id: Sandbox ID to connect to, defaults to `SBX_SANDBOX_ID` environment variable
|
|
235
235
|
# :param request_timeout: Timeout for the request in **seconds**
|
|
236
236
|
# :param proxy: Proxy to use for the request and for the requests made to the returned sandbox
|
|
237
237
|
#
|
|
@@ -307,16 +307,16 @@ class Sandbox(SandboxBase):
|
|
|
307
307
|
proxy: Optional[ProxyTypes] = None,
|
|
308
308
|
) -> "Sandbox":
|
|
309
309
|
"""
|
|
310
|
-
|
|
310
|
+
Synchronously create or connect to a desktop sandbox.
|
|
311
311
|
|
|
312
|
-
|
|
312
|
+
Parameters have the same meaning as the base class. Xvfb + xfce4 will be automatically started on first creation.
|
|
313
313
|
"""
|
|
314
314
|
display = display or ":0"
|
|
315
315
|
if envs is None:
|
|
316
316
|
envs = {}
|
|
317
317
|
envs["DISPLAY"] = display
|
|
318
318
|
|
|
319
|
-
# 1.
|
|
319
|
+
# 1. Let the parent class factory actually create / reuse
|
|
320
320
|
base = SandboxBase.create(
|
|
321
321
|
template=template or cls.default_template,
|
|
322
322
|
timeout=timeout,
|
|
@@ -330,27 +330,27 @@ class Sandbox(SandboxBase):
|
|
|
330
330
|
proxy=proxy,
|
|
331
331
|
)
|
|
332
332
|
|
|
333
|
-
# 2.
|
|
333
|
+
# 2. Dynamically upgrade type to Sandbox
|
|
334
334
|
base.__class__ = cls
|
|
335
335
|
base._display = display
|
|
336
336
|
base._last_xfce4_pid = None
|
|
337
337
|
|
|
338
|
-
# 3.
|
|
338
|
+
# 3. Only start desktop on first creation
|
|
339
339
|
if not sandbox_id:
|
|
340
340
|
base._start_desktop(resolution, dpi)
|
|
341
341
|
else:
|
|
342
|
-
#
|
|
342
|
+
# Connect to existing sandbox, only initialize VNC
|
|
343
343
|
base.__vnc_server = _VNCServer(base)
|
|
344
344
|
|
|
345
345
|
return base
|
|
346
346
|
|
|
347
|
-
# ======================
|
|
347
|
+
# ====================== Subclass Private Methods ======================
|
|
348
348
|
def _start_desktop(
|
|
349
349
|
self,
|
|
350
350
|
resolution: Optional[Tuple[int, int]] = None,
|
|
351
351
|
dpi: Optional[int] = None,
|
|
352
352
|
) -> None:
|
|
353
|
-
"""
|
|
353
|
+
"""Start Xvfb and wait for success, then start xfce4 + VNC."""
|
|
354
354
|
width, height = resolution or (1024, 768)
|
|
355
355
|
self.commands.run(
|
|
356
356
|
f"Xvfb {self._display} -ac -screen 0 {width}x{height}x24 "
|