Coverage for src/endow/base.py: 100%
12 statements
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-09 19:20 +0200
« prev ^ index » next coverage.py v7.14.1, created at 2026-06-09 19:20 +0200
1"""Base injectable types used by the dependency graph runtime."""
3from __future__ import annotations
5import typing as t
8class Injectable:
9 """Base class for objects that participate in endow graph wiring."""
11 @classmethod
12 def with_injected(cls, **kw: t.Any) -> t.Self:
13 """Build an injectable instance using the runtime graph."""
14 from .runtime import build_graph
16 return build_graph(cls, kw)
18 @classmethod
19 def build(cls, **kw: t.Any) -> t.Self:
20 """Backward-compatible alias for building an injected instance."""
21 return cls.with_injected(**kw)
24class Service(Injectable):
25 """Infrastructure capability resolved by the runtime."""
28class Domain(Injectable):
29 """Domain component resolved by the runtime."""