trance 0.1.0__py3-none-any.whl

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.
trance/__init__.py ADDED
@@ -0,0 +1,36 @@
1
+ """Discover local model sessions and expose them through a stable API.
2
+
3
+ The package root intentionally avoids importing discovery and model adapters
4
+ until a caller uses them. This keeps a plain ``import trance`` inexpensive.
5
+ """
6
+
7
+ from __future__ import annotations
8
+
9
+ from importlib import import_module
10
+ from typing import Any
11
+
12
+ __version__ = "0.1.0"
13
+
14
+ _EXPORTS = {
15
+ "scan": ("trance.discovery", "scan"),
16
+ "clients": ("trance.discovery", "clients"),
17
+ "Candidate": ("trance.types", "Candidate"),
18
+ "FoundModel": ("trance.types", "FoundModel"),
19
+ }
20
+
21
+ __all__ = ["__version__", *_EXPORTS]
22
+
23
+
24
+ def __getattr__(name: str) -> Any:
25
+ """Load public API objects only when requested."""
26
+ try:
27
+ module_name, attribute = _EXPORTS[name]
28
+ except KeyError:
29
+ raise AttributeError(f"module {__name__!r} has no attribute {name!r}") from None
30
+ value = getattr(import_module(module_name), attribute)
31
+ globals()[name] = value
32
+ return value
33
+
34
+
35
+ def __dir__() -> list[str]:
36
+ return sorted(set(globals()) | set(__all__))