harp.config.applications¶
- class Application[source]¶
Bases:
object- __init__(*, on_bind=None, on_bound=None, on_ready=None, on_shutdown=None, settings_type=None, dependencies=None)[source]¶
- Parameters:
on_bind (Callable[[OnBindEvent], Awaitable[None]])
on_bound (Callable[[OnBoundEvent], Awaitable[None]])
on_ready (Callable[[OnReadyEvent], Awaitable[None]])
on_shutdown (Callable[[OnShutdownEvent], Awaitable[None]])
settings_type (Type)
- has_application_settings_mixin()[source]¶
Check if settings_type has ApplicationSettingsMixin in its inheritance chain.
- on_bind: Callable[[OnBindEvent], Awaitable[None]] = None¶
Placeholder for factory bind event, happening before the container is built. If set, it will be attached to the factory dispatcher automatically.
- on_bound: Callable[[OnBoundEvent], Awaitable[None]] = None¶
Placeholder for factory bound event, happening after the container is built. If set, it will be attached to the factory dispatcher automatically.
- on_ready: Callable[[OnReadyEvent], Awaitable[None]] = None¶
Placeholder for factory build event, happening after the kernel is built. If set, it will be attached to the factory dispatcher automatically.
- on_shutdown: Callable[[OnShutdownEvent], Awaitable[None]] = None¶
Placeholder for factory dispose event, happening after the kernel is disposed. If set, it will be attached to the factory dispatcher automatically, in reverse order of appearance (first loaded application will be disposed last).
- class ApplicationsRegistry[source]¶
Bases:
object- add(*names, autoload_dependencies=False)[source]¶
Add applications to the registry.
- Args:
*names: Application names to add autoload_dependencies: If True, automatically add declared dependencies.
Defaults to False for backward compatibility.
- Parameters:
autoload_dependencies (bool)
- get_application(name)[source]¶
Returns the application class for the given application name.
todo: add name/full_name attributes with raise if already set to different value ?
- Parameters:
name (str)
- Returns:
- Return type:
- register_events(dispatcher)[source]¶
- Parameters:
dispatcher (IAsyncEventDispatcher)
- resolve_dependencies()[source]¶
Reorder applications based on dependency order using topological sort.
- namespaces = ['harp_apps']¶
- applications = {}¶
Cache for applications