Coverage for src/lumen/__init__.py: 75%

8 statements  

« prev     ^ index     » next       coverage.py v7.16.0, created at 2026-08-31 18:46 +0000

1""" 

2This is the main root package for the Lumen FHIR server. 

3It defines the top-level structure of the application. 

4 

5``lumen.register_plugin`` is exposed here so that a session running inside the 

6server process — a Jupyter kernel in the Lumen container, a test — can attach a 

7plugin with a single call. In production, plugins come from configuration 

8(``LUMEN_CORTEX_PLUGINS``); see :mod:`lumen.cortex.loader`. 

9 

10It is resolved lazily: importing any submodule of ``lumen`` must not drag the 

11plugin host, the API layer and the database pool in with it. 

12""" 

13 

14from typing import TYPE_CHECKING, Any 

15 

16if TYPE_CHECKING: 

17 from .cortex.runtime import register_plugin, unregister_plugin 

18 

19__all__ = ["register_plugin", "unregister_plugin"] 

20 

21_LAZY = {"register_plugin", "unregister_plugin"} 

22 

23 

24def __getattr__(name: str) -> Any: 

25 if name in _LAZY: 

26 from .cortex import runtime 

27 

28 return getattr(runtime, name) 

29 raise AttributeError(f"module 'lumen' has no attribute {name!r}")