scalebox-sdk 0.1.4__py3-none-any.whl → 0.1.25__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.
Files changed (68) hide show
  1. scalebox/__init__.py +1 -1
  2. scalebox/api/__init__.py +128 -128
  3. scalebox/api/client/__init__.py +8 -8
  4. scalebox/api/client/api/sandboxes/get_sandboxes.py +5 -3
  5. scalebox/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +2 -2
  6. scalebox/api/client/api/sandboxes/post_sandboxes.py +2 -2
  7. scalebox/api/client/client.py +288 -288
  8. scalebox/api/client/models/listed_sandbox.py +11 -9
  9. scalebox/api/client/models/new_sandbox.py +1 -1
  10. scalebox/api/client/models/sandbox.py +125 -125
  11. scalebox/api/client/models/sandbox_state.py +1 -0
  12. scalebox/api/client/types.py +46 -46
  13. scalebox/code_interpreter/code_interpreter_async.py +370 -369
  14. scalebox/code_interpreter/code_interpreter_sync.py +318 -317
  15. scalebox/connection_config.py +92 -92
  16. scalebox/csx_desktop/main.py +12 -12
  17. scalebox/generated/api_pb2_connect.py +17 -66
  18. scalebox/sandbox_async/commands/command.py +307 -307
  19. scalebox/sandbox_async/commands/command_handle.py +187 -187
  20. scalebox/sandbox_async/commands/pty.py +187 -187
  21. scalebox/sandbox_async/filesystem/filesystem.py +557 -557
  22. scalebox/sandbox_async/filesystem/watch_handle.py +61 -61
  23. scalebox/sandbox_async/main.py +647 -646
  24. scalebox/sandbox_async/sandbox_api.py +365 -365
  25. scalebox/sandbox_async/utils.py +7 -7
  26. scalebox/sandbox_sync/__init__.py +2 -2
  27. scalebox/sandbox_sync/commands/command.py +300 -300
  28. scalebox/sandbox_sync/commands/command_handle.py +150 -150
  29. scalebox/sandbox_sync/commands/pty.py +181 -181
  30. scalebox/sandbox_sync/filesystem/filesystem.py +543 -543
  31. scalebox/sandbox_sync/filesystem/watch_handle.py +66 -66
  32. scalebox/sandbox_sync/main.py +789 -790
  33. scalebox/sandbox_sync/sandbox_api.py +356 -356
  34. scalebox/test/CODE_INTERPRETER_TESTS_READY.md +256 -256
  35. scalebox/test/README.md +164 -164
  36. scalebox/test/aclient.py +72 -72
  37. scalebox/test/code_interpreter_centext.py +21 -21
  38. scalebox/test/code_interpreter_centext_sync.py +21 -21
  39. scalebox/test/code_interpreter_test.py +1 -1
  40. scalebox/test/code_interpreter_test_sync.py +1 -1
  41. scalebox/test/run_all_validation_tests.py +334 -334
  42. scalebox/test/test_basic.py +78 -78
  43. scalebox/test/test_code_interpreter_async_comprehensive.py +2653 -2653
  44. scalebox/test/{test_code_interpreter_e2bsync_comprehensive.py → test_code_interpreter_execcode.py} +328 -392
  45. scalebox/test/test_code_interpreter_sync_comprehensive.py +3416 -3412
  46. scalebox/test/test_csx_desktop_examples.py +130 -0
  47. scalebox/test/test_sandbox_async_comprehensive.py +736 -738
  48. scalebox/test/test_sandbox_stress_and_edge_cases.py +778 -778
  49. scalebox/test/test_sandbox_sync_comprehensive.py +779 -770
  50. scalebox/test/test_sandbox_usage_examples.py +987 -987
  51. scalebox/test/testacreate.py +24 -24
  52. scalebox/test/testagetinfo.py +18 -18
  53. scalebox/test/testcodeinterpreter_async.py +508 -508
  54. scalebox/test/testcodeinterpreter_sync.py +239 -239
  55. scalebox/test/testcomputeuse.py +2 -2
  56. scalebox/test/testnovnc.py +12 -12
  57. scalebox/test/testsandbox_api.py +15 -0
  58. scalebox/test/testsandbox_async.py +202 -118
  59. scalebox/test/testsandbox_sync.py +71 -38
  60. scalebox/version.py +2 -2
  61. {scalebox_sdk-0.1.4.dist-info → scalebox_sdk-0.1.25.dist-info}/METADATA +104 -103
  62. {scalebox_sdk-0.1.4.dist-info → scalebox_sdk-0.1.25.dist-info}/RECORD +66 -66
  63. scalebox/test/test_code_interpreter_e2basync_comprehensive.py +0 -2655
  64. scalebox/test/test_e2b_first.py +0 -11
  65. {scalebox_sdk-0.1.4.dist-info → scalebox_sdk-0.1.25.dist-info}/WHEEL +0 -0
  66. {scalebox_sdk-0.1.4.dist-info → scalebox_sdk-0.1.25.dist-info}/entry_points.txt +0 -0
  67. {scalebox_sdk-0.1.4.dist-info → scalebox_sdk-0.1.25.dist-info}/licenses/LICENSE +0 -0
  68. {scalebox_sdk-0.1.4.dist-info → scalebox_sdk-0.1.25.dist-info}/top_level.txt +0 -0
