neofoam.framework.initialization.depends¶
Dependency marker used with typing.Annotated for injection.
- class neofoam.framework.initialization.depends.Depends(dependency: str | Callable[[...], Any], *, scope: str = 'time_step', cache: bool = True, optional: bool = False)[source]¶
Bases:
objectDeclare a dependency for DI-enabled callables.
Supported usage includes initializer injection, e.g.:
@solver.initializer def initialize(
init: Annotated[StagedInitRunner, Depends(create_init)],
- ) -> Context:
return init.run()