Coverage for src/lexigram/admin/integrations/__init__.py: 100%
8 statements
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:56 +0800
« prev ^ index » next coverage.py v7.15.4, created at 2026-08-21 14:56 +0800
1"""Optional integration adapters for lexigram-* extension packages.
3Each submodule provides a ``*Integration`` class that consumes a protocol
4from ``lexigram-contracts`` and either delegates to the real extension or
5provides a graceful no-op when the extension is not installed.
7The module-level ``_registry`` dict is populated at boot time by
8``AdminIntegrationsSubProvider.boot()`` so that consumers (e.g.
9``ListRenderer``) can resolve integrations without deep constructor plumbing.
10"""
12from __future__ import annotations
14from typing import Any
16_registry: dict[str, Any] = {}
19def register(name: str, instance: Any) -> None:
20 """Register an integration instance for lazy access by consumers."""
21 _registry[name] = instance
24def get(name: str) -> Any:
25 """Return a registered integration instance, or None."""
26 return _registry.get(name)
29__all__ = [
30 "get",
31 "register",
32]