Reference
Modules and runtime API¶
hinoki.modules.Module ¶
Base class for modules. Override lifespan to own resources.
from_settings
classmethod
¶
from_settings(settings: object) -> Module
Build the module from the application's settings. Override it to make
Hinoki(modules=[YourModule]) work; the default says it is not supported.
hinoki.modules.ModuleContext ¶
ModuleContext(settings: object | None = None)
Per-worker context handed to module lifespans.
provide/get is a typed, explicit registry — not a global service
locator: one instance per worker, keyed by type.
hinoki.management.Command ¶
A project command with explicit arguments and module requirements.
Set name and optionally help/requires on a subclass. Override
add_arguments to define CLI arguments and handle to execute the
command. A synchronous or asynchronous handle is supported.
hinoki.management.CommandContext ¶
CommandContext(
settings: object | None, modules: ModuleContext
)
Settings and resources available during one command invocation.
hinoki.management.CommandError ¶
Bases: Exception
The command could not start or returned an invalid result.
hinoki.runtime.config.RuntimeConfig
dataclass
¶
RuntimeConfig(
sync_workers: int = 8,
sync_queue: int = 64,
request_timeout: float = 30.0,
startup_timeout: float = 30.0,
shutdown_timeout: float = 10.0,
max_body_bytes: int = 1024 * 1024,
max_query_bytes: int = 8192,
max_header_bytes: int = 32768,
)
hinoki.errors.ModuleGraphError ¶
Bases: RegistrationError
Missing dependency, dependency cycle or duplicate module name.
hinoki.errors.RegistrationError ¶
Bases: Exception
Invalid or conflicting declarations, raised before the app serves.