Provider API¶
Provider¶
@dataclass(frozen=True)
class Provider:
provide: type
use_class: type | None = None
use_factory: Callable[[Container], Any] | None = None
use_value: Any = _MISSING
scope: Scope = Scope.SINGLETON
Exactly one of use_class, use_factory, or use_value must be specified. Raises ValueError otherwise.
Scope¶
Default is SINGLETON.
ForwardRef¶
Lazy module reference resolved by ApplicationContext at boot.
forward_ref¶
Create a forward reference to a module by name. Use in Module.imports to avoid circular Python imports.