scalebox-sdk 0.1.13__py3-none-any.whl → 0.1.14__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 +4 -4
- 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.14.dist-info}/METADATA +2 -2
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.14.dist-info}/RECORD +16 -19
- 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.14.dist-info}/WHEEL +0 -0
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.14.dist-info}/entry_points.txt +0 -0
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.14.dist-info}/licenses/LICENSE +0 -0
- {scalebox_sdk-0.1.13.dist-info → scalebox_sdk-0.1.14.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
|
#
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import time
|
|
3
|
-
|
|
4
|
-
from scalebox.code_interpreter import AsyncSandbox
|
|
5
|
-
|
|
6
|
-
# from scalebox.sandbox_async.main import AsyncSandbox
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
async def pty_output_handler(output):
|
|
10
|
-
"""处理 PTY 输出的回调函数"""
|
|
11
|
-
print(f"输出: {output}")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
async def main():
|
|
15
|
-
sandbox = AsyncSandbox.create()
|
|
16
|
-
proc = await sandbox.run_code(
|
|
17
|
-
"""
|
|
18
|
-
import time
|
|
19
|
-
for i in range(3):
|
|
20
|
-
print("Hello
|
|
21
|
-
time.sleep(50)
|
|
22
|
-
""",
|
|
23
|
-
language="python3",
|
|
24
|
-
request_timeout=3600,
|
|
25
|
-
on_stdout=pty_output_handler,
|
|
26
|
-
on_stderr=pty_output_handler,
|
|
27
|
-
on_result=pty_output_handler,
|
|
28
|
-
)
|
|
29
|
-
print(proc)
|
|
30
|
-
time.sleep(10)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if __name__ == "__main__":
|
|
34
|
-
asyncio.run(main())
|
|
1
|
+
import asyncio
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
from scalebox.code_interpreter import AsyncSandbox
|
|
5
|
+
|
|
6
|
+
# from scalebox.sandbox_async.main import AsyncSandbox
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
async def pty_output_handler(output):
|
|
10
|
+
"""处理 PTY 输出的回调函数"""
|
|
11
|
+
print(f"输出: {output}")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
async def main():
|
|
15
|
+
sandbox = AsyncSandbox.create()
|
|
16
|
+
proc = await sandbox.run_code(
|
|
17
|
+
"""
|
|
18
|
+
import time
|
|
19
|
+
for i in range(3):
|
|
20
|
+
print("Hello Scalebox", i)
|
|
21
|
+
time.sleep(50)
|
|
22
|
+
""",
|
|
23
|
+
language="python3",
|
|
24
|
+
request_timeout=3600,
|
|
25
|
+
on_stdout=pty_output_handler,
|
|
26
|
+
on_stderr=pty_output_handler,
|
|
27
|
+
on_result=pty_output_handler,
|
|
28
|
+
)
|
|
29
|
+
print(proc)
|
|
30
|
+
time.sleep(10)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
asyncio.run(main())
|
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import asyncio
|
|
2
|
-
import time
|
|
3
|
-
|
|
4
|
-
from code_interpreter import Sandbox
|
|
5
|
-
|
|
6
|
-
# from scalebox.sandbox_async.main import AsyncSandbox
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
def pty_output_handler(output):
|
|
10
|
-
"""处理 PTY 输出的回调函数"""
|
|
11
|
-
print(f"输出: {output}")
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def main():
|
|
15
|
-
sandbox = Sandbox()
|
|
16
|
-
proc = sandbox.run_code(
|
|
17
|
-
"""
|
|
18
|
-
import time
|
|
19
|
-
for i in range(3):
|
|
20
|
-
print("Hello
|
|
21
|
-
time.sleep(50)
|
|
22
|
-
""",
|
|
23
|
-
language="python3",
|
|
24
|
-
request_timeout=3600,
|
|
25
|
-
on_stdout=pty_output_handler,
|
|
26
|
-
on_stderr=pty_output_handler,
|
|
27
|
-
on_result=pty_output_handler,
|
|
28
|
-
)
|
|
29
|
-
print(proc)
|
|
30
|
-
time.sleep(10)
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
if __name__ == "__main__":
|
|
34
|
-
main()
|
|
1
|
+
import asyncio
|
|
2
|
+
import time
|
|
3
|
+
|
|
4
|
+
from code_interpreter import Sandbox
|
|
5
|
+
|
|
6
|
+
# from scalebox.sandbox_async.main import AsyncSandbox
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
def pty_output_handler(output):
|
|
10
|
+
"""处理 PTY 输出的回调函数"""
|
|
11
|
+
print(f"输出: {output}")
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def main():
|
|
15
|
+
sandbox = Sandbox()
|
|
16
|
+
proc = sandbox.run_code(
|
|
17
|
+
"""
|
|
18
|
+
import time
|
|
19
|
+
for i in range(3):
|
|
20
|
+
print("Hello Scalebox", i)
|
|
21
|
+
time.sleep(50)
|
|
22
|
+
""",
|
|
23
|
+
language="python3",
|
|
24
|
+
request_timeout=3600,
|
|
25
|
+
on_stdout=pty_output_handler,
|
|
26
|
+
on_stderr=pty_output_handler,
|
|
27
|
+
on_result=pty_output_handler,
|
|
28
|
+
)
|
|
29
|
+
print(proc)
|
|
30
|
+
time.sleep(10)
|
|
31
|
+
|
|
32
|
+
|
|
33
|
+
if __name__ == "__main__":
|
|
34
|
+
main()
|