scalebox-sdk 0.1.24__py3-none-any.whl → 1.0.1__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 +2 -2
- scalebox/api/__init__.py +130 -128
- scalebox/api/client/__init__.py +8 -8
- scalebox/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +2 -2
- scalebox/api/client/api/sandboxes/post_sandboxes.py +2 -2
- scalebox/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +193 -0
- scalebox/api/client/client.py +288 -288
- scalebox/api/client/models/connect_sandbox.py +59 -0
- scalebox/api/client/models/error.py +2 -2
- scalebox/api/client/models/listed_sandbox.py +19 -1
- scalebox/api/client/models/new_sandbox.py +10 -0
- scalebox/api/client/models/sandbox.py +138 -125
- scalebox/api/client/models/sandbox_detail.py +24 -0
- scalebox/api/client/types.py +46 -46
- scalebox/cli.py +125 -125
- scalebox/client/aclient.py +57 -57
- scalebox/client/client.py +102 -102
- scalebox/code_interpreter/__init__.py +12 -12
- scalebox/code_interpreter/charts.py +230 -230
- scalebox/code_interpreter/constants.py +3 -3
- scalebox/code_interpreter/exceptions.py +13 -13
- scalebox/code_interpreter/models.py +485 -485
- scalebox/connection_config.py +34 -1
- scalebox/csx_connect/__init__.py +1 -1
- scalebox/csx_connect/client.py +485 -485
- scalebox/csx_desktop/main.py +651 -651
- scalebox/exceptions.py +83 -83
- scalebox/generated/api.py +61 -61
- scalebox/generated/api_pb2.py +203 -203
- scalebox/generated/api_pb2.pyi +956 -956
- scalebox/generated/api_pb2_connect.py +1407 -1407
- scalebox/generated/rpc.py +50 -50
- scalebox/sandbox/main.py +146 -139
- scalebox/sandbox/sandbox_api.py +105 -91
- scalebox/sandbox/signature.py +40 -40
- scalebox/sandbox/utils.py +34 -34
- scalebox/sandbox_async/commands/command.py +307 -307
- scalebox/sandbox_async/commands/command_handle.py +187 -187
- scalebox/sandbox_async/commands/pty.py +187 -187
- scalebox/sandbox_async/filesystem/filesystem.py +557 -557
- scalebox/sandbox_async/filesystem/watch_handle.py +61 -61
- scalebox/sandbox_async/main.py +228 -46
- scalebox/sandbox_async/sandbox_api.py +124 -3
- scalebox/sandbox_async/utils.py +7 -7
- scalebox/sandbox_sync/__init__.py +2 -2
- scalebox/sandbox_sync/commands/command.py +300 -300
- scalebox/sandbox_sync/commands/command_handle.py +150 -150
- scalebox/sandbox_sync/commands/pty.py +181 -181
- scalebox/sandbox_sync/filesystem/filesystem.py +3 -3
- scalebox/sandbox_sync/filesystem/watch_handle.py +66 -66
- scalebox/sandbox_sync/main.py +208 -133
- scalebox/sandbox_sync/sandbox_api.py +119 -3
- scalebox/test/CODE_INTERPRETER_TESTS_READY.md +323 -323
- scalebox/test/README.md +329 -329
- scalebox/test/bedrock_openai_adapter.py +67 -0
- scalebox/test/code_interpreter_test.py +34 -34
- scalebox/test/code_interpreter_test_sync.py +34 -34
- scalebox/test/run_stress_code_interpreter_sync.py +166 -0
- scalebox/test/simple_upload_example.py +123 -0
- scalebox/test/stabitiy_test.py +310 -0
- scalebox/test/test_browser_use.py +25 -0
- scalebox/test/test_browser_use_scalebox.py +61 -0
- scalebox/test/test_code_interpreter_sync_comprehensive.py +115 -65
- scalebox/test/test_connect_pause_async.py +277 -0
- scalebox/test/test_connect_pause_sync.py +267 -0
- scalebox/test/test_desktop_sandbox_sf.py +117 -0
- scalebox/test/test_download_url.py +49 -0
- scalebox/test/test_sandbox_async_comprehensive.py +1 -1
- scalebox/test/test_sandbox_object_storage_example.py +146 -0
- scalebox/test/test_sandbox_object_storage_example_async.py +156 -0
- scalebox/test/test_sf.py +137 -0
- scalebox/test/test_watch_dir_async.py +56 -0
- scalebox/test/testacreate.py +1 -1
- scalebox/test/testagetinfo.py +1 -1
- scalebox/test/testcomputeuse.py +243 -243
- scalebox/test/testsandbox_api.py +13 -0
- scalebox/test/testsandbox_sync.py +1 -1
- scalebox/test/upload_100mb_example.py +355 -0
- scalebox/utils/httpcoreclient.py +297 -297
- scalebox/utils/httpxclient.py +403 -403
- scalebox/version.py +2 -2
- {scalebox_sdk-0.1.24.dist-info → scalebox_sdk-1.0.1.dist-info}/METADATA +1 -1
- {scalebox_sdk-0.1.24.dist-info → scalebox_sdk-1.0.1.dist-info}/RECORD +87 -69
- {scalebox_sdk-0.1.24.dist-info → scalebox_sdk-1.0.1.dist-info}/WHEEL +1 -1
- {scalebox_sdk-0.1.24.dist-info → scalebox_sdk-1.0.1.dist-info}/entry_points.txt +0 -0
- {scalebox_sdk-0.1.24.dist-info → scalebox_sdk-1.0.1.dist-info}/licenses/LICENSE +0 -0
- {scalebox_sdk-0.1.24.dist-info → scalebox_sdk-1.0.1.dist-info}/top_level.txt +0 -0
scalebox/sandbox/signature.py
CHANGED
|
@@ -1,40 +1,40 @@
|
|
|
1
|
-
import base64
|
|
2
|
-
import hashlib
|
|
3
|
-
import time
|
|
4
|
-
from typing import Literal, Optional, TypedDict
|
|
5
|
-
|
|
6
|
-
Operation = Literal["read", "write"]
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Signature(TypedDict):
|
|
10
|
-
signature: str
|
|
11
|
-
expiration: Optional[int] # Unix timestamp or None
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
def get_signature(
|
|
15
|
-
path: str,
|
|
16
|
-
operation: Operation,
|
|
17
|
-
user: str,
|
|
18
|
-
envd_access_token: Optional[str],
|
|
19
|
-
expiration_in_seconds: Optional[int] = None,
|
|
20
|
-
) -> Signature:
|
|
21
|
-
"""
|
|
22
|
-
Generate a v1 signature for sandbox file URLs.
|
|
23
|
-
"""
|
|
24
|
-
if not envd_access_token:
|
|
25
|
-
raise ValueError("Access token is not set and signature cannot be generated!")
|
|
26
|
-
|
|
27
|
-
expiration = (
|
|
28
|
-
int(time.time()) + expiration_in_seconds if expiration_in_seconds else None
|
|
29
|
-
)
|
|
30
|
-
|
|
31
|
-
raw = (
|
|
32
|
-
f"{path}:{operation}:{user}:{envd_access_token}"
|
|
33
|
-
if expiration is None
|
|
34
|
-
else f"{path}:{operation}:{user}:{envd_access_token}:{expiration}"
|
|
35
|
-
)
|
|
36
|
-
|
|
37
|
-
digest = hashlib.sha256(raw.encode("utf-8")).digest()
|
|
38
|
-
encoded = base64.b64encode(digest).rstrip(b"=").decode("ascii")
|
|
39
|
-
|
|
40
|
-
return {"signature": f"v1_{encoded}", "expiration": expiration}
|
|
1
|
+
import base64
|
|
2
|
+
import hashlib
|
|
3
|
+
import time
|
|
4
|
+
from typing import Literal, Optional, TypedDict
|
|
5
|
+
|
|
6
|
+
Operation = Literal["read", "write"]
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
class Signature(TypedDict):
|
|
10
|
+
signature: str
|
|
11
|
+
expiration: Optional[int] # Unix timestamp or None
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
def get_signature(
|
|
15
|
+
path: str,
|
|
16
|
+
operation: Operation,
|
|
17
|
+
user: str,
|
|
18
|
+
envd_access_token: Optional[str],
|
|
19
|
+
expiration_in_seconds: Optional[int] = None,
|
|
20
|
+
) -> Signature:
|
|
21
|
+
"""
|
|
22
|
+
Generate a v1 signature for sandbox file URLs.
|
|
23
|
+
"""
|
|
24
|
+
if not envd_access_token:
|
|
25
|
+
raise ValueError("Access token is not set and signature cannot be generated!")
|
|
26
|
+
|
|
27
|
+
expiration = (
|
|
28
|
+
int(time.time()) + expiration_in_seconds if expiration_in_seconds else None
|
|
29
|
+
)
|
|
30
|
+
|
|
31
|
+
raw = (
|
|
32
|
+
f"{path}:{operation}:{user}:{envd_access_token}"
|
|
33
|
+
if expiration is None
|
|
34
|
+
else f"{path}:{operation}:{user}:{envd_access_token}:{expiration}"
|
|
35
|
+
)
|
|
36
|
+
print(raw)
|
|
37
|
+
digest = hashlib.sha256(raw.encode("utf-8")).digest()
|
|
38
|
+
encoded = base64.b64encode(digest).rstrip(b"=").decode("ascii")
|
|
39
|
+
|
|
40
|
+
return {"signature": f"v1_{encoded}", "expiration": expiration}
|
scalebox/sandbox/utils.py
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
1
|
-
import functools
|
|
2
|
-
from typing import Any, Optional, Type, TypeVar, cast
|
|
3
|
-
|
|
4
|
-
T = TypeVar("T")
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
class class_method_variant(object):
|
|
8
|
-
def __init__(self, class_method_name):
|
|
9
|
-
self.class_method_name = class_method_name
|
|
10
|
-
|
|
11
|
-
method: Any
|
|
12
|
-
|
|
13
|
-
def __call__(self, method: T) -> T:
|
|
14
|
-
self.method = method
|
|
15
|
-
return cast(T, self)
|
|
16
|
-
|
|
17
|
-
def __get__(self, obj, objtype: Optional[Type[Any]] = None):
|
|
18
|
-
@functools.wraps(self.method)
|
|
19
|
-
def _wrapper(*args, **kwargs):
|
|
20
|
-
if obj is not None:
|
|
21
|
-
# Method was called as an instance method, e.g.
|
|
22
|
-
# instance.method(...)
|
|
23
|
-
return self.method(obj, *args, **kwargs)
|
|
24
|
-
elif len(args) > 0 and objtype is not None and isinstance(args[0], objtype):
|
|
25
|
-
# Method was called as a class method with the instance as the
|
|
26
|
-
# first argument, e.g. Class.method(instance, ...) which in
|
|
27
|
-
# Python is the same thing as calling an instance method
|
|
28
|
-
return self.method(args[0], *args[1:], **kwargs)
|
|
29
|
-
else:
|
|
30
|
-
# Method was called as a class method, e.g. Class.method(...)
|
|
31
|
-
class_method = getattr(objtype, self.class_method_name)
|
|
32
|
-
return class_method(*args, **kwargs)
|
|
33
|
-
|
|
34
|
-
return _wrapper
|
|
1
|
+
import functools
|
|
2
|
+
from typing import Any, Optional, Type, TypeVar, cast
|
|
3
|
+
|
|
4
|
+
T = TypeVar("T")
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class class_method_variant(object):
|
|
8
|
+
def __init__(self, class_method_name):
|
|
9
|
+
self.class_method_name = class_method_name
|
|
10
|
+
|
|
11
|
+
method: Any
|
|
12
|
+
|
|
13
|
+
def __call__(self, method: T) -> T:
|
|
14
|
+
self.method = method
|
|
15
|
+
return cast(T, self)
|
|
16
|
+
|
|
17
|
+
def __get__(self, obj, objtype: Optional[Type[Any]] = None):
|
|
18
|
+
@functools.wraps(self.method)
|
|
19
|
+
def _wrapper(*args, **kwargs):
|
|
20
|
+
if obj is not None:
|
|
21
|
+
# Method was called as an instance method, e.g.
|
|
22
|
+
# instance.method(...)
|
|
23
|
+
return self.method(obj, *args, **kwargs)
|
|
24
|
+
elif len(args) > 0 and objtype is not None and isinstance(args[0], objtype):
|
|
25
|
+
# Method was called as a class method with the instance as the
|
|
26
|
+
# first argument, e.g. Class.method(instance, ...) which in
|
|
27
|
+
# Python is the same thing as calling an instance method
|
|
28
|
+
return self.method(args[0], *args[1:], **kwargs)
|
|
29
|
+
else:
|
|
30
|
+
# Method was called as a class method, e.g. Class.method(...)
|
|
31
|
+
class_method = getattr(objtype, self.class_method_name)
|
|
32
|
+
return class_method(*args, **kwargs)
|
|
33
|
+
|
|
34
|
+
return _wrapper
|