koi_net.infra.component
Defines decorators for manipulating component metadata, informing the assembly process.
Functions
|
Decorator that declares the dependencies of a start or stop method in a component class. |
|
Decorator for a component that overrides its type. |
Classes
|
Defines component types. |
- class koi_net.infra.component.CompType(*values)[source]
Bases:
StrEnumDefines component types.
Singletons are callable components (typically classes) which need to be instantiated prior to use. They define their dependencies in their function signature (this is
__init__for classes).Objects are constant components that are simply passed “as is.”
- OBJECT = 'OBJECT'
- SINGLETON = 'SINGLETON'
- koi_net.infra.component.depends_on(*components)[source]
Decorator that declares the dependencies of a start or stop method in a component class.
Example:
from koi_net.infra import depends_on class MyComponent: @depends_on("another_component") def start(self): ...
- koi_net.infra.component.provides(component_type)[source]
Decorator for a component that overrides its type.
This is typically used to pass a class “as is.” Example:
from koi_net.infra import provides, CompType @provides(CompType.OBJECT) class MyClassComponent: ...
- Parameters:
component_type (CompType)