tigrbl-base 0.4.3__tar.gz → 0.4.4.dev1__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 (38) hide show
  1. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/PKG-INFO +1 -1
  2. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/pyproject.toml +1 -1
  3. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_schema_base.py +33 -0
  4. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_table_base.py +5 -0
  5. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/LICENSE +0 -0
  6. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/NOTICE +0 -0
  7. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/README.md +0 -0
  8. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/__init__.py +0 -0
  9. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_alias_base.py +0 -0
  10. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_app_base.py +0 -0
  11. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_assembly.py +0 -0
  12. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_binding_base.py +0 -0
  13. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_column_base.py +0 -0
  14. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_datatype_lowering.py +0 -0
  15. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_engine_base.py +0 -0
  16. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_engine_provider_base.py +0 -0
  17. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_headers_base.py +0 -0
  18. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_hook_base.py +0 -0
  19. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_mapping_access.py +0 -0
  20. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_middleware_base.py +0 -0
  21. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_op_base.py +0 -0
  22. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_request_base.py +0 -0
  23. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_response_base.py +0 -0
  24. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_rest_map.py +0 -0
  25. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_router_base.py +0 -0
  26. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_rpc_map.py +0 -0
  27. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_security_base.py +0 -0
  28. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_session_abc.py +0 -0
  29. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_session_base.py +0 -0
  30. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_storage.py +0 -0
  31. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/_base/_table_registry_base.py +0 -0
  32. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/column/__init__.py +0 -0
  33. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/column/infer/__init__.py +0 -0
  34. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/column/infer/core.py +0 -0
  35. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/column/infer/jsonhints.py +0 -0
  36. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/column/infer/planning.py +0 -0
  37. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/column/infer/types.py +0 -0
  38. {tigrbl_base-0.4.3 → tigrbl_base-0.4.4.dev1}/tigrbl_base/column/infer/utils.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: tigrbl-base
3
- Version: 0.4.3
3
+ Version: 0.4.4.dev1
4
4
  Summary: Base contract package for Tigrbl apps, routers, tables, sessions, middleware, requests, responses, bindings, and engine interfaces.
5
5
  License: Apache License
6
6
  Version 2.0, January 2004
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "tigrbl-base"
3
- version = "0.4.3"
3
+ version = "0.4.4.dev1"
4
4
  description = "Base contract package for Tigrbl apps, routers, tables, sessions, middleware, requests, responses, bindings, and engine interfaces."
5
5
  readme = "README.md"
6
6
  license = { file = "LICENSE" }
@@ -9,6 +9,39 @@ from tigrbl_core.config.constants import TIGRBL_SCHEMA_DECLS_ATTR
9
9
  class SchemaBase:
10
10
  """Shared schema helpers used by concrete schema wrappers."""
11
11
 
12
+ @staticmethod
13
+ def bind_declared_schema(
14
+ model: type, alias: str, kind: str, schema_cls: type
15
+ ) -> None:
16
+ """Expose a declared schema on ``model.schemas.<alias>`` immediately."""
17
+
18
+ if kind not in ("in", "out"):
19
+ raise ValueError("schema_ctx(kind=...) must be 'in' or 'out'")
20
+
21
+ schemas = getattr(model, "schemas", None)
22
+ if not isinstance(schemas, SimpleNamespace):
23
+ schemas = SimpleNamespace()
24
+ setattr(model, "schemas", schemas)
25
+
26
+ alias_ns = getattr(schemas, alias, None)
27
+ if not isinstance(alias_ns, SimpleNamespace):
28
+ alias_ns = SimpleNamespace()
29
+ setattr(schemas, alias, alias_ns)
30
+
31
+ setattr(alias_ns, "in_" if kind == "in" else "out", schema_cls)
32
+
33
+ @classmethod
34
+ def bind_nested_declarations(cls, model: type) -> None:
35
+ """Bind nested ``schema_ctx`` declarations onto a table/model class."""
36
+
37
+ for obj in tuple(model.__dict__.values()):
38
+ if not inspect.isclass(obj):
39
+ continue
40
+ decl = getattr(obj, "__tigrbl_schema_decl__", None)
41
+ if decl is None:
42
+ continue
43
+ cls.bind_declared_schema(model, decl.alias, decl.kind, obj)
44
+
12
45
  @classmethod
13
46
  def collect(cls, model: type) -> dict[str, dict[str, type]]:
14
47
  """Collect schema declarations from explicit mappings and decorator metadata."""
@@ -18,6 +18,7 @@ from tigrbl_core._spec.table_profile_spec import (
18
18
  TableProfileError,
19
19
  coerce_table_profile,
20
20
  )
21
+ from ._schema_base import SchemaBase
21
22
 
22
23
  # ──────────────────────────────────────────────────────────────────────────────
23
24
  # Helpers – type inference & SA type instantiation
@@ -521,6 +522,10 @@ class TableBase(DeclarativeBase):
521
522
  # 2) Let SQLAlchemy map the class (PK now exists)
522
523
  super().__init_subclass__(**kw)
523
524
 
525
+ # 2.3) Surface table-local schema_ctx declarations immediately without
526
+ # invoking full schema synthesis or runtime binding.
527
+ SchemaBase.bind_nested_declarations(cls)
528
+
524
529
  # 2.5) Surface ctx-only op declarations for lightweight introspection.
525
530
  has_decorated_ops = False
526
531
  if not hasattr(cls, "__tigrbl_ops__"):
File without changes
File without changes
File without changes