bitfab-py 0.78.1__tar.gz → 0.78.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.
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/PKG-INFO +1 -1
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/client.py +52 -27
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/service_calls.py +19 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/pyproject.toml +1 -1
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/README.md +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/__init__.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/agent_middleware.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/approval.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/assertion_categories.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/baml.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/baml_auto_trace.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/categories.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/claude_agent_sdk.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/client_patching.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/cloudReplay.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/cloud_replay_cli.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/commit_ref.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/compress.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/constants.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/datasets.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/db_snapshot.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/error_chain.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/experiment_id.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/experiments.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/finalizers.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/git_command.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/git_state.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/gmail_sandbox.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/google_calls.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/graders.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/http.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/integration_fixture.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/jev.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/labels.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/langgraph.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/langgraph_integration.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/langgraph_runs.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/mock_matching.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/mock_override.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/openai_agent_sdk.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/openai_agents_usage.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/organization_members.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/otel.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/payload_budget.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/processor_payload.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/provider_calls.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_branch.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_cli.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_heartbeat.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_interrupt.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_invocation.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_memory.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_processes.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/replay_registry.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/sandbox.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/seed_cli.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/selective_replay.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/serialize.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/simulation_plan.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/span_meta.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/span_origin.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/spans.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/subtree.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/thread_propagation.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/timestamp.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/trace_completion.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/trace_metadata.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/trace_payload.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/traces.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/tracing.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/transport.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/transport_types.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/verdicts.py +0 -0
- {bitfab_py-0.78.1 → bitfab_py-0.78.2}/bitfab/warn_once.py +0 -0
|
@@ -152,6 +152,7 @@ CAPTURE_ENABLED_ENV = "BITFAB_CAPTURE_ENABLED"
|
|
|
152
152
|
MAX_CAPTURED_SUBTREE_SPANS_ENV = "BITFAB_MAX_CAPTURED_SUBTREE_SPANS"
|
|
153
153
|
|
|
154
154
|
DISABLED_INTEGRATIONS_ENV = "BITFAB_DISABLED_INTEGRATIONS"
|
|
155
|
+
ENABLED_INTEGRATIONS_ENV = "BITFAB_ENABLED_INTEGRATIONS"
|
|
155
156
|
CONTENT_WITHHELD_KEY = "content_withheld_while_integration_off"
|
|
156
157
|
OFF_BY_DEFAULT_INTEGRATIONS = frozenset({"gmail"})
|
|
157
158
|
KNOWN_INTEGRATIONS = provider_calls.INTEGRATION_NAMES | OFF_BY_DEFAULT_INTEGRATIONS
|
|
@@ -170,9 +171,23 @@ def read_positive_int_env(name: str) -> int | None:
|
|
|
170
171
|
return value if value > 0 else None
|
|
171
172
|
|
|
172
173
|
|
|
173
|
-
def
|
|
174
|
+
def _integration_names_from_env(name: str, known: frozenset[str]) -> set[str]:
|
|
175
|
+
raw = os.environ.get(name, "")
|
|
176
|
+
names = {part.strip().lower() for part in raw.split(",") if part.strip()}
|
|
177
|
+
unknown = sorted(names - known)
|
|
178
|
+
if unknown:
|
|
179
|
+
warn_once(
|
|
180
|
+
f"unknown-integrations:{name}:{','.join(unknown)}",
|
|
181
|
+
f"{name} names {', '.join(unknown)}, "
|
|
182
|
+
f"which the SDK does not know; ignoring it. Known integrations are "
|
|
183
|
+
f"{', '.join(sorted(known))}.",
|
|
184
|
+
)
|
|
185
|
+
return names & known
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
def resolve_integrations(
|
|
174
189
|
integrations: Mapping[str, bool] | None,
|
|
175
|
-
) -> frozenset[str]:
|
|
190
|
+
) -> tuple[frozenset[str], frozenset[str]]:
|
|
176
191
|
known = KNOWN_INTEGRATIONS
|
|
177
192
|
in_code = dict(integrations or {})
|
|
178
193
|
unknown = sorted(set(in_code) - known)
|
|
@@ -181,25 +196,26 @@ def resolve_disabled_integrations(
|
|
|
181
196
|
f"Bitfab(integrations=...) got {', '.join(unknown)}; "
|
|
182
197
|
f"known integrations are {', '.join(sorted(known))}."
|
|
183
198
|
)
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
199
|
+
turned_off = _integration_names_from_env(DISABLED_INTEGRATIONS_ENV, known)
|
|
200
|
+
turned_on = _integration_names_from_env(ENABLED_INTEGRATIONS_ENV, known)
|
|
201
|
+
disabled: set[str] = set()
|
|
202
|
+
off_by_default: set[str] = set()
|
|
203
|
+
for name in known:
|
|
204
|
+
if name in in_code:
|
|
205
|
+
if not in_code[name]:
|
|
206
|
+
disabled.add(name)
|
|
207
|
+
elif name in turned_off:
|
|
208
|
+
disabled.add(name)
|
|
209
|
+
elif name in OFF_BY_DEFAULT_INTEGRATIONS and name not in turned_on:
|
|
210
|
+
disabled.add(name)
|
|
211
|
+
off_by_default.add(name)
|
|
212
|
+
return frozenset(disabled), frozenset(off_by_default)
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
def resolve_disabled_integrations(
|
|
216
|
+
integrations: Mapping[str, bool] | None,
|
|
217
|
+
) -> frozenset[str]:
|
|
218
|
+
return resolve_integrations(integrations)[0]
|
|
203
219
|
|
|
204
220
|
|
|
205
221
|
def read_boolean_env(name: str) -> bool | None:
|
|
@@ -1457,13 +1473,19 @@ class Bitfab:
|
|
|
1457
1473
|
span, and replay cannot mock them, and a model client no
|
|
1458
1474
|
Bitfab client has on is never patched. ``gmail`` (Google's
|
|
1459
1475
|
Python client) is off by default because mail is sensitive;
|
|
1460
|
-
True records each
|
|
1461
|
-
|
|
1476
|
+
True, or ``BITFAB_ENABLED_INTEGRATIONS=gmail``, records each
|
|
1477
|
+
Gmail API call as a span named for its method, which the Gmail
|
|
1478
|
+
sandbox builds its starting mailbox from on replay. While it is
|
|
1479
|
+
off only by default, the first Gmail call inside a trace warns
|
|
1480
|
+
once with how to turn it on; turning it off by name silences
|
|
1481
|
+
that. Whatever this says, a Gmail call made during a replay
|
|
1462
1482
|
never reaches Google: the Gmail sandbox answers it. None
|
|
1463
1483
|
(default) or a name left out: off when
|
|
1464
|
-
``BITFAB_DISABLED_INTEGRATIONS`` lists it
|
|
1465
|
-
|
|
1466
|
-
|
|
1484
|
+
``BITFAB_DISABLED_INTEGRATIONS`` lists it, on when
|
|
1485
|
+
``BITFAB_ENABLED_INTEGRATIONS`` lists it (both comma
|
|
1486
|
+
separated; off wins when both do); a name given here wins
|
|
1487
|
+
over both variables. Raises ValueError for a name the SDK
|
|
1488
|
+
does not know.
|
|
1467
1489
|
enabled: Deprecated alias for ``capture_enabled``. Warns once.
|
|
1468
1490
|
"""
|
|
1469
1491
|
if enabled is not None:
|
|
@@ -1484,7 +1506,10 @@ class Bitfab:
|
|
|
1484
1506
|
self._capture_enabled_in_code = capture_enabled
|
|
1485
1507
|
self._capture_enabled_from_env: bool | None = None
|
|
1486
1508
|
self._strict = strict
|
|
1487
|
-
|
|
1509
|
+
(
|
|
1510
|
+
self._disabled_integrations,
|
|
1511
|
+
self._integrations_off_by_default,
|
|
1512
|
+
) = resolve_integrations(integrations)
|
|
1488
1513
|
self._patched_integrations = (
|
|
1489
1514
|
provider_calls.INTEGRATION_NAMES - self._disabled_integrations
|
|
1490
1515
|
)
|
|
@@ -11,6 +11,7 @@ from typing import Any
|
|
|
11
11
|
|
|
12
12
|
from bitfab.constants import _replay_context, replay_item_is_running
|
|
13
13
|
from bitfab.sandbox import SANDBOX_SESSION_KEY
|
|
14
|
+
from bitfab.warn_once import warn_once
|
|
14
15
|
|
|
15
16
|
|
|
16
17
|
@dataclass(frozen=True)
|
|
@@ -53,6 +54,22 @@ def _records(client: Any, integration: str) -> bool:
|
|
|
53
54
|
return integration not in getattr(client, "_disabled_integrations", ())
|
|
54
55
|
|
|
55
56
|
|
|
57
|
+
def _warn_recording_off_by_default(integration: str) -> None:
|
|
58
|
+
newest = next(iter(_alive_clients()), None)
|
|
59
|
+
if integration not in getattr(newest, "_integrations_off_by_default", ()):
|
|
60
|
+
return
|
|
61
|
+
warn_once(
|
|
62
|
+
f"integration-off-by-default:{integration}",
|
|
63
|
+
f"a {integration} call ran inside a trace and was not recorded, because "
|
|
64
|
+
f"Bitfab records {integration} calls only once you turn them on (they "
|
|
65
|
+
f"carry your users' data). Without them, replays of this trace start "
|
|
66
|
+
f"the {integration} sandbox with nothing the original run read. Turn "
|
|
67
|
+
f'recording on with Bitfab(integrations={{"{integration}": True}}) or '
|
|
68
|
+
f"BITFAB_ENABLED_INTEGRATIONS={integration}; turn it off by name "
|
|
69
|
+
f'(integrations={{"{integration}": False}}) to stop this warning.',
|
|
70
|
+
)
|
|
71
|
+
|
|
72
|
+
|
|
56
73
|
def current_call() -> ServiceCall | None:
|
|
57
74
|
return _current.get()
|
|
58
75
|
|
|
@@ -117,6 +134,8 @@ def run(call: ServiceCall) -> Any:
|
|
|
117
134
|
(c for c in _alive_clients() if _records(c, call.integration)), None
|
|
118
135
|
)
|
|
119
136
|
if client is None or not _inside_trace():
|
|
137
|
+
if client is None and _inside_trace():
|
|
138
|
+
_warn_recording_off_by_default(call.integration)
|
|
120
139
|
return call.send()
|
|
121
140
|
tokens = (
|
|
122
141
|
_current.set(call),
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|