@@ -1,61 +1,61 @@
1
- import asyncio
2
- import inspect
3
- from typing import Any, AsyncGenerator, Optional
4
-
5
- from ...generated.api_pb2 import WatchDirResponse
6
- from ...generated.rpc import handle_rpc_exception
7
- from ...sandbox.filesystem.watch_handle import FilesystemEvent, map_event_type
8
- from ...sandbox_async.utils import OutputHandler
9
-
10
-
11
- class AsyncWatchHandle:
12
- """
13
- Handle for watching a directory in the sandbox filesystem.
14
-
15
- Use `.stop()` to stop watching the directory.
16
- """
17
-
18
- def __init__(
19
- self,
20
- events: AsyncGenerator[WatchDirResponse, Any],
21
- on_event: OutputHandler[FilesystemEvent],
22
- on_exit: Optional[OutputHandler[Exception]] = None,
23
- ):
24
- self._events = events
25
- self._on_event = on_event
26
- self._on_exit = on_exit
27
-
28
- self._wait = asyncio.create_task(self._handle_events())
29
-
30
- async def stop(self):
31
- """
32
- Stop watching the directory.
33
- """
34
- self._wait.cancel()
35
- # BUG: In Python 3.8 closing async generator can throw RuntimeError.
36
- # await self._events.aclose()
37
-
38
- async def _iterate_events(self):
39
- try:
40
- async for event in self._events:
41
- if event.HasField("filesystem"):
42
- event_type = map_event_type(event.filesystem.type)
43
- if event_type:
44
- yield FilesystemEvent(
45
- name=event.filesystem.name,
46
- type=event_type,
47
- )
48
- except Exception as e:
49
- raise handle_rpc_exception(e)
50
-
51
- async def _handle_events(self):
52
- try:
53
- async for event in self._iterate_events():
54
- cb = self._on_event(event)
55
- if inspect.isawaitable(cb):
56
- await cb
57
- except Exception as e:
58
- if self._on_exit:
59
- cb = self._on_exit(e)
60
- if inspect.isawaitable(cb):
61
- await cb
1
+ import asyncio
2
+ import inspect
3
+ from typing import Any, AsyncGenerator, Optional
4
+
5
+ from ...generated.api_pb2 import WatchDirResponse
6
+ from ...generated.rpc import handle_rpc_exception
7
+ from ...sandbox.filesystem.watch_handle import FilesystemEvent, map_event_type
8
+ from ...sandbox_async.utils import OutputHandler
9
+
10
+
11
+ class AsyncWatchHandle:
12
+ """
13
+ Handle for watching a directory in the sandbox filesystem.
14
+
15
+ Use `.stop()` to stop watching the directory.
16
+ """
17
+
18
+ def __init__(
19
+ self,
20
+ events: AsyncGenerator[WatchDirResponse, Any],
21
+ on_event: OutputHandler[FilesystemEvent],
22
+ on_exit: Optional[OutputHandler[Exception]] = None,
23
+ ):
24
+ self._events = events
25
+ self._on_event = on_event
26
+ self._on_exit = on_exit
27
+
28
+ self._wait = asyncio.create_task(self._handle_events())
29
+
30
+ async def stop(self):
31
+ """
32
+ Stop watching the directory.
33
+ """
34
+ self._wait.cancel()
35
+ # BUG: In Python 3.8 closing async generator can throw RuntimeError.
36
+ # await self._events.aclose()
37
+
38
+ async def _iterate_events(self):
39
+ try:
40
+ async for event in self._events:
41
+ if event.HasField("filesystem"):
42
+ event_type = map_event_type(event.filesystem.type)
43
+ if event_type:
44
+ yield FilesystemEvent(
45
+ name=event.filesystem.name,
46
+ type=event_type,
47
+ )
48
+ except Exception as e:
49
+ raise handle_rpc_exception(e)
50
+
51
+ async def _handle_events(self):
52
+ try:
53
+ async for event in self._iterate_events():
54
+ cb = self._on_event(event)
55
+ if inspect.isawaitable(cb):
56
+ await cb
57
+ except Exception as e:
58
+ if self._on_exit:
59
+ cb = self._on_exit(e)
60
+ if inspect.isawaitable(cb):
61
+ await cb