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 CHANGED
@@ -9,7 +9,7 @@ A multi-language code execution sandbox with support for:
9
9
  - Real-time callbacks and monitoring
10
10
  """
11
11
 
12
- __version__ = "0.1.13"
12
+ __version__ = "0.1.15"
13
13
  __author__ = "ScaleBox Team"
14
14
  __email__ = "dev@scalebox.dev"
15
15
 
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 `E2B_API_KEY` "
71
- 'or you can pass it directly to the sandbox like Sandbox(api_key="e2b_...")',
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 `E2B_ACCESS_TOKEN` or pass the `access_token` in options.",
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
 
@@ -1,4 +1,4 @@
1
- """A client library for accessing E2B API"""
1
+ """A client library for accessing Scalebox API"""
2
2
 
3
3
  from .client import AuthenticatedClient, Client
4
4
 
@@ -28,7 +28,7 @@ logger = logging.getLogger(__name__)
28
28
 
29
29
  class AsyncSandbox(BaseAsyncSandbox):
30
30
  """
31
- E2B cloud sandbox is a secure and isolated cloud environment.
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 [here](https://e2b.dev/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 e2b_code_interpreter import AsyncSandbox
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
- E2B cloud sandbox is a secure and isolated cloud environment.
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 [here](https://.dev/docs).
39
+ Check docs for more information.
40
40
 
41
41
  Use the `Sandbox()` to create a new sandbox.
42
42
 
@@ -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: E2B API Key to use for authentication, defaults to `E2B_API_KEY` environment variable
232
- # :param domain: E2B domain to use for authentication, defaults to `E2B_DOMAIN` environment variable
233
- # :param debug: If True, the sandbox will be created in debug mode, defaults to `E2B_DEBUG` environment variable
234
- # :param sandbox_id: Sandbox ID to connect to, defaults to `E2B_SANDBOX_ID` environment variable
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
- 参数含义与基类相同。首次创建时会自动启动 Xvfb + xfce4
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. 把类型动态升级成 Sandbox
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
- # 连接已有沙箱,仅初始化 VNC
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
- """启动 Xvfb 并等待成功,然后起 xfce4 + VNC"""
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 "