tigrbl-runtime 0.4.4.dev1__tar.gz → 0.4.4.dev7__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 (59) hide show
  1. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/PKG-INFO +2 -4
  2. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/README.md +1 -3
  3. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/pyproject.toml +1 -1
  4. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/_asgi_webtransport.py +18 -2
  5. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/__init__.py +1 -3
  6. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/_invoke_support.py +0 -54
  7. tigrbl_runtime-0.4.4.dev7/tigrbl_runtime/executors/kernel_executor.py +92 -0
  8. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/packed.py +29 -0
  9. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/phase.py +1 -1
  10. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/executors/invoke.py → tigrbl_runtime-0.4.4.dev7/tigrbl_runtime/executors/phase_runner.py +17 -111
  11. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/runtime.py +15 -56
  12. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/executors/kernel_executor.py +0 -30
  13. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/handle.py +0 -19
  14. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/__init__.py +0 -67
  15. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/_fallback.py +0 -73
  16. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/_load_rust.py +0 -22
  17. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/availability.py +0 -5
  18. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/backend.py +0 -62
  19. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/callbacks.py +0 -43
  20. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/codec.py +0 -27
  21. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/compile.py +0 -15
  22. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/errors.py +0 -27
  23. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/request.py +0 -27
  24. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/response.py +0 -22
  25. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/runtime.py +0 -62
  26. tigrbl_runtime-0.4.4.dev1/tigrbl_runtime/rust/trace.py +0 -29
  27. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/LICENSE +0 -0
  28. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/NOTICE +0 -0
  29. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/__init__.py +0 -0
  30. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/callbacks.py +0 -0
  31. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/__init__.py +0 -0
  32. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/_asgi_completion.py +0 -0
  33. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/_asgi_context.py +0 -0
  34. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/_asgi_jsonrpc.py +0 -0
  35. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/_asgi_receive.py +0 -0
  36. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/_asgi_scope.py +0 -0
  37. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/_asgi_send.py +0 -0
  38. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/asgi.py +0 -0
  39. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/capabilities.py +0 -0
  40. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/channel/websocket.py +0 -0
  41. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/config/__init__.py +0 -0
  42. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/config/constants.py +0 -0
  43. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/base.py +0 -0
  44. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/ctx/__init__.py +0 -0
  45. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/ctx/context.py +0 -0
  46. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/ctx/hot.py +0 -0
  47. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/ctx/hot_namespaces.py +0 -0
  48. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/ctx/hot_state.py +0 -0
  49. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/numba_packed.py +0 -0
  50. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/executors/types.py +0 -0
  51. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/__init__.py +0 -0
  52. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/_typing_aliases.py +0 -0
  53. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/base.py +0 -0
  54. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/channel.py +0 -0
  55. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/exceptions.py +0 -0
  56. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/hook_types.py +0 -0
  57. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/response.py +0 -0
  58. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/runtime/system.py +0 -0
  59. {tigrbl_runtime-0.4.4.dev1 → tigrbl_runtime-0.4.4.dev7}/tigrbl_runtime/semantics.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tigrbl-runtime
3
- Version: 0.4.4.dev1
3
+ Version: 0.4.4.dev7
4
4
  Summary: Runtime pipeline helpers and execution bridge surfaces for Tigrbl ASGI applications, transports, and operation dispatch.
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -311,8 +311,7 @@ pip install tigrbl-runtime
311
311
  `tigrbl-runtime` owns the `foundational framework package` boundary. It should be installed when you need this package's focused responsibility without assuming every other Tigrbl workspace package is present.
312
312
 
313
313
  Implementation orientation:
314
- - `tigrbl_runtime`: callbacks, channel/, config/, executors/, handle, protocol/, runtime/, transactions, webhooks
315
- - `tigrbl_runtime/rust/`: deprecated compatibility shims only; Rust execution is unavailable.
314
+ - `tigrbl_runtime`: callbacks, channel/, config/, executors/, protocol/, runtime/, transactions, webhooks
316
315
 
317
316
  Runtime authoring BCP:
318
317
  - Do use this package for runtime-owned routing, request execution, transport-unit execution, framing atoms, transport channels, transaction helpers, and kernel integration.
@@ -325,7 +324,6 @@ Runtime authoring BCP:
325
324
 
326
325
  - Import roots: `tigrbl_runtime`.
327
326
  - Public symbols: `Runtime`, `RuntimeBase`.
328
- - Rust-named symbols live only under `tigrbl_runtime.rust` as deprecated compatibility shims and must not be used for execution.
329
327
  - Workspace dependencies: [`tigrbl-typing`](https://pypi.org/project/tigrbl-typing/), [`tigrbl-kernel`](https://pypi.org/project/tigrbl-kernel/), [`tigrbl-atoms`](https://pypi.org/project/tigrbl-atoms/), [`tigrbl-base`](https://pypi.org/project/tigrbl-base/), [`tigrbl-core`](https://pypi.org/project/tigrbl-core/).
330
328
  - External runtime dependencies: `numba>=0.61.2`.
331
329
 
@@ -71,8 +71,7 @@ pip install tigrbl-runtime
71
71
  `tigrbl-runtime` owns the `foundational framework package` boundary. It should be installed when you need this package's focused responsibility without assuming every other Tigrbl workspace package is present.
72
72
 
73
73
  Implementation orientation:
74
- - `tigrbl_runtime`: callbacks, channel/, config/, executors/, handle, protocol/, runtime/, transactions, webhooks
75
- - `tigrbl_runtime/rust/`: deprecated compatibility shims only; Rust execution is unavailable.
74
+ - `tigrbl_runtime`: callbacks, channel/, config/, executors/, protocol/, runtime/, transactions, webhooks
76
75
 
77
76
  Runtime authoring BCP:
78
77
  - Do use this package for runtime-owned routing, request execution, transport-unit execution, framing atoms, transport channels, transaction helpers, and kernel integration.
@@ -85,7 +84,6 @@ Runtime authoring BCP:
85
84
 
86
85
  - Import roots: `tigrbl_runtime`.
87
86
  - Public symbols: `Runtime`, `RuntimeBase`.
88
- - Rust-named symbols live only under `tigrbl_runtime.rust` as deprecated compatibility shims and must not be used for execution.
89
87
  - Workspace dependencies: [`tigrbl-typing`](https://pypi.org/project/tigrbl-typing/), [`tigrbl-kernel`](https://pypi.org/project/tigrbl-kernel/), [`tigrbl-atoms`](https://pypi.org/project/tigrbl-atoms/), [`tigrbl-base`](https://pypi.org/project/tigrbl-base/), [`tigrbl-core`](https://pypi.org/project/tigrbl-core/).
90
88
  - External runtime dependencies: `numba>=0.61.2`.
91
89
 
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tigrbl-runtime"
3
- version = "0.4.4.dev1"
3
+ version = "0.4.4.dev7"
4
4
  description = "Runtime pipeline helpers and execution bridge surfaces for Tigrbl ASGI applications, transports, and operation dispatch."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -114,8 +114,11 @@ def _iter_webtransport_hooks(ctx: Any) -> tuple[HookSpec, ...]:
114
114
  hooks: list[HookSpec] = []
115
115
  seen: set[int] = set()
116
116
  for owner_key in ("app", "router"):
117
- owner = ctx.get(owner_key) if isinstance(ctx, dict) else None
118
- for item in tuple(getattr(owner, "hooks", ()) or ()):
117
+ getter = getattr(ctx, "get", None)
118
+ owner = getter(owner_key) if callable(getter) else None
119
+ if owner is None:
120
+ owner = getattr(ctx, owner_key, None)
121
+ for item in _iter_hook_candidates(getattr(owner, "hooks", ())):
119
122
  if id(item) in seen:
120
123
  continue
121
124
  if isinstance(item, HookSpec):
@@ -128,6 +131,19 @@ def _iter_webtransport_hooks(ctx: Any) -> tuple[HookSpec, ...]:
128
131
  return tuple(sorted(hooks, key=lambda hook: int(getattr(hook, "order", 0))))
129
132
 
130
133
 
134
+ def _iter_hook_candidates(value: Any) -> tuple[Any, ...]:
135
+ if value is None:
136
+ return ()
137
+ if isinstance(value, Mapping):
138
+ return tuple(value.values())
139
+ if isinstance(value, (list, tuple, set, frozenset)):
140
+ return tuple(value)
141
+ data = getattr(value, "__dict__", None)
142
+ if isinstance(data, Mapping):
143
+ return tuple(data.values())
144
+ return ()
145
+
146
+
131
147
  async def _call_webtransport_hook(hook: HookSpec, ctx: Any) -> None:
132
148
  fn = hook.fn
133
149
  try:
@@ -11,9 +11,7 @@ _EXPORTS = {
11
11
  "PackedPlanExecutor": "packed",
12
12
  "NumbaPackedPlanExecutor": "numba_packed",
13
13
  "_Ctx": "types",
14
- "_invoke": "invoke",
15
- "resolve_phase_chains": "invoke",
16
- "invoke_op": "invoke",
14
+ "_invoke": "phase_runner",
17
15
  }
18
16
 
19
17
  __all__ = list(_EXPORTS)
@@ -4,17 +4,13 @@ import logging
4
4
  from typing import Any, Mapping, Optional, Union
5
5
 
6
6
  from tigrbl_kernel.helpers import _g, _run_chain
7
- from tigrbl_ops_oltp.crud import ops as _crud_ops
8
- from tigrbl_ops_oltp.crud.helpers.model import _coerce_pk_value, _single_pk_name
9
7
 
10
8
  from .types import AsyncSession, PhaseChains, Session, _Ctx
11
9
 
12
10
  logger = logging.getLogger(__name__)
13
11
 
14
- _OPVIEW_CACHE_ATTR = "__tigrbl_cached_opviews__"
15
12
  _LOG_NOISE_REDUCED = False
16
13
  _NOISY_TIGRBL_LOGGERS = (
17
- "tigrbl_ops_oltp.crud.helpers.model",
18
14
  "tigrbl_core._spec.column_spec",
19
15
  )
20
16
 
@@ -112,54 +108,6 @@ async def _maybe_await(value: Any) -> Any:
112
108
  return value
113
109
 
114
110
 
115
- async def _crud_result_fallback(ctx: _Ctx, current_result: Any) -> Any:
116
- alias = str(ctx.get("op") or "").lower()
117
- if alias not in {"read", "update", "replace"}:
118
- return current_result
119
-
120
- model = ctx.get("model")
121
- db = ctx.get("db")
122
- if not isinstance(model, type) or db is None:
123
- return current_result
124
-
125
- try:
126
- pk_name = _single_pk_name(model)
127
- except Exception:
128
- return current_result
129
-
130
- payload = ctx.get("payload")
131
- path_params = ctx.get("path_params")
132
- ident = None
133
- if isinstance(path_params, Mapping) and pk_name in path_params:
134
- ident = path_params.get(pk_name)
135
- elif isinstance(payload, Mapping) and pk_name in payload:
136
- ident = payload.get(pk_name)
137
- if ident is None:
138
- return current_result
139
-
140
- ident = _coerce_pk_value(model, ident)
141
-
142
- if alias == "read":
143
- needs_fallback = current_result is None
144
- if isinstance(current_result, Mapping):
145
- if pk_name not in current_result:
146
- needs_fallback = True
147
- else:
148
- data_keys = [k for k in current_result.keys() if k != pk_name]
149
- if data_keys and all(current_result.get(k) is None for k in data_keys):
150
- needs_fallback = True
151
- if not needs_fallback:
152
- return current_result
153
- return await _crud_ops.read(model, ident, db)
154
-
155
- if current_result is None and isinstance(payload, Mapping):
156
- if alias == "update":
157
- return await _crud_ops.update(model, ident, dict(payload), db)
158
- return await _crud_ops.replace(model, ident, dict(payload), db)
159
-
160
- return current_result
161
-
162
-
163
111
  async def _rollback_if_owned(
164
112
  db: Union[Session, AsyncSession, None],
165
113
  owns_tx: bool,
@@ -181,8 +129,6 @@ async def _rollback_if_owned(
181
129
 
182
130
 
183
131
  __all__ = [
184
- "_OPVIEW_CACHE_ATTR",
185
- "_crud_result_fallback",
186
132
  "_default_status_for_alias",
187
133
  "_maybe_await",
188
134
  "_normalize_result_payload",
@@ -0,0 +1,92 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping, MutableMapping
4
+ from types import SimpleNamespace
5
+ from typing import Any
6
+
7
+ from .phase_runner import _invoke
8
+ from .types import _Ctx
9
+ from tigrbl_typing.phases import canonicalize_phase_input as normalize_phase
10
+
11
+
12
+ async def _run(
13
+ self,
14
+ model: type,
15
+ alias: str,
16
+ *,
17
+ db: Any,
18
+ request: Any | None = None,
19
+ ctx: Any | None = None,
20
+ ) -> Any:
21
+ phases = self._build_op(model, alias)
22
+ base_ctx = _Ctx.ensure(request=request, db=db, seed=ctx)
23
+ return await _invoke(request=request, db=db, phases=phases, ctx=base_ctx)
24
+
25
+
26
+ async def _run_phase_chain(self, ctx: _Ctx, phases: Any) -> None:
27
+ for _phase, steps in (phases or {}).items():
28
+ ctx.phase = normalize_phase(_phase)
29
+ for step in steps or ():
30
+ rv = step(ctx)
31
+ if hasattr(rv, "__await__"):
32
+ await rv
33
+
34
+
35
+ def resolve_phase_chains(model: type, alias: str) -> Mapping[str, list[Any]]:
36
+ """Resolve executable phase chains for a model operation."""
37
+ from tigrbl_kernel import build_phase_chains
38
+
39
+ return build_phase_chains(model, alias) or {}
40
+
41
+
42
+ async def invoke_op(
43
+ *,
44
+ request: Any = None,
45
+ db: Any = None,
46
+ model: type,
47
+ alias: str,
48
+ ctx: MutableMapping[str, Any] | None = None,
49
+ ) -> Any:
50
+ """Resolve operation metadata and execute its phase lifecycle."""
51
+ from tigrbl_kernel import _default_kernel, get_cached_specs
52
+
53
+ seed_ctx: MutableMapping[str, Any] = dict(ctx or {})
54
+ seed_ctx.setdefault("model", model)
55
+ seed_ctx.setdefault("op", alias)
56
+ seed_ctx.setdefault("method", alias)
57
+ if request is not None:
58
+ seed_ctx.setdefault("request", request)
59
+ if db is not None:
60
+ seed_ctx.setdefault("db", db)
61
+ if seed_ctx.get("env") is None:
62
+ seed_ctx["env"] = SimpleNamespace(method=alias)
63
+ seed_ctx.setdefault("skip_egress", True)
64
+
65
+ app_ref = (
66
+ getattr(request, "app", None)
67
+ or seed_ctx.get("app")
68
+ or seed_ctx.get("router")
69
+ or model
70
+ )
71
+ seed_ctx.setdefault("app", app_ref)
72
+ seed_ctx.setdefault("router", seed_ctx.get("router") or app_ref)
73
+
74
+ if seed_ctx.get("specs") is None:
75
+ specs = get_cached_specs(model)
76
+ if specs is not None:
77
+ seed_ctx["specs"] = specs
78
+
79
+ if seed_ctx.get("opview") is None:
80
+ try:
81
+ seed_ctx["opview"] = _default_kernel.get_opview(app_ref, model, alias)
82
+ except Exception:
83
+ # Some call paths rely only on specs/schemas and can proceed without
84
+ # a compiled opview.
85
+ pass
86
+
87
+ return await _invoke(
88
+ request=request,
89
+ db=db,
90
+ phases=resolve_phase_chains(model, alias),
91
+ ctx=seed_ctx,
92
+ )
@@ -1431,6 +1431,33 @@ class PackedPlanExecutor(ExecutorBase):
1431
1431
  hot.absent_fields = tuple(absent)
1432
1432
  hot.used_default_factory = tuple(used_default)
1433
1433
 
1434
+ @staticmethod
1435
+ def _publish_compiled_payload(ctx: _Ctx, hot: HotCtx) -> None:
1436
+ field_names = tuple(getattr(hot, "slot_field_names", ()) or ())
1437
+ values = getattr(hot, "assembled_slot_values", None)
1438
+ present = getattr(hot, "assembled_slot_present", None)
1439
+ if not field_names or values is None or present is None:
1440
+ return
1441
+ payload = {
1442
+ field_names[idx]: values[idx]
1443
+ for idx in range(min(len(field_names), len(values), len(present)))
1444
+ if present[idx]
1445
+ }
1446
+ if not payload:
1447
+ return
1448
+ ctx["payload"] = payload
1449
+ ctx["in_data"] = payload
1450
+ ctx["data"] = payload
1451
+
1452
+ @staticmethod
1453
+ def _publish_route_payload(ctx: _Ctx, hot: HotCtx) -> None:
1454
+ payload = getattr(hot, "route_payload", None)
1455
+ if not isinstance(payload, Mapping):
1456
+ return
1457
+ ctx["payload"] = dict(payload)
1458
+ ctx["in_data"] = dict(payload)
1459
+ ctx["data"] = dict(payload)
1460
+
1434
1461
  def _resolve_segments_for_program(
1435
1462
  self, packed: PackedKernel, program_id: int
1436
1463
  ) -> tuple[tuple[int, ...], tuple[int, ...]]:
@@ -2699,6 +2726,7 @@ class PackedPlanExecutor(ExecutorBase):
2699
2726
  if hot is None:
2700
2727
  return
2701
2728
  await self._prepare_compiled_input(ctx, hot, packed, program_id, hot_op_plan)
2729
+ self._publish_route_payload(ctx, hot)
2702
2730
  if hot.compiled_input_ready:
2703
2731
  plan = self._resolve_compiled_param_plan(
2704
2732
  ctx,
@@ -2707,6 +2735,7 @@ class PackedPlanExecutor(ExecutorBase):
2707
2735
  hot.param_shape_id,
2708
2736
  )
2709
2737
  self._compiled_validate_and_assemble(ctx, hot, plan)
2738
+ self._publish_compiled_payload(ctx, hot)
2710
2739
  current_phase = ""
2711
2740
  for phase_name, invoke_kind, call, dep, is_async in compiled_steps:
2712
2741
  if phase_name != current_phase:
@@ -6,7 +6,7 @@ from tigrbl_kernel.models import KernelPlan
6
6
 
7
7
  from .base import ExecutorBase
8
8
  from .types import _Ctx
9
- from .invoke import _invoke
9
+ from .phase_runner import _invoke
10
10
 
11
11
 
12
12
  class PhaseExecutor(ExecutorBase):
@@ -1,4 +1,3 @@
1
- # tigrbl/runtime/executor/invoke.py
2
1
  from __future__ import annotations
3
2
 
4
3
  from types import SimpleNamespace
@@ -6,14 +5,11 @@ from typing import Any, Mapping, MutableMapping, Optional, Union
6
5
 
7
6
  from tigrbl_atoms.atoms.sys._db import _in_transaction
8
7
  from tigrbl_atoms.types import build_error_ctx, error_phase_for, select_error_edge
9
- from tigrbl_kernel import build_phase_chains, get_cached_specs, _default_kernel
10
8
  from tigrbl_kernel.helpers import _g, _run_chain
11
9
  from tigrbl_typing.status import create_standardized_error, to_rpc_error_payload
12
10
 
13
11
  from ..config.constants import CTX_SKIP_PERSIST_FLAG
14
12
  from ._invoke_support import (
15
- _OPVIEW_CACHE_ATTR as _OPVIEW_CACHE_ATTR,
16
- _crud_result_fallback as _crud_result_fallback,
17
13
  _default_status_for_alias as _default_status_for_alias,
18
14
  _maybe_await as _maybe_await,
19
15
  _normalize_result_payload as _normalize_result_payload,
@@ -25,11 +21,6 @@ from ._invoke_support import (
25
21
  from .types import AsyncSession, PhaseChains, Request, Session, _Ctx
26
22
 
27
23
 
28
- def resolve_phase_chains(model: type, alias: str) -> Mapping[str, list[Any]]:
29
- """Resolve executable phase chains for a model operation."""
30
- return build_phase_chains(model, alias) or {}
31
-
32
-
33
24
  async def _invoke(
34
25
  *,
35
26
  request: Optional[Request],
@@ -59,46 +50,10 @@ async def _invoke(
59
50
  obj = getattr(ctx, "obj", None)
60
51
  if obj is not None:
61
52
  ctx.model = type(obj)
62
- if getattr(ctx, "opview", None) is None:
63
- model = getattr(ctx, "model", None)
64
- alias = getattr(ctx, "op", None)
65
- specs = ctx.get("specs")
66
- if (
67
- isinstance(model, type)
68
- and isinstance(alias, str)
69
- and isinstance(specs, Mapping)
70
- ):
71
- try:
72
- cached_views = getattr(model, _OPVIEW_CACHE_ATTR, None)
73
- if not isinstance(cached_views, dict):
74
- cached_views = {}
75
- setattr(model, _OPVIEW_CACHE_ATTR, cached_views)
76
-
77
- cached_view = cached_views.get(alias)
78
- if cached_view is not None:
79
- ctx.opview = cached_view
80
- else:
81
- from tigrbl_kernel.opview_compiler import compile_opview_from_specs
82
-
83
- op_spec = next(
84
- (
85
- sp
86
- for sp in (
87
- getattr(getattr(model, "ops", None), "all", ()) or ()
88
- )
89
- if getattr(sp, "alias", None) == alias
90
- ),
91
- None,
92
- )
93
- if op_spec is None:
94
- op_spec = SimpleNamespace(alias=alias)
95
- compiled_view = compile_opview_from_specs(specs, op_spec)
96
- cached_views[alias] = compiled_view
97
- ctx.opview = compiled_view
98
- except Exception:
99
- pass
100
53
  skip_persist: bool = bool(ctx.get(CTX_SKIP_PERSIST_FLAG) or ctx.get("skip_persist"))
54
+ skip_ingress: bool = bool(ctx.get("skip_ingress"))
101
55
  skip_egress: bool = bool(ctx.get("skip_egress"))
56
+ skip_post_commit: bool = bool(ctx.get("skip_post_commit"))
102
57
  if not callable(ctx.get("rpc_error_builder")):
103
58
  ctx["rpc_error_builder"] = lambda exc: to_rpc_error_payload(
104
59
  create_standardized_error(exc)
@@ -156,15 +111,16 @@ async def _invoke(
156
111
  return
157
112
  raise create_standardized_error(exc)
158
113
 
159
- await _run_phase(
160
- "INGRESS_BEGIN", allow_flush=False, allow_commit=False, in_tx=False
161
- )
162
- await _run_phase(
163
- "INGRESS_PARSE", allow_flush=False, allow_commit=False, in_tx=False
164
- )
165
- await _run_phase(
166
- "INGRESS_ROUTE", allow_flush=False, allow_commit=False, in_tx=False
167
- )
114
+ if not skip_ingress:
115
+ await _run_phase(
116
+ "INGRESS_BEGIN", allow_flush=False, allow_commit=False, in_tx=False
117
+ )
118
+ await _run_phase(
119
+ "INGRESS_PARSE", allow_flush=False, allow_commit=False, in_tx=False
120
+ )
121
+ await _run_phase(
122
+ "INGRESS_ROUTE", allow_flush=False, allow_commit=False, in_tx=False
123
+ )
168
124
  await _run_phase("PRE_TX_BEGIN", allow_flush=False, allow_commit=False, in_tx=False)
169
125
 
170
126
  if not skip_persist:
@@ -231,7 +187,6 @@ async def _invoke(
231
187
  current_result = getattr(ctx, "obj", None)
232
188
 
233
189
  current_result = _unwrap_ctx_result(current_result)
234
- current_result = await _crud_result_fallback(ctx, current_result)
235
190
 
236
191
  if isinstance(rpc_error, Mapping):
237
192
  ctx["result"] = None
@@ -254,7 +209,10 @@ async def _invoke(
254
209
  else:
255
210
  setattr(response_obj, "result", ctx.get("result"))
256
211
 
257
- await _run_phase("POST_COMMIT", allow_flush=True, allow_commit=False, in_tx=False)
212
+ if not skip_post_commit:
213
+ await _run_phase(
214
+ "POST_COMMIT", allow_flush=True, allow_commit=False, in_tx=False
215
+ )
258
216
 
259
217
  if not skip_egress:
260
218
  await _run_phase(
@@ -321,56 +279,4 @@ async def _invoke(
321
279
  ctx["result"] = result
322
280
  return result
323
281
 
324
-
325
- async def invoke_op(
326
- *,
327
- request: Any = None,
328
- db: Any = None,
329
- model: type,
330
- alias: str,
331
- ctx: Optional[MutableMapping[str, Any]] = None,
332
- ) -> Any:
333
- """Resolve phases and execute an operation through runtime invocation."""
334
- seed_ctx: MutableMapping[str, Any] = dict(ctx or {})
335
- seed_ctx.setdefault("model", model)
336
- seed_ctx.setdefault("op", alias)
337
- seed_ctx.setdefault("method", alias)
338
- if request is not None:
339
- seed_ctx.setdefault("request", request)
340
- if db is not None:
341
- seed_ctx.setdefault("db", db)
342
- if seed_ctx.get("env") is None:
343
- seed_ctx["env"] = SimpleNamespace(method=alias)
344
- seed_ctx.setdefault("skip_egress", True)
345
-
346
- app_ref = (
347
- getattr(request, "app", None)
348
- or seed_ctx.get("app")
349
- or seed_ctx.get("router")
350
- or model
351
- )
352
- seed_ctx.setdefault("app", app_ref)
353
- seed_ctx.setdefault("router", seed_ctx.get("router") or app_ref)
354
-
355
- if seed_ctx.get("specs") is None:
356
- specs = get_cached_specs(model)
357
- if specs is not None:
358
- seed_ctx["specs"] = specs
359
-
360
- if seed_ctx.get("opview") is None:
361
- try:
362
- seed_ctx["opview"] = _default_kernel.get_opview(app_ref, model, alias)
363
- except Exception:
364
- # Some call paths rely only on specs/schemas and can proceed without
365
- # a compiled opview.
366
- pass
367
-
368
- return await _invoke(
369
- request=request,
370
- db=db,
371
- phases=resolve_phase_chains(model, alias),
372
- ctx=seed_ctx,
373
- )
374
-
375
-
376
- __all__ = ["_invoke", "resolve_phase_chains", "invoke_op"]
282
+ __all__ = ["_invoke"]
@@ -10,15 +10,18 @@ from tigrbl_runtime.executors import (
10
10
  NumbaPackedPlanExecutor,
11
11
  PackedPlanExecutor,
12
12
  )
13
- from tigrbl_runtime.rust import (
14
- ExecutionBackend,
15
- RustBackendConfig,
16
- reject_rust_backend,
17
- RustBindingsUnavailableError,
18
- )
19
13
  from .base import RuntimeBase
20
14
 
21
15
 
16
+ def _normalize_execution_backend(value: Any) -> str:
17
+ lowered = str(value or "auto").strip().lower()
18
+ if not lowered:
19
+ return "auto"
20
+ if lowered in {"auto", "python"}:
21
+ return lowered
22
+ raise ValueError(f"unsupported execution backend: {value!r}")
23
+
24
+
22
25
  class Runtime(RuntimeBase):
23
26
  """Runtime orchestrator for kernel + executors."""
24
27
 
@@ -27,30 +30,16 @@ class Runtime(RuntimeBase):
27
30
  kernel: Kernel | None = None,
28
31
  *,
29
32
  default_executor: str = "packed",
30
- kernel_backend: str | ExecutionBackend = ExecutionBackend.AUTO,
31
- atoms_backend: str | ExecutionBackend = ExecutionBackend.AUTO,
32
- executor_backend: str | ExecutionBackend = ExecutionBackend.PYTHON,
33
- rust_backend: RustBackendConfig | None = None,
33
+ kernel_backend: str = "auto",
34
+ atoms_backend: str = "auto",
35
+ executor_backend: str = "python",
34
36
  ) -> None:
35
37
  resolved_kernel = kernel if kernel is not None else _kernel()
36
38
  super().__init__(kernel=resolved_kernel)
37
39
  self.default_executor = default_executor
38
- self.kernel_backend = reject_rust_backend(
39
- kernel_backend,
40
- label="kernel_backend",
41
- )
42
- self.atoms_backend = reject_rust_backend(
43
- atoms_backend,
44
- label="atoms_backend",
45
- )
46
- self.executor_backend = reject_rust_backend(
47
- executor_backend,
48
- label="executor_backend",
49
- )
50
- self.rust_backend = rust_backend or RustBackendConfig(
51
- backend=self.executor_backend
52
- )
53
- reject_rust_backend(self.rust_backend, label="rust_backend")
40
+ self.kernel_backend = _normalize_execution_backend(kernel_backend)
41
+ self.atoms_backend = _normalize_execution_backend(atoms_backend)
42
+ self.executor_backend = _normalize_execution_backend(executor_backend)
54
43
  self.register_executor(PackedPlanExecutor())
55
44
  self.register_executor(NumbaPackedPlanExecutor())
56
45
 
@@ -66,36 +55,6 @@ class Runtime(RuntimeBase):
66
55
  except Exception:
67
56
  return 0
68
57
 
69
- def _uses_rust_executor(self) -> bool:
70
- return False
71
-
72
- def _compile_rust(self, app: Any) -> tuple[Any, Any]:
73
- del app
74
- raise RustBindingsUnavailableError(
75
- "Runtime._compile_rust is unavailable. "
76
- "Tigrbl runtime execution is Python-only."
77
- )
78
-
79
- def rust_handle(self, app: Any) -> Any:
80
- del app
81
- raise RustBindingsUnavailableError(
82
- "Runtime.rust_handle is unavailable. "
83
- "Tigrbl runtime execution is Python-only."
84
- )
85
-
86
- def execute_rust(
87
- self,
88
- envelope: Any,
89
- *,
90
- app: Any | None = None,
91
- handle: Any | None = None,
92
- ) -> dict[str, Any]:
93
- del envelope, app, handle
94
- raise RustBindingsUnavailableError(
95
- "Runtime.execute_rust is unavailable. "
96
- "Tigrbl runtime execution is Python-only."
97
- )
98
-
99
58
  def compile(self, *args: Any, **kwargs: Any) -> tuple[Any, Any | None]:
100
59
  if args:
101
60
  app = args[0]
@@ -1,30 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Any
4
-
5
- from .invoke import _invoke
6
- from .types import _Ctx
7
- from tigrbl_typing.phases import canonicalize_phase_input as normalize_phase
8
-
9
-
10
- async def _run(
11
- self,
12
- model: type,
13
- alias: str,
14
- *,
15
- db: Any,
16
- request: Any | None = None,
17
- ctx: Any | None = None,
18
- ) -> Any:
19
- phases = self._build_op(model, alias)
20
- base_ctx = _Ctx.ensure(request=request, db=db, seed=ctx)
21
- return await _invoke(request=request, db=db, phases=phases, ctx=base_ctx)
22
-
23
-
24
- async def _run_phase_chain(self, ctx: _Ctx, phases: Any) -> None:
25
- for _phase, steps in (phases or {}).items():
26
- ctx.phase = normalize_phase(_phase)
27
- for step in steps or ():
28
- rv = step(ctx)
29
- if hasattr(rv, "__await__"):
30
- await rv
@@ -1,19 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import dataclass, field
4
- from typing import Any
5
- import warnings
6
-
7
-
8
- @dataclass(slots=True)
9
- class RustRuntimeHandleRef:
10
- description: str
11
- backend: str = "deprecated-rust"
12
- metadata: dict[str, Any] = field(default_factory=dict)
13
-
14
- def __post_init__(self) -> None:
15
- warnings.warn(
16
- "RustRuntimeHandleRef is deprecated; Tigrbl runtime execution is Python-only.",
17
- DeprecationWarning,
18
- stacklevel=2,
19
- )
@@ -1,67 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from .backend import (
4
- ExecutionBackend,
5
- RustBackendConfig,
6
- coerce_execution_backend,
7
- reject_rust_backend,
8
- wants_rust_backend,
9
- )
10
- from .callbacks import (
11
- register_python_atom,
12
- register_python_callback,
13
- register_python_engine,
14
- register_python_handler,
15
- register_python_hook,
16
- registered_python_callbacks,
17
- )
18
- from .codec import (
19
- build_rust_app_spec,
20
- coerce_rust_spec_dict,
21
- coerce_rust_spec_json,
22
- )
23
- from .compile import compile_app, normalize_spec
24
- from .request import RustRequest
25
- from .response import RustResponse
26
- from .errors import RustBindingsUnavailableError, RustSupportDeprecatedError
27
- from .runtime import (
28
- RustRuntimeHandle,
29
- create_runtime,
30
- create_runtime_from_compiled,
31
- )
32
- from .trace import (
33
- clear_ffi_boundary_events,
34
- compiled_extension_available,
35
- ffi_boundary_events,
36
- rust_available,
37
- )
38
-
39
- __all__ = [
40
- "ExecutionBackend",
41
- "RustBackendConfig",
42
- "RustBindingsUnavailableError",
43
- "RustSupportDeprecatedError",
44
- "RustRequest",
45
- "RustResponse",
46
- "RustRuntimeHandle",
47
- "build_rust_app_spec",
48
- "clear_ffi_boundary_events",
49
- "coerce_rust_spec_dict",
50
- "coerce_rust_spec_json",
51
- "coerce_execution_backend",
52
- "compile_app",
53
- "compiled_extension_available",
54
- "create_runtime",
55
- "create_runtime_from_compiled",
56
- "ffi_boundary_events",
57
- "rust_available",
58
- "normalize_spec",
59
- "register_python_atom",
60
- "register_python_callback",
61
- "register_python_engine",
62
- "register_python_handler",
63
- "register_python_hook",
64
- "registered_python_callbacks",
65
- "reject_rust_backend",
66
- "wants_rust_backend",
67
- ]
@@ -1,73 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Any
4
-
5
- from .errors import raise_rust_deprecated, warn_rust_deprecated
6
-
7
- _BOUNDARY_EVENTS: list[dict[str, Any]] = []
8
-
9
-
10
- def ffi_boundary_events() -> list[dict[str, Any]]:
11
- warn_rust_deprecated()
12
- return [dict(item) for item in _BOUNDARY_EVENTS]
13
-
14
-
15
- def clear_ffi_boundary_events() -> None:
16
- warn_rust_deprecated()
17
- _BOUNDARY_EVENTS.clear()
18
-
19
-
20
- def rust_available() -> bool:
21
- warn_rust_deprecated()
22
- return False
23
-
24
-
25
- def compiled_extension_available() -> bool:
26
- warn_rust_deprecated()
27
- return False
28
-
29
-
30
- def normalize_spec(spec_json: str) -> str:
31
- del spec_json
32
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.normalize_spec")
33
-
34
-
35
- def compile_spec(spec_json: str) -> str:
36
- del spec_json
37
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.compile_spec")
38
-
39
-
40
- class RuntimeHandle:
41
- def __init__(self, plan_json_payload: str) -> None:
42
- del plan_json_payload
43
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.RuntimeHandle")
44
-
45
-
46
- def create_runtime_handle(plan_json: str) -> RuntimeHandle:
47
- del plan_json
48
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.create_runtime_handle")
49
-
50
-
51
- def register_python_callback(name: str, *_args: Any, **_kwargs: Any) -> str:
52
- del name
53
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.register_python_callback")
54
-
55
-
56
- def register_python_atom(name: str, *_args: Any, **_kwargs: Any) -> str:
57
- del name
58
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.register_python_atom")
59
-
60
-
61
- def register_python_hook(name: str, *_args: Any, **_kwargs: Any) -> str:
62
- del name
63
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.register_python_hook")
64
-
65
-
66
- def register_python_handler(name: str, *_args: Any, **_kwargs: Any) -> str:
67
- del name
68
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.register_python_handler")
69
-
70
-
71
- def register_python_engine(name: str, *_args: Any, **_kwargs: Any) -> str:
72
- del name
73
- raise_rust_deprecated("tigrbl_runtime.rust._fallback.register_python_engine")
@@ -1,22 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from types import ModuleType
4
-
5
- from .errors import RUST_DEPRECATION_MESSAGE
6
-
7
-
8
- _LOADED: ModuleType | None = None
9
- _IMPORT_ERROR: Exception | None = None
10
-
11
-
12
- def load_rust_module() -> tuple[ModuleType, Exception | None]:
13
- global _LOADED, _IMPORT_ERROR
14
-
15
- if _LOADED is not None:
16
- return _LOADED, _IMPORT_ERROR
17
-
18
- from . import _fallback as module
19
-
20
- _LOADED = module
21
- _IMPORT_ERROR = RuntimeError(RUST_DEPRECATION_MESSAGE)
22
- return _LOADED, _IMPORT_ERROR
@@ -1,5 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from .trace import compiled_extension_available, rust_available
4
-
5
- __all__ = ["compiled_extension_available", "rust_available"]
@@ -1,62 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import dataclass
4
- from enum import Enum
5
-
6
- from .errors import raise_rust_deprecated, warn_rust_deprecated
7
-
8
-
9
- class ExecutionBackend(str, Enum):
10
- AUTO = "auto"
11
- PYTHON = "python"
12
- RUST = "rust"
13
-
14
-
15
- @dataclass(slots=True, frozen=True)
16
- class RustBackendConfig:
17
- backend: ExecutionBackend = ExecutionBackend.AUTO
18
- allow_python_callbacks: bool = True
19
- emit_boundary_trace: bool = False
20
- strict_rust: bool = False
21
-
22
-
23
- def coerce_execution_backend(value: str | ExecutionBackend | None) -> ExecutionBackend:
24
- if isinstance(value, ExecutionBackend):
25
- if value is ExecutionBackend.RUST:
26
- warn_rust_deprecated()
27
- return value
28
- if value is None:
29
- return ExecutionBackend.AUTO
30
- lowered = str(value).strip().lower()
31
- for item in ExecutionBackend:
32
- if item.value == lowered:
33
- if item is ExecutionBackend.RUST:
34
- warn_rust_deprecated()
35
- return item
36
- raise ValueError(f"unsupported execution backend: {value!r}")
37
-
38
-
39
- def wants_rust_backend(value: str | ExecutionBackend | RustBackendConfig | None) -> bool:
40
- if isinstance(value, RustBackendConfig):
41
- backend = value.backend
42
- else:
43
- backend = coerce_execution_backend(value)
44
- if backend is ExecutionBackend.RUST:
45
- warn_rust_deprecated()
46
- return False
47
-
48
-
49
- def reject_rust_backend(
50
- value: str | ExecutionBackend | RustBackendConfig | None,
51
- *,
52
- label: str,
53
- ) -> ExecutionBackend:
54
- if isinstance(value, RustBackendConfig):
55
- if value.strict_rust:
56
- raise_rust_deprecated(f"{label}.strict_rust")
57
- backend = value.backend
58
- else:
59
- backend = coerce_execution_backend(value)
60
- if backend is ExecutionBackend.RUST:
61
- raise_rust_deprecated(label)
62
- return backend
@@ -1,43 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from collections.abc import Callable
4
- from typing import Any
5
-
6
- from .errors import raise_rust_deprecated
7
- from .trace import record_python_ffi_event
8
-
9
- _REGISTRY: dict[str, Callable[..., Any]] = {}
10
-
11
-
12
- def registered_python_callbacks() -> dict[str, Callable[..., Any]]:
13
- return dict(_REGISTRY)
14
-
15
-
16
- def register_python_callback(name: str, callback: Callable[..., Any]) -> str:
17
- del callback
18
- record_python_ffi_event("rust_callback_deprecated", name=name)
19
- raise_rust_deprecated("tigrbl_runtime.rust.register_python_callback")
20
-
21
-
22
- def register_python_atom(name: str, callback: Callable[..., Any]) -> str:
23
- del callback
24
- record_python_ffi_event("rust_atom_deprecated", name=name)
25
- raise_rust_deprecated("tigrbl_runtime.rust.register_python_atom")
26
-
27
-
28
- def register_python_hook(name: str, callback: Callable[..., Any]) -> str:
29
- del callback
30
- record_python_ffi_event("rust_hook_deprecated", name=name)
31
- raise_rust_deprecated("tigrbl_runtime.rust.register_python_hook")
32
-
33
-
34
- def register_python_handler(name: str, callback: Callable[..., Any]) -> str:
35
- del callback
36
- record_python_ffi_event("rust_handler_deprecated", name=name)
37
- raise_rust_deprecated("tigrbl_runtime.rust.register_python_handler")
38
-
39
-
40
- def register_python_engine(name: str, callback: Callable[..., Any] | None = None) -> str:
41
- del callback
42
- record_python_ffi_event("rust_engine_deprecated", name=name)
43
- raise_rust_deprecated("tigrbl_runtime.rust.register_python_engine")
@@ -1,27 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Any
4
-
5
- from .errors import raise_rust_deprecated
6
-
7
-
8
- def build_rust_app_spec(app: Any) -> dict[str, Any]:
9
- del app
10
- raise_rust_deprecated("tigrbl_runtime.rust.codec.build_rust_app_spec")
11
-
12
-
13
- def coerce_rust_spec_dict(app: Any) -> dict[str, Any]:
14
- del app
15
- raise_rust_deprecated("tigrbl_runtime.rust.codec.coerce_rust_spec_dict")
16
-
17
-
18
- def coerce_rust_spec_json(app: Any) -> str:
19
- del app
20
- raise_rust_deprecated("tigrbl_runtime.rust.codec.coerce_rust_spec_json")
21
-
22
-
23
- __all__ = [
24
- "build_rust_app_spec",
25
- "coerce_rust_spec_dict",
26
- "coerce_rust_spec_json",
27
- ]
@@ -1,15 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from typing import Any
4
-
5
- from .errors import raise_rust_deprecated
6
-
7
-
8
- def normalize_spec(spec: Any) -> str:
9
- del spec
10
- raise_rust_deprecated("tigrbl_runtime.rust.normalize_spec")
11
-
12
-
13
- def compile_app(spec: Any) -> dict[str, Any]:
14
- del spec
15
- raise_rust_deprecated("tigrbl_runtime.rust.compile_app")
@@ -1,27 +0,0 @@
1
- from __future__ import annotations
2
-
3
- import warnings
4
- from typing import NoReturn
5
-
6
-
7
- RUST_DEPRECATION_MESSAGE = (
8
- "Tigrbl Rust runtime support is deprecated and unavailable; "
9
- "Tigrbl runtime execution is Python-only. Use executor_backend='python'."
10
- )
11
-
12
-
13
- class RustSupportDeprecatedError(RuntimeError):
14
- """Raised when deprecated Rust support is requested."""
15
-
16
-
17
- class RustBindingsUnavailableError(RustSupportDeprecatedError):
18
- """Raised when the deprecated Rust runtime binding surface is requested."""
19
-
20
-
21
- def warn_rust_deprecated(*, stacklevel: int = 2) -> None:
22
- warnings.warn(RUST_DEPRECATION_MESSAGE, DeprecationWarning, stacklevel=stacklevel)
23
-
24
-
25
- def raise_rust_deprecated(action: str) -> NoReturn:
26
- warn_rust_deprecated(stacklevel=3)
27
- raise RustBindingsUnavailableError(f"{action} is unavailable. {RUST_DEPRECATION_MESSAGE}")
@@ -1,27 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import asdict, dataclass, field
4
- from typing import Any
5
- import warnings
6
-
7
-
8
- @dataclass(slots=True)
9
- class RustRequest:
10
- operation: str = ""
11
- transport: str = "rest"
12
- path: str = ""
13
- method: str = ""
14
- path_params: dict[str, Any] = field(default_factory=dict)
15
- query_params: dict[str, Any] = field(default_factory=dict)
16
- headers: dict[str, str] = field(default_factory=dict)
17
- body: Any = None
18
-
19
- def __post_init__(self) -> None:
20
- warnings.warn(
21
- "RustRequest is deprecated; Tigrbl runtime execution is Python-only.",
22
- DeprecationWarning,
23
- stacklevel=2,
24
- )
25
-
26
- def asdict(self) -> dict[str, Any]:
27
- return asdict(self)
@@ -1,22 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import asdict, dataclass, field
4
- from typing import Any
5
- import warnings
6
-
7
-
8
- @dataclass(slots=True)
9
- class RustResponse:
10
- status: int = 200
11
- headers: dict[str, str] = field(default_factory=dict)
12
- body: Any = None
13
-
14
- def __post_init__(self) -> None:
15
- warnings.warn(
16
- "RustResponse is deprecated; Tigrbl runtime execution is Python-only.",
17
- DeprecationWarning,
18
- stacklevel=2,
19
- )
20
-
21
- def asdict(self) -> dict[str, Any]:
22
- return asdict(self)
@@ -1,62 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from dataclasses import dataclass
4
- from typing import Any
5
-
6
- from .errors import raise_rust_deprecated
7
-
8
-
9
- @dataclass(slots=True)
10
- class RustRuntimeHandle:
11
- _handle: Any = None
12
-
13
- def describe(self) -> str:
14
- raise_rust_deprecated("RustRuntimeHandle.describe")
15
-
16
- def plan(self) -> dict[str, object]:
17
- raise_rust_deprecated("RustRuntimeHandle.plan")
18
-
19
- def execute_rest(self, envelope: Any) -> dict[str, object]:
20
- del envelope
21
- raise_rust_deprecated("RustRuntimeHandle.execute_rest")
22
-
23
- def execute_jsonrpc(self, envelope: Any) -> dict[str, object]:
24
- del envelope
25
- raise_rust_deprecated("RustRuntimeHandle.execute_jsonrpc")
26
-
27
- def execute_ws(self, envelope: Any) -> dict[str, object]:
28
- del envelope
29
- raise_rust_deprecated("RustRuntimeHandle.execute_ws")
30
-
31
- def execute_stream(self, envelope: Any) -> dict[str, object]:
32
- del envelope
33
- raise_rust_deprecated("RustRuntimeHandle.execute_stream")
34
-
35
- def execute_sse(self, envelope: Any) -> dict[str, object]:
36
- del envelope
37
- raise_rust_deprecated("RustRuntimeHandle.execute_sse")
38
-
39
- def begin_request(self, transport: str = "rest") -> None:
40
- del transport
41
- raise_rust_deprecated("RustRuntimeHandle.begin_request")
42
-
43
- def callback_fence(self, kind: str, name: str) -> None:
44
- del kind, name
45
- raise_rust_deprecated("RustRuntimeHandle.callback_fence")
46
-
47
- def finish_response(self, transport: str = "rest") -> None:
48
- del transport
49
- raise_rust_deprecated("RustRuntimeHandle.finish_response")
50
-
51
- def ffi_events(self) -> list[dict[str, object]]:
52
- raise_rust_deprecated("RustRuntimeHandle.ffi_events")
53
-
54
-
55
- def create_runtime_from_compiled(plan: Any) -> RustRuntimeHandle:
56
- del plan
57
- raise_rust_deprecated("tigrbl_runtime.rust.create_runtime_from_compiled")
58
-
59
-
60
- def create_runtime(spec: Any) -> RustRuntimeHandle:
61
- del spec
62
- raise_rust_deprecated("tigrbl_runtime.rust.create_runtime")
@@ -1,29 +0,0 @@
1
- from __future__ import annotations
2
-
3
- from .errors import warn_rust_deprecated
4
-
5
- _PYTHON_FFI_EVENTS: list[dict[str, object]] = []
6
-
7
-
8
- def ffi_boundary_events() -> list[dict[str, object]]:
9
- warn_rust_deprecated()
10
- return list(_PYTHON_FFI_EVENTS)
11
-
12
-
13
- def clear_ffi_boundary_events() -> None:
14
- warn_rust_deprecated()
15
- _PYTHON_FFI_EVENTS.clear()
16
-
17
-
18
- def record_python_ffi_event(event: str, **payload: object) -> None:
19
- _PYTHON_FFI_EVENTS.append({"event": event, **payload})
20
-
21
-
22
- def rust_available() -> bool:
23
- warn_rust_deprecated()
24
- return False
25
-
26
-
27
- def compiled_extension_available() -> bool:
28
- warn_rust_deprecated()
29
- return False