b24api 1.0.1__tar.gz → 2.0.0__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.
Files changed (80) hide show
  1. b24api-2.0.0/PKG-INFO +420 -0
  2. b24api-2.0.0/README.md +408 -0
  3. b24api-2.0.0/b24api/__init__.py +134 -0
  4. b24api-2.0.0/b24api/_stream.py +300 -0
  5. b24api-2.0.0/b24api/batch/__init__.py +3 -0
  6. b24api-2.0.0/b24api/batch/engine.py +348 -0
  7. b24api-2.0.0/b24api/batch/facade.py +129 -0
  8. b24api-2.0.0/b24api/batch/logical.py +348 -0
  9. b24api-2.0.0/b24api/batch/outcome.py +167 -0
  10. b24api-2.0.0/b24api/batch/stream.py +439 -0
  11. b24api-2.0.0/b24api/cli.py +195 -0
  12. b24api-2.0.0/b24api/cli_contract.py +331 -0
  13. b24api-2.0.0/b24api/client.py +400 -0
  14. b24api-2.0.0/b24api/contracts/__init__.py +107 -0
  15. b24api-2.0.0/b24api/contracts/command.py +128 -0
  16. b24api-2.0.0/b24api/contracts/dispatch.py +56 -0
  17. b24api-2.0.0/b24api/contracts/json.py +77 -0
  18. b24api-2.0.0/b24api/contracts/policy.py +306 -0
  19. b24api-2.0.0/b24api/contracts/reference.py +172 -0
  20. b24api-2.0.0/b24api/contracts/report.py +137 -0
  21. b24api-2.0.0/b24api/contracts/request.py +203 -0
  22. b24api-2.0.0/b24api/contracts/response.py +209 -0
  23. b24api-2.0.0/b24api/contracts/stream.py +56 -0
  24. b24api-2.0.0/b24api/contracts/traversal.py +140 -0
  25. b24api-2.0.0/b24api/errors.py +304 -0
  26. b24api-2.0.0/b24api/execution/__init__.py +30 -0
  27. b24api-2.0.0/b24api/execution/cleanup.py +44 -0
  28. b24api-2.0.0/b24api/execution/context.py +335 -0
  29. b24api-2.0.0/b24api/execution/executor.py +339 -0
  30. b24api-2.0.0/b24api/execution/rate.py +220 -0
  31. b24api-2.0.0/b24api/execution/snapshot.py +70 -0
  32. b24api-2.0.0/b24api/redaction.py +205 -0
  33. b24api-2.0.0/b24api/references/__init__.py +3 -0
  34. b24api-2.0.0/b24api/references/binding.py +217 -0
  35. b24api-2.0.0/b24api/references/dispatch.py +419 -0
  36. b24api-2.0.0/b24api/references/facade.py +354 -0
  37. b24api-2.0.0/b24api/references/fanout.py +275 -0
  38. b24api-2.0.0/b24api/references/outcome.py +115 -0
  39. b24api-2.0.0/b24api/references/scheduler.py +480 -0
  40. b24api-2.0.0/b24api/references/stream.py +357 -0
  41. b24api-2.0.0/b24api/references/support.py +191 -0
  42. b24api-2.0.0/b24api/settings.py +222 -0
  43. b24api-2.0.0/b24api/transport/__init__.py +6 -0
  44. b24api-2.0.0/b24api/transport/base.py +56 -0
  45. b24api-2.0.0/b24api/transport/httpx.py +251 -0
  46. b24api-2.0.0/b24api/transport/protocol.py +157 -0
  47. b24api-2.0.0/b24api/traversal/__init__.py +9 -0
  48. b24api-2.0.0/b24api/traversal/counted.py +163 -0
  49. b24api-2.0.0/b24api/traversal/counted_batch.py +184 -0
  50. b24api-2.0.0/b24api/traversal/cursor.py +83 -0
  51. b24api-2.0.0/b24api/traversal/driver.py +414 -0
  52. b24api-2.0.0/b24api/traversal/facade.py +285 -0
  53. b24api-2.0.0/b24api/traversal/identity.py +344 -0
  54. b24api-2.0.0/b24api/traversal/keyset.py +71 -0
  55. b24api-2.0.0/b24api/traversal/plans.py +314 -0
  56. b24api-2.0.0/b24api/traversal/sequential.py +149 -0
  57. b24api-2.0.0/b24api/traversal/stream.py +309 -0
  58. b24api-2.0.0/b24api/traversal/values.py +154 -0
  59. b24api-2.0.0/b24api.egg-info/PKG-INFO +420 -0
  60. b24api-2.0.0/b24api.egg-info/SOURCES.txt +66 -0
  61. b24api-2.0.0/b24api.egg-info/entry_points.txt +2 -0
  62. {b24api-1.0.1 → b24api-2.0.0}/b24api.egg-info/requires.txt +0 -3
  63. {b24api-1.0.1 → b24api-2.0.0}/pyproject.toml +16 -25
  64. b24api-1.0.1/PKG-INFO +0 -166
  65. b24api-1.0.1/README.md +0 -151
  66. b24api-1.0.1/b24api/__init__.py +0 -3
  67. b24api-1.0.1/b24api/api.py +0 -517
  68. b24api-1.0.1/b24api/entity.py +0 -144
  69. b24api-1.0.1/b24api/error.py +0 -22
  70. b24api-1.0.1/b24api/helper.py +0 -322
  71. b24api-1.0.1/b24api/query.py +0 -38
  72. b24api-1.0.1/b24api/settings.py +0 -45
  73. b24api-1.0.1/b24api/type.py +0 -5
  74. b24api-1.0.1/b24api.egg-info/PKG-INFO +0 -166
  75. b24api-1.0.1/b24api.egg-info/SOURCES.txt +0 -17
  76. {b24api-1.0.1 → b24api-2.0.0}/LICENSE +0 -0
  77. {b24api-1.0.1 → b24api-2.0.0}/MANIFEST.in +0 -0
  78. {b24api-1.0.1 → b24api-2.0.0}/b24api.egg-info/dependency_links.txt +0 -0
  79. {b24api-1.0.1 → b24api-2.0.0}/b24api.egg-info/top_level.txt +0 -0
  80. {b24api-1.0.1 → b24api-2.0.0}/setup.cfg +0 -0
b24api-2.0.0/PKG-INFO ADDED
@@ -0,0 +1,420 @@
1
+ Metadata-Version: 2.4
2
+ Name: b24api
3
+ Version: 2.0.0
4
+ Summary: Bitrix24 API
5
+ Requires-Python: >=3.12
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: httpx[http2]>=0.28.1
9
+ Requires-Dist: pydantic>=2.11.7
10
+ Requires-Dist: pydantic-settings>=2.10.1
11
+ Dynamic: license-file
12
+
13
+ # b24api 2.x
14
+
15
+ `b24api` is a thin asynchronous Bitrix24 REST client for Python 3.12+. It knows how to send
16
+ requests, split logical batches, traverse lists, retry safely, preserve caller correlation and
17
+ close resources. It does not contain a Tasks, CRM or IM method catalog and does not impose
18
+ application storage rules.
19
+
20
+ ## Install and configure
21
+
22
+ ```console
23
+ uv sync --frozen
24
+ export BITRIX24_API_WEBHOOK_URL='https://portal.example/rest/.../'
25
+ ```
26
+
27
+ Keep the webhook out of source, logs and command arguments. Reuse one client for a related unit of
28
+ work so its HTTP/2 connection pool and rate state are reused.
29
+
30
+ <!-- tested: tests/client_v2_test.py::test_call_and_call_response_have_stable_detached_types -->
31
+ ```python
32
+ from b24api import Bitrix24, Request
33
+
34
+ async with Bitrix24() as client:
35
+ profile = await client.call(Request("profile"))
36
+ ```
37
+
38
+ The client owns its default transport. An injected transport remains caller-owned. `aclose()` is
39
+ idempotent and closes active streams before the owned transport.
40
+
41
+ ## Direct calls
42
+
43
+ Use `call()` for detached decoded JSON and `call_response()` when you also need the immutable
44
+ response envelope: `result`, `total`, `next`, timing and bounded diagnostic evidence.
45
+
46
+ <!-- tested: tests/client_v2_test.py::test_call_and_call_response_have_stable_detached_types -->
47
+ ```python
48
+ from b24api import ReplaySafety
49
+
50
+ request = Request("example.item.get", {"id": 7}, ReplaySafety.SAFE)
51
+ decoded = await client.call(request)
52
+ response = await client.call_response(request)
53
+ ```
54
+
55
+ ### Replay safety
56
+
57
+ `Request.replay_safety` describes what the client may do when a connection fails after the request
58
+ may already have reached Bitrix:
59
+
60
+ | Value | Meaning | After possible dispatch |
61
+ |---|---|---|
62
+ | `SAFE` | Repeating the request cannot create a second business effect. Typical reads and explicitly idempotent operations belong here. | Automatic retry is allowed within policy budgets. |
63
+ | `UNSAFE` | Repeating the request is known to risk a duplicate effect, for example creating an entity without an idempotency key. | No automatic replay; the caller receives an ambiguous-execution error and reconciles state. |
64
+ | `UNKNOWN` | The caller has not established whether replay is safe. This is the default. | Same conservative behavior as `UNSAFE`, while diagnostics preserve that safety was unknown rather than known unsafe. |
65
+
66
+ A failure proved to occur before dispatch may still be retried. Method names never imply safety;
67
+ mark a request `SAFE` only when the operation's semantics justify it.
68
+
69
+ Use `ExecutionPolicy` to narrow attempts or resource budgets for one operation:
70
+
71
+ <!-- tested: tests/execution_test.py::test_ambiguous_dispatch_never_retries_unproven_request -->
72
+ ```python
73
+ from b24api import ExecutionPolicy
74
+
75
+ one_attempt = ExecutionPolicy(max_attempts_per_request=1)
76
+ result = await client.call(request, policy=one_attempt)
77
+ ```
78
+
79
+ ## Logical batch and correlation
80
+
81
+ `batch()` accepts an arbitrary-length synchronous or asynchronous command source. It consumes the
82
+ source incrementally and splits it into physical Bitrix batches of at most 50 commands; the full
83
+ input is never materialized.
84
+
85
+ `Command.correlation` is arbitrary caller-owned state. It is retained by reference, returned with
86
+ the outcome, never serialized to Bitrix and never included in safe diagnostics. This is useful for
87
+ matching a result to the object, file, chat or database row that produced its request.
88
+
89
+ <!-- tested: tests/client_v2_test.py::test_logical_batch_is_unbounded_ordered_and_correlation_is_strictly_off_wire -->
90
+ ```python
91
+ from b24api import Command, CommandSuccess
92
+
93
+ commands = (
94
+ Command(
95
+ Request("example.item.get", {"id": item_id}, ReplaySafety.SAFE),
96
+ correlation=item_id,
97
+ )
98
+ for item_id in source_ids
99
+ )
100
+
101
+ async with client.batch(commands, batch_size=25) as stream:
102
+ async for outcome in stream:
103
+ assert isinstance(outcome, CommandSuccess)
104
+ consume(outcome.correlation, outcome.result)
105
+ ```
106
+
107
+ `batch()` is fail-fast. `batch_outcomes()` continues where safe and yields one of
108
+ `CommandSuccess`, `CommandFailure`, `CommandNotExecuted` or `CommandOutcomeUnknown` in input order.
109
+
110
+ <!-- tested: tests/client_v2_test.py::test_batch_outcomes_retains_typed_failure_without_halting_later_commands -->
111
+ ```python
112
+ from b24api import CommandFailure, CommandNotExecuted, CommandOutcomeUnknown
113
+
114
+ async with client.batch_outcomes(commands) as stream:
115
+ async for outcome in stream:
116
+ match outcome:
117
+ case CommandSuccess() as success:
118
+ consume(success.correlation, success.result)
119
+ case CommandFailure() | CommandNotExecuted() | CommandOutcomeUnknown():
120
+ handle(outcome)
121
+ ```
122
+
123
+ For independently dispatchable commands, use `fan_out()` or `fan_out_outcomes()` with
124
+ `DirectDispatch` or `BatchDispatch`. Delivery order is explicitly `READY` or `INPUT`.
125
+
126
+ ## Choosing a list operation
127
+
128
+ The unsuffixed operation is the basic strategy with the fewest endpoint assumptions. Faster or
129
+ more specialized mechanics have explicit names and explicit preconditions.
130
+
131
+ | Operation | Use it when | Network mechanics | Completion proof |
132
+ |---|---|---|---|
133
+ | `iter_list` | The method supports ordinary offset pagination. | Pages are requested sequentially using server `next`; no separate count request is made. | Continuation and empty terminal page; add identity for duplicate detection. |
134
+ | `iter_list_counted` | The first response provides an exact filtered `total` and stable offset pages. | Head page is direct; all known tail offsets are grouped into physical Bitrix batches. | Exact total, ranges and identities. |
135
+ | `iter_list_keyset` | The method may omit `total`, but reliably supports ordering and filtering by a unique identity. | Sequential pages advance an identity boundary; no count request. | Strict monotonic identity and empty terminal page. |
136
+ | `iter_list_cursor` | Each next request depends on a cursor from the previous response. | Sequential dependent cursor requests. | Strict unique monotonic cursor and empty terminal page. |
137
+ | `iter_references` | The same list method must run for many parent parameter sets, such as comments per owner or messages per chat. | Bindings are scheduled with direct or physical-batch dispatch; each binding has its own traversal state. | Per-binding rows, completion/failure and caller correlation. |
138
+
139
+ `page_size` is a local decoded-page cap. It is sent to Bitrix only when you provide the endpoint's
140
+ exact `limit_path`; the client never guesses method-specific parameter names.
141
+
142
+ ### Sequential offset
143
+
144
+ This is the canonical default. It follows the `next` returned by the server and confirms the end
145
+ with an empty page. A `total` present in the response is observational; this strategy does not add
146
+ a separate count request.
147
+
148
+ <!-- tested: tests/client_v2_test.py::test_iter_list_is_sequential_mechanics_only_and_report_is_post_cleanup -->
149
+ ```python
150
+ from b24api import IdentityCoercion, IdentitySpec, ResultSelector
151
+
152
+ identity = IdentitySpec(
153
+ item_path=("ID",),
154
+ filter_key="ID",
155
+ order_key="ID",
156
+ coercion=IdentityCoercion.DECIMAL_STRING_INTEGER,
157
+ )
158
+
159
+ stream = client.iter_list(
160
+ Request("example.item.list", replay_safety=ReplaySafety.SAFE),
161
+ selector=ResultSelector(("items",)),
162
+ identity=identity,
163
+ )
164
+ async with stream:
165
+ async for item in stream:
166
+ consume(item)
167
+ ```
168
+
169
+ Without `identity`, successful exhaustion is reported as `MECHANICS_ONLY`: pagination completed,
170
+ but the client cannot prove that the portal did not duplicate or substitute rows.
171
+
172
+ ### Counted, physically batched tail
173
+
174
+ The first direct page must contain an exact filtered `total` and, when more rows exist, `next`.
175
+ The client derives all remaining offsets from the observed head width and sends tail pages through
176
+ bounded physical batches.
177
+
178
+ <!-- tested: tests/client_v2_test.py::test_counted_traversal_preserves_frozen_request_shape_and_exact_identity -->
179
+ ```python
180
+ stream = client.iter_list_counted(
181
+ Request("example.item.list", replay_safety=ReplaySafety.SAFE),
182
+ selector=ResultSelector(("items",)),
183
+ identity=identity,
184
+ page_size=50,
185
+ batch_size=50,
186
+ )
187
+ ```
188
+
189
+ Use it only when `total` is exact for the supplied filter and offset pages are stable. Any missing
190
+ range, overlap, duplicate identity or total contradiction raises `IncompleteTraversalError`.
191
+
192
+ ### No-count keyset
193
+
194
+ Keyset traversal does not ask the server for a count. The method must honor ordering and a strict
195
+ identity boundary such as `filter[>ID]`. It is intentionally sequential because a future boundary
196
+ cannot be known safely before the preceding page arrives.
197
+
198
+ <!-- tested: tests/client_v2_test.py::test_keyset_and_cursor_are_explicit_strict_alternatives -->
199
+ ```python
200
+ from b24api import KeysetSpec, ParameterPath
201
+
202
+ stream = client.iter_list_keyset(
203
+ Request("example.item.list", replay_safety=ReplaySafety.SAFE),
204
+ selector=ResultSelector(("items",)),
205
+ identity=identity,
206
+ keyset=KeysetSpec(
207
+ filter_path=ParameterPath(("filter",)),
208
+ order_path=ParameterPath(("order",)),
209
+ ),
210
+ )
211
+ ```
212
+
213
+ ### Dependent cursor
214
+
215
+ Use a cursor when the next boundary is returned or derived from the previous page, as with many
216
+ message-list methods.
217
+
218
+ <!-- tested: tests/client_v2_test.py::test_keyset_and_cursor_are_explicit_strict_alternatives -->
219
+ ```python
220
+ from b24api import CursorSpec, ParameterPath
221
+
222
+ stream = client.iter_list_cursor(
223
+ Request("example.message.list", replay_safety=ReplaySafety.SAFE),
224
+ selector=ResultSelector(("items",)),
225
+ cursor=CursorSpec(
226
+ parameter_path=ParameterPath(("LAST_ID",)),
227
+ item_path=("ID",),
228
+ coercion=IdentityCoercion.DECIMAL_STRING_INTEGER,
229
+ direction="ascending",
230
+ take="last",
231
+ ),
232
+ )
233
+ ```
234
+
235
+ Cursor values must be unique and strictly monotonic. If an endpoint exposes only a non-unique
236
+ boundary, use an application-owned direct-call workflow or supply a unique tie-breaker.
237
+
238
+ ### One list method across many parent entities
239
+
240
+ `Binding` applies exact parameter updates to a base request and carries parent correlation. The
241
+ client remains unaware of entity types: a binding can represent a deal, lead, chat or any other
242
+ caller-defined parent.
243
+
244
+ <!-- tested: tests/client_v2_test.py::test_bound_references_apply_nested_updates_off_wire_and_emit_exact_completion -->
245
+ ```python
246
+ from b24api import (
247
+ BatchDispatch,
248
+ Binding,
249
+ ParameterPath,
250
+ ParameterUpdate,
251
+ ReferenceComplete,
252
+ ReferenceItem,
253
+ SequentialTraversal,
254
+ )
255
+
256
+ bindings = (
257
+ Binding(
258
+ summary=f"owner {parent_id}",
259
+ updates=(ParameterUpdate(ParameterPath(("filter", "OWNER_ID")), parent_id),),
260
+ correlation=parent_id,
261
+ )
262
+ for parent_id in parent_ids
263
+ )
264
+
265
+ stream = client.iter_references(
266
+ Request("example.comment.list", replay_safety=ReplaySafety.SAFE),
267
+ bindings,
268
+ traversal=SequentialTraversal(selector=ResultSelector(("items",)), identity=identity),
269
+ dispatch=BatchDispatch(batch_size=25, concurrency=2),
270
+ )
271
+ async with stream:
272
+ async for event in stream:
273
+ if isinstance(event, ReferenceItem):
274
+ consume(event.correlation, event.item)
275
+ elif isinstance(event, ReferenceComplete):
276
+ record_completion(event.correlation, event.row_count)
277
+ ```
278
+
279
+ For messages across chats, use the same `iter_references()` shape: each binding updates the chat
280
+ parameter and carries the chat correlation; choose `CursorTraversal` when the message endpoint is
281
+ cursor-based. Identity tracking and completion remain scoped to each binding, so equal child IDs
282
+ under different parents are not conflated.
283
+
284
+ <!-- tested: tests/client_v2_test.py::test_bound_references_apply_nested_updates_off_wire_and_emit_exact_completion -->
285
+ ```python
286
+ from b24api import (
287
+ Binding,
288
+ CursorSpec,
289
+ CursorTraversal,
290
+ DirectDispatch,
291
+ IdentityCoercion,
292
+ ParameterPath,
293
+ ParameterUpdate,
294
+ ResultSelector,
295
+ )
296
+
297
+ chat_bindings = (
298
+ Binding(
299
+ summary=f"chat {chat_id}",
300
+ updates=(ParameterUpdate(ParameterPath(("DIALOG_ID",)), chat_id),),
301
+ correlation={"chat_id": chat_id},
302
+ )
303
+ for chat_id in chat_ids
304
+ )
305
+
306
+ messages = client.iter_references(
307
+ Request("example.message.list", replay_safety=ReplaySafety.SAFE),
308
+ chat_bindings,
309
+ traversal=CursorTraversal(
310
+ selector=ResultSelector(("items",)),
311
+ cursor=CursorSpec(
312
+ parameter_path=ParameterPath(("LAST_ID",)),
313
+ item_path=("ID",),
314
+ coercion=IdentityCoercion.DECIMAL_STRING_INTEGER,
315
+ direction="ascending",
316
+ take="last",
317
+ ),
318
+ ),
319
+ dispatch=DirectDispatch(concurrency=4),
320
+ )
321
+ ```
322
+
323
+ `iter_reference_outcomes()` additionally yields correlated `ReferenceFailure`,
324
+ `ReferenceNotExecuted` and `ReferenceOutcomeUnknown`. A malformed source object that is not a
325
+ `Binding` has no valid caller correlation, so it terminates the source with `InputSourceError`
326
+ rather than fabricating a reference outcome. Already accepted bindings retain their real outcomes.
327
+
328
+ ## Streams, partial results and reports
329
+
330
+ Every multi-item operation returns an `OperationStream`. Prefer `async with`: a plain `break` does
331
+ not close an arbitrary async iterator. After cleanup, `stream.report` permanently exposes one
332
+ immutable `OperationReport`; before termination it is `None`.
333
+
334
+ <!-- tested: tests/client_v2_test.py::test_partial_helper_closes_without_claiming_completion -->
335
+ ```python
336
+ first = await client.iter_list(request).first()
337
+ page = await client.iter_list(request).collect(limit=100)
338
+
339
+ assert first.report.partial
340
+ assert page.report.partial
341
+ ```
342
+
343
+ Helpers do not pull an extra row just to prove exhaustion. Reaching a requested limit is therefore
344
+ `EARLY_CLOSED`, never a false `COMPLETED`. Cancellation and cleanup preserve the primary exception
345
+ and publish the same final report where the Python exception type permits it.
346
+
347
+ ## Resource boundaries
348
+
349
+ `ExecutionPolicy` bounds requests, pages, elapsed time, attempts, decompressed response bytes,
350
+ buffered commands and rows, direct concurrency and active references. The default response ceiling
351
+ is 16 MiB and is enforced while streaming, before JSON decoding.
352
+
353
+ Sequential and counted exact traversal retain observed identities in memory. There is no database,
354
+ spill file or identity-count refusal. Crossing 100,000 distinct identities emits one
355
+ `RuntimeWarning`; exact tracking continues. Strict keyset and cursor traversal retain only
356
+ monotonic progression state when sufficient.
357
+
358
+ ## CLI
359
+
360
+ The wheel installs `b24api`. Stdout contains only result data; list rows are JSONL. Reports and safe
361
+ errors go to stderr. Credentials come only from `Settings` and cannot be passed as CLI arguments.
362
+
363
+ <!-- tested-console: tests/cli_test.py::test_call_routes_replay_safety_and_keeps_success_data_on_stdout -->
364
+ ```console
365
+ b24api call profile
366
+ b24api call example.item.get --params '{"id":7}' --raw --replay-safety safe
367
+ b24api list example.item.list --params @params.json
368
+ b24api list example.item.list --strategy counted --contract @counted-contract.json
369
+ ```
370
+
371
+ The `--raw` CLI option selects the response envelope; it does not alter the Python API. Advanced
372
+ list strategies use closed JSON `version: 1` contracts. The entire contract is validated before
373
+ client construction. Run `b24api --help` and `b24api list --help` for the compact option surface.
374
+
375
+ Exit codes are `0` success, `2` usage/contract error, `3` unavailable configuration, `4`
376
+ remote/protocol/correctness/incomplete failure, `5` broken output consumer and `130` cancellation.
377
+
378
+ ## Correctness boundaries
379
+
380
+ The client fails closed on contradictory pagination, missing counted ranges, duplicate identities,
381
+ unsafe ambiguous replay, oversized responses and incomplete cleanup. It can prove only facts visible
382
+ through the transport contract: continuation, totals, identity, order, budgets and lifecycle.
383
+
384
+ It cannot generically prove that Bitrix honored the business meaning of a filter, choose an
385
+ application's composite storage key or reconcile an ambiguous write. Applications must validate
386
+ expected business sets and verify writes where needed.
387
+
388
+ ## Performance and profiling
389
+
390
+ The current deterministic profile covers request counts, wall/CPU time, time to first row,
391
+ high-water counters, retained resources and optional Memray allocations:
392
+
393
+ ```console
394
+ uv run python tools/b24api_evidence/profile_runtime.py --capability-suite
395
+ uv run python tools/b24api_evidence/profile_runtime.py --samples 7 --warmups 2
396
+ uv run --with memray python tools/b24api_evidence/profile_runtime.py \
397
+ --case dense-10k --plan counted_batch --samples 7 --warmups 2 \
398
+ --memray-output /tmp/b24api.bin
399
+ uv run --with memray memray stats /tmp/b24api.bin
400
+ ```
401
+
402
+ These deterministic fixtures characterize local resources and network shape; they are not live
403
+ portal latency admission. See [docs/performance.md](docs/performance.md) for current measurements
404
+ and [docs/architecture.md](docs/architecture.md) for guarantees and ownership boundaries.
405
+
406
+ Projects moving from an earlier API surface can use [docs/migration.md](docs/migration.md).
407
+
408
+ ## Verification
409
+
410
+ ```console
411
+ uv sync --frozen
412
+ .venv/bin/pytest -q -p no:cacheprovider
413
+ .venv/bin/ruff check . --no-fix --no-cache
414
+ .venv/bin/ruff format --check . --no-cache
415
+ .venv/bin/mypy --strict b24api tools/b24api_evidence
416
+ git diff --check
417
+ ```
418
+
419
+ The wheel regression installs into an isolated environment, executes the `b24api` entry point and
420
+ checks that tests, live/evidence tooling and credentials are excluded.