b3os 0.2.0__tar.gz → 0.2.2__tar.gz
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.
- {b3os-0.2.0 → b3os-0.2.2}/PKG-INFO +1 -1
- {b3os-0.2.0 → b3os-0.2.2}/pyproject.toml +1 -1
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/__init__.py +2 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_async.py +12 -5
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/async_namespaces.py +1447 -78
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/clients.py +30 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/errors.py +190 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/ids.py +16 -1
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/namespaces.py +1447 -78
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/ops.py +84 -10
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/types.py +2051 -36
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_sync.py +12 -5
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_util.py +1 -1
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/helpers/sandboxes.py +166 -18
- {b3os-0.2.0 → b3os-0.2.2}/tests/server.py +3 -1
- b3os-0.2.2/tests/test_sandbox_handle.py +560 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/typing_check.py +13 -0
- {b3os-0.2.0 → b3os-0.2.2}/uv.lock +1 -1
- b3os-0.2.0/tests/test_sandbox_handle.py +0 -279
- {b3os-0.2.0 → b3os-0.2.2}/.gitignore +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/LICENSE +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/README.md +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/biome.json +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_base.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_client.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_errors.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_generated/__init__.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_handle.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_helpers.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_helpers_async.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_login.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_ops.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_options.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_pty.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_response.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_sse.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_timing.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_traces.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/_webhooks.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/helpers/__init__.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/helpers/render.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/helpers/render_async.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/helpers/sandboxes_async.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/src/b3os/py.typed +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/conftest.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_client.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_handle.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_helpers.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_live.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_live_products.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_login.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_no_key.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_parity.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_prism.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_query.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_sandboxes_create.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_speech_stream.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_turns.py +0 -0
- {b3os-0.2.0 → b3os-0.2.2}/tests/test_typing.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.5
|
|
2
2
|
Name: b3os
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.2
|
|
4
4
|
Summary: Python SDK for B3OS beta: vision (web pages and browsers), render, infer, sandboxes, routines, actions and vault, on the machine that runs the model.
|
|
5
5
|
Project-URL: Documentation, https://docs.beta.b3os.org
|
|
6
6
|
Project-URL: Source, https://github.com/b3-fun/b3os-beta
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "b3os"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.2"
|
|
4
4
|
description = "Python SDK for B3OS beta: vision (web pages and browsers), render, infer, sandboxes, routines, actions and vault, on the machine that runs the model."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
license = "Apache-2.0"
|
|
@@ -29,6 +29,7 @@ from ._timing import ServerTiming, ServerTimingEntry, format_server_timing, pars
|
|
|
29
29
|
from ._util import SDK_VERSION
|
|
30
30
|
from ._webhooks import WebhookVerificationError, sign_webhook, verify_webhook
|
|
31
31
|
from .helpers.sandboxes import (
|
|
32
|
+
DEFAULT_MAX_OUTPUT_BYTES,
|
|
32
33
|
AsyncSandbox,
|
|
33
34
|
ExecOutput,
|
|
34
35
|
Harness,
|
|
@@ -95,6 +96,7 @@ __all__ = [
|
|
|
95
96
|
"SandboxInfo",
|
|
96
97
|
"AsyncSandbox",
|
|
97
98
|
"ExecOutput",
|
|
99
|
+
"DEFAULT_MAX_OUTPUT_BYTES",
|
|
98
100
|
"AsyncService",
|
|
99
101
|
"Handle",
|
|
100
102
|
"AsyncHandle",
|
|
@@ -103,11 +103,17 @@ class AsyncEventStream(Generic[E]):
|
|
|
103
103
|
async def __aexit__(self, *exc: Any) -> None:
|
|
104
104
|
await self.aclose()
|
|
105
105
|
|
|
106
|
+
@property
|
|
107
|
+
def request_id(self) -> Optional[str]:
|
|
108
|
+
"""The request id (`x-request-id`) of the response being read; errors this stream raises carry it."""
|
|
109
|
+
r = self._resp or self._first
|
|
110
|
+
return r.headers.get("x-request-id") if r is not None else None
|
|
111
|
+
|
|
106
112
|
def _parse(self, msg: SSEMessage) -> Any:
|
|
107
113
|
try:
|
|
108
114
|
return json.loads(msg.data)
|
|
109
115
|
except ValueError as e:
|
|
110
|
-
raise B3OSError("invalid_response", detail=f"Could not parse the {msg.event} event: {e}", operation_id=self._op)
|
|
116
|
+
raise B3OSError("invalid_response", detail=f"Could not parse the {msg.event} event: {e}", operation_id=self._op, request_id=self.request_id)
|
|
111
117
|
|
|
112
118
|
async def __aiter__(self) -> AsyncIterator[E]:
|
|
113
119
|
if self._iterating:
|
|
@@ -127,7 +133,7 @@ class AsyncEventStream(Generic[E]):
|
|
|
127
133
|
raise
|
|
128
134
|
failures += 1
|
|
129
135
|
if failures > self._max_reconnects:
|
|
130
|
-
raise B3OSError("stream_interrupted", detail=f"Reconnecting failed {failures} times", operation_id=self._op)
|
|
136
|
+
raise B3OSError("stream_interrupted", detail=f"Reconnecting failed {failures} times", operation_id=self._op, request_id=self.request_id)
|
|
131
137
|
attempt += 1
|
|
132
138
|
await anyio.sleep((retry_ms / 1000) if retry_ms is not None else backoff(failures - 1, 0.5, 10))
|
|
133
139
|
continue
|
|
@@ -171,17 +177,18 @@ class AsyncEventStream(Generic[E]):
|
|
|
171
177
|
"timeout" if idle else "stream_interrupted",
|
|
172
178
|
detail=("No data within the idle timeout" if idle else f"The event stream broke: {broken}"),
|
|
173
179
|
operation_id=self._op,
|
|
180
|
+
request_id=self.request_id,
|
|
174
181
|
)
|
|
175
182
|
failures += 1
|
|
176
183
|
if failures > self._max_reconnects:
|
|
177
|
-
raise B3OSError("stream_interrupted", detail=f"The event stream broke {failures} times: {broken}", operation_id=self._op)
|
|
184
|
+
raise B3OSError("stream_interrupted", detail=f"The event stream broke {failures} times: {broken}", operation_id=self._op, request_id=self.request_id)
|
|
178
185
|
else:
|
|
179
186
|
if not self._resumable or not self._reconnect_on_end:
|
|
180
187
|
return
|
|
181
188
|
if not got:
|
|
182
189
|
failures += 1
|
|
183
190
|
if failures > self._max_reconnects:
|
|
184
|
-
raise B3OSError("stream_interrupted", detail="The event stream kept closing without events", operation_id=self._op)
|
|
191
|
+
raise B3OSError("stream_interrupted", detail="The event stream kept closing without events", operation_id=self._op, request_id=self.request_id)
|
|
185
192
|
attempt += 1
|
|
186
193
|
delay = (retry_ms / 1000) if retry_ms is not None else (0.0 if got else backoff(max(0, failures - 1), 0.5, 10))
|
|
187
194
|
if delay:
|
|
@@ -257,7 +264,7 @@ class AsyncJobEventStream(AsyncEventStream[E], Generic[E, J]):
|
|
|
257
264
|
async for _ in self:
|
|
258
265
|
pass
|
|
259
266
|
if self._result is None:
|
|
260
|
-
raise B3OSError("stream_interrupted", detail="The event stream ended before the job finished", operation_id=self._op)
|
|
267
|
+
raise B3OSError("stream_interrupted", detail="The event stream ended before the job finished", operation_id=self._op, request_id=self.request_id)
|
|
261
268
|
return self._result
|
|
262
269
|
|
|
263
270
|
|