THE ORIONIS API
Build with clarity.
Explore the building blocks of an async-first Python framework. Every module, class, and method — connected, searchable, and ready to build with.
class Application(Container, IApplication): (source)
Constructor: Application(*args, **kwargs)
Configure the container and serve requests within one worker event loop.
Notes
Concurrent tasks share kernel initialization and provider startup locks. Mutable application state is not synchronized across threads or event loops. Python and RSGI special methods retain their protocol-defined names.
| Class Method | current |
Return the existing application without constructing or booting it. |
| Async Method | __asgi |
Handle ASGI lifespan startup and shutdown events. |
| Method | __assert |
Assert that configuration is mutable before modification. |
| Method | __assert |
Assert that the current Python version meets the minimum requirement. |
| Method | __boot |
Initialize application compilation and configuration caching. |
| Async Method | __boot |
Boot all pending eager service providers. |
| Async Method | __call__ |
Dispatch ASGI requests to the appropriate handler by scope type. |
| Method | __commit |
Lock configuration and mark application as initialized. |
| Method | __default |
Return the default bootstrap configuration. |
| Method | __discover |
Discover and register service providers from the providers folder. |
| Method | __ensure |
Initialize the bootstrap configuration with default values. |
| Method | __ensure |
Ensure default application paths are set in the bootstrap configuration. |
| Method | __ensure |
Ensure the providers registry structure is properly initialized. |
| Method | __get |
Retrieve a value from a nested dictionary using dot notation. |
| Async Method | __handle |
Handle an HTTP request using the configured disconnect policy. |
| Async Method | __handle |
Handle HTTP requests using the KernelHTTP in RSGI mode. |
| Method | __init__ |
Initialize the Application instance. |
| Async Method | __initialize |
Build and boot the CLI kernel once for concurrent commands. |
| Async Method | __initialize |
Build and boot the HTTP kernel once for concurrent first requests. |
| Method | __load |
Load and initialize application configuration and service providers. |
| Async Method | __load |
Load and return the configured CLI kernel instance. |
| Method | __load |
Load and merge the final configuration from dataclasses and custom config. |
| Method | __load |
Load and register core framework service providers. |
| Method | __load |
Merge custom configuration and dataclass defaults into the base config. |
| Async Method | __load |
Load and return the configured HTTP kernel instance. |
| Method | __load |
Load and register all service providers. |
| Method | __lock |
Deeply freeze and lock the application configuration. |
| Async Method | __on |
Execute shutdown callbacks for the application lifecycle. |
| Async Method | __on |
Execute startup callbacks for the application lifecycle. |
| Method | __persist |
Persist the compiled application state to cache. |
| Method | __resolve |
Resolve and validate routing file paths. |
| Method | __resolve |
Resolve and register all eager service providers. |
| Async Method | __rsgi__ |
Handle the RSGI protocol for incoming requests. |
| Method | __rsgi |
Execute the RSGI application shutdown lifecycle. |
| Method | __rsgi |
Initialize the RSGI application lifecycle and execute startup callbacks. |
| Method | __set |
Set a value in a nested dictionary using dot notation. |
| Method | __set |
Set system timezone and locale from application configuration. |
| Method | __store |
Store a deferred service provider instance in the deferred registry. |
| Method | __store |
Store an eager service provider instance in the eager registry. |
| Method | __store |
Store a service provider instance in the appropriate registry. |
| Method | __validate |
Validate and return a resolved Path object. |
| Method | __validate |
Validate that the provider class meets IServiceProvider requirements. |
| Async Method | boot |
Create the application and await eager providers for headless use. |
| Method | compile |
Compile the application with the specified caching and invalidation settings. |
| Method | config |
Get or set an application configuration value. |
| Method | create |
Bootstrap and initialize the application framework. |
| Async Method | get |
Retrieve the registered exception handler instance. |
| Method | get |
Retrieve the list of registered middleware classes. |
| Async Method | get |
Retrieve the currently registered scheduler instance. |
| Async Method | handle |
Handle a CLI command using the configured KernelCLI. |
| Method | is |
Determine if the application is running in debug mode. |
| Method | is |
Determine if the application is running in a production environment. |
| Method | on |
Register callbacks for a specific application lifespan event. |
| Method | path |
Retrieve an application path by key or return all paths. |
| Method | reset |
Reset the runtime configuration to a mutable copy of the bootstrap config. |
| Method | routing |
Retrieve routing file paths from configuration. |
| Method | under |
Determine if the application is currently in maintenance mode. |
| Method | with |
Configure application settings using keyword arguments. |
| Method | with |
Configure authentication subsystem using keyword arguments. |
| Method | with |
Configure the cache subsystem using keyword arguments. |
| Method | with |
Configure the database subsystem using keyword arguments. |
| Method | with |
Configure the filesystems subsystem using keyword arguments. |
| Method | with |
Configure the HTTP subsystem using keyword arguments. |
| Method | with |
Configure logging subsystem using keyword arguments. |
| Method | with |
Configure mail subsystem using keyword arguments. |
| Method | with |
Configure validated MCP limits and the explicit Origin allowlist. |
| Method | with |
Set and resolve application directory paths. |
| Method | with |
Configure the queue subsystem using keyword arguments. |
| Method | with |
Configure session subsystem using keyword arguments. |
| Method | with |
Configure the testing subsystem using keyword arguments. |
| Method | with |
Register a custom exception handler class for the application. |
| Method | with |
Register middleware for the application. |
| Method | with |
Register service providers for the application. |
| Method | with |
Configure separate routing files for each application protocol. |
| Method | with |
Register a custom scheduler class for the application. |
| Instance Variable | __base |
Undocumented |
| Instance Variable | __booted |
Undocumented |
| Instance Variable | __bootstrap |
Undocumented |
| Instance Variable | __cache |
Undocumented |
| Instance Variable | __compiled |
Undocumented |
| Instance Variable | __compiled |
Undocumented |
| Instance Variable | __compiled |
Undocumented |
| Instance Variable | __compiled |
Undocumented |
| Instance Variable | __compiled |
Undocumented |
| Instance Variable | __configured |
Undocumented |
| Instance Variable | __entry |
Undocumented |
| Instance Variable | __exception |
Undocumented |
| Instance Variable | __hook |
Undocumented |
| Instance Variable | __http |
Undocumented |
| Instance Variable | __http |
Undocumented |
| Instance Variable | __is |
Undocumented |
| Instance Variable | __is |
Undocumented |
| Instance Variable | __is |
Undocumented |
| Instance Variable | __kernel |
Undocumented |
| Instance Variable | __kernel |
Undocumented |
| Instance Variable | __kernel |
Undocumented |
| Instance Variable | __kernel |
Undocumented |
| Instance Variable | __kernel |
Undocumented |
| Instance Variable | __maintenance |
Undocumented |
| Instance Variable | __maintenance |
Undocumented |
| Instance Variable | __maintenance |
Undocumented |
| Instance Variable | __pending |
Undocumented |
| Instance Variable | __provider |
Undocumented |
| Instance Variable | __providers |
Undocumented |
| Instance Variable | __runtime |
Undocumented |
| Instance Variable | __runtime |
Undocumented |
| Instance Variable | __scheduler |
Undocumented |
| Instance Variable | __start |
Undocumented |
| Instance Variable | _ |
Undocumented |
| Instance Variable | _deferred |
Undocumented |
| Property | are |
Check whether every registered eager provider has finished startup. |
| Property | base |
Return the base path of the application. |
| Property | compiled |
Indicate whether the application is running in compiled mode. |
| Property | compiled |
Return the list of directory paths monitored for cache invalidation. |
| Property | compiled |
Return the list of file paths monitored for cache invalidation. |
| Property | compiled |
Return the path where compiled cache files are stored. |
| Property | entry |
Return the entry point module path where the application was created. |
| Property | is |
Check whether configuration and provider registration have completed. |
| Property | is |
Check whether configuration and service registration are complete. |
| Property | is |
Check whether both HTTP protocol handlers have been published. |
| Property | route |
Return the health check route for the application. |
| Property | start |
Return the application startup timestamp in nanoseconds. |
Inherited from Container:
| Static Method | __is |
Determine whether a concrete type is already resolving in this task. |
| Method | __alias |
Validate and normalize a service alias string. |
| Async Method | __auto |
Resolve and invoke a callable, injecting dependencies. |
| Async Method | __auto |
Automatically instantiate a class with injected dependencies. |
| Async Method | __await |
Wait for a provider that has registered services but is still booting. |
| Method | __bind |
Bind a concrete implementation to an abstract contract with a given lifetime. |
| Async Method | __boot |
Register a deferred provider once and complete its boot hook. |
| Async Method | __create |
Build and store the instance backing a scoped binding. |
| Async Method | __create |
Build and cache the single instance backing a singleton binding. |
| Method | __creation |
Return the creation lock for a key, bound to the running loop. |
| Method | __ensure |
Ensure that a service or alias can be overridden globally. |
| Method | __ensure |
Ensure that a service can be overridden in the current scope. |
| Method | __ensure |
Ensure that a concrete class implements the specified abstract class. |
| Method | __ensure |
Ensure that an instance implements the specified abstract class. |
| Method | __new__ |
Create and return a singleton instance for each class in the hierarchy. |
| Async Method | __resolve |
Resolve an instance from a binding according to its lifetime. |
| Async Method | __resolve |
Resolve a single argument for dependency injection. |
| Async Method | __resolve |
Resolve and register a deferred service provider for a given service. |
| Async Method | __resolve |
Resolve a service key to its abstract type. |
| Async Method | __resolve |
Resolve a binding for an abstract service or build it when unbound. |
| Async Method | __resolve |
Resolve an argument that is a subclass of msgspec.Struct. |
| Async Method | __resolve |
Resolve arguments for a callable signature using dependency injection. |
| Method | begin |
Begin a new scope context manager for scoped services. |
| Method | bound |
Determine if a key is bound in the container or current scope. |
| Async Method | build |
Build and return an instance of the specified type. |
| Async Method | call |
Invoke a method on an object instance with automatic dependency injection. |
| Method | get |
Get the current active scope context for scoped services. |
| Method | instance |
Register an object instance as a singleton in the container. |
| Async Method | invoke |
Invoke a callable with automatic dependency injection. |
| Async Method | make |
Resolve and return a service instance by key. |
| Method | scoped |
Register a scoped service binding. |
| Method | singleton |
Register a singleton service binding. |
| Method | transient |
Register a transient service binding. |
| Class Variable | _instances |
Undocumented |
| Class Variable | _lock |
Undocumented |
| Instance Variable | __aliases |
Undocumented |
| Instance Variable | __bindings |
Undocumented |
| Instance Variable | __cache |
Undocumented |
| Instance Variable | __creation |
Undocumented |
| Instance Variable | __pending |
Undocumented |
| Instance Variable | __registered |
Undocumented |
| Instance Variable | __singleton |
Undocumented |
| Instance Variable | _ |
Undocumented |
Inherited from IApplication (via Container):
| Class Variable | __slots__ |
Undocumented |
Return the existing application without constructing or booting it.
| Returns | |
Self or None | Application singleton for this class, if already instantiated. Its configuration may still be uninitialized before create(). |
Callable[ [], Awaitable[ dict]], send: Callable[ [ dict], Awaitable[ None]]):
(source)
¶
Handle ASGI lifespan startup and shutdown events.
| Parameters | |
receive:Callable[[], Awaitable[dict]] | ASGI receive callable for lifespan message retrieval. |
send:Callable[[dict], Awaitable[None]] | ASGI send callable for lifespan response transmission. |
| Returns | |
None | Returns after shutdown completes or a fatal error occurs. |
Assert that configuration is mutable before modification.
| Returns | |
None | This method does not return a value. Raises if configuration is locked. |
| Raises | |
RuntimeError | If attempting to modify configuration after application boot. |
Assert that the current Python version meets the minimum requirement.
| Returns | |
None | This method does not return a value. It raises if the version is insufficient. |
| Raises | |
RuntimeError | If the current Python version is lower than the required version. |
str | None = None, compiled_invalidation_paths: list[ str] | None = None):
(source)
¶
Initialize application compilation and configuration caching.
Notes
This method sets up the cache driver and loads cached configuration if available. It also tracks directories and files for cache invalidation.
| Parameters | |
compiledstr | None, optional | Path to the cache directory, or None. |
compiledlist[str] | None, optional | List of paths to monitor for cache invalidation, or None. |
| Returns | |
None | Configure the cache and load any valid stored bootstrap state. |
Boot all pending eager service providers.
Await providers in registration order and retain unfinished providers so a later startup can retry them.
| Returns | |
None | This method does not return a value. |
dict, receive: Callable[ [], Awaitable[ dict[ str, Any]]], send: Callable[ [ dict[ str, Any]], Awaitable[ None]]) -> Any | None:
(source)
¶
Dispatch ASGI requests to the appropriate handler by scope type.
| Parameters | |
scope:dict | ASGI connection scope containing request metadata and type. |
receive:Callable[[], Awaitable[dict[str, Any]]] | ASGI receive callable for message retrieval. |
send:Callable[[dict[str, Any]], Awaitable[None]] | ASGI send callable for response transmission. |
| Returns | |
Any | None | Result from the lifespan or HTTP handler, or None for unsupported scope types. |
Lock configuration and mark application as initialized.
Freeze the bootstrap configuration to prevent further modifications and set the configured flag to indicate the application is ready for use.
| Returns | |
None | This method does not return a value. It modifies internal state to lock configuration. |
Discover and register service providers from the providers folder.
Imports each discovered module, identifies classes that are subclasses of ServiceProvider, and registers them in the appropriate registry based on whether they are deferred or immediate providers.
| Parameters | |
modules:set[str] | Dotted module names containing service provider classes. |
| Returns | |
None | Modifies the internal providers registry in-place. |
Initialize the bootstrap configuration with default values.
Initialize the internal bootstrap configuration dictionary with the default bootstrap configuration if it is currently empty. This ensures the application has a valid configuration structure before any customization.
| Returns | |
None | This method does not return a value. It modifies the internal bootstrap configuration state in place. |
Ensure default application paths are set in the bootstrap configuration.
Initialize the 'paths' key in the bootstrap dictionary using default configuration paths if it is missing or empty.
| Returns | |
None | This method does not return a value. It modifies the internal bootstrap state to ensure paths are set. |
Ensure the providers registry structure is properly initialized.
Initialize the eager and deferred provider registries in the bootstrap configuration if they do not already exist. This method creates the necessary dictionary structure for storing service provider information and prevents duplicate initialization through a sentinel attribute.
| Returns | |
None | This method does not return a value. It modifies internal state. |
dict, receive: Callable[ [], Awaitable[ dict[ str, Any]]], send: Callable[ [ dict[ str, Any]], Awaitable[ None]]) -> Any | None:
(source)
¶
Handle an HTTP request using the configured disconnect policy.
Direct dispatch uses the server task and receive callable. When http.monitor_disconnects or a compiled endpoint policy enables monitoring, a receive dispatcher cancels the kernel on disconnect and buffers incoming body messages. At most nine body messages are retained outside the kernel: eight in the queue and one waiting to enter it. Disconnect detection pauses while the queue is full.
| Parameters | |
scope:dict | ASGI connection scope containing request metadata. |
receive:Callable[[], Awaitable[dict[str, Any]]] | ASGI receive callable provided by the server. |
send:Callable[[dict[str, Any]], Awaitable[None]] | ASGI send callable for transmitting the response. |
| Returns | |
Any | None | Result of the kernel handler, or None if the client disconnected before the response was sent. |
Handle HTTP requests using the KernelHTTP in RSGI mode.
Direct dispatch executes in the server task. When http.monitor_disconnects or a compiled endpoint policy enables monitoring, a watcher requests cancellation when the client disconnects. The watcher is joined before returning.
| Parameters | |
scope:Scope | The connection scope information for the RSGI protocol. |
protocol:HTTPProtocol | The RSGI protocol instance; must expose a client_disconnect coroutine that resolves when the client closes the connection. |
| Returns | |
object | The result returned by the HTTP kernel's handleRSGI method, or None when execution is cancelled due to client disconnect. |
| Raises | |
RuntimeError | If KernelHTTP is not configured in the application. |
TypeError | If the HTTP kernel does not have a handleRSGI method. |
Initialize the Application instance.
| Parameters | |
basePath | The base directory path of the application. |
| Returns | |
None | This method initializes the Application instance in place. |
Build and boot the CLI kernel once for concurrent commands.
| Returns | |
None | The command handler is published after the kernel boots. |
Load and initialize application configuration and service providers.
Ensures the bootstrap configuration is initialized, sets up default paths, loads the final application configuration, loads service providers, saves the configuration to cache, and locks the configuration. Registers and boots all service providers.
| Returns | |
None | This method modifies internal state and does not return a value. |
Load and return the configured CLI kernel instance.
| Returns | |
IKernelCLI | An instance of the configured CLI kernel. |
| Raises | |
RuntimeError | If KernelCLI is not configured in the application. |
TypeError | If the loaded kernel does not implement IKernelCLI. |
Load and merge the final configuration from dataclasses and custom config.
Discovers configuration modules and dataclasses, loads default configuration values, merges them with custom configuration, and updates the application's bootstrap dictionary with the final configuration and discovered providers.
| Returns | |
None | This method updates the internal bootstrap configuration in place. |
Load and register core framework service providers.
Import and register essential service providers required for framework operation. Ensures core services are available before user-defined providers.
| Parameters | |
self:Application | The current Application instance. |
| Returns | |
None | This method modifies the internal providers registry in place. |
dict[ str, Any], custom_config: dict[ str, Any], dataclasses: set[ tuple[ str, str, str, type[ Any]]] | None = None) -> dict[ str, Any]:
(source)
¶
Merge custom configuration and dataclass defaults into the base config.
| Parameters | |
defaultdict[str, Any] | The base configuration dictionary containing default values. |
customdict[str, Any] | The custom configuration dictionary to merge into defaults. |
dataclasses:set[tuple[str, str, str, Type[Any]]] | None, optional | Set of tuples containing dataclass info to merge, or None. |
| Returns | |
dict[str, Any] | The merged configuration dictionary containing all sections. |
Load and return the configured HTTP kernel instance.
| Returns | |
IKernelHTTP | An instance of the configured HTTP kernel. |
| Raises | |
TypeError | If the loaded kernel does not implement IKernelHTTP. |
Load and register all service providers.
Discovers provider modules, registers provider classes, and loads core framework providers. Ensures all service providers are available for dependency injection and application bootstrapping.
| Parameters | |
self:Application | The current application instance. |
| Returns | |
None | This method updates the internal providers registry in place. |
Deeply freeze and lock the application configuration.
Freezes the internal bootstrap configuration in-place to prevent further modifications. The booted flag is set separately in create().
| Returns | |
None | This method does not return a value. The configuration is locked in-place. |
Execute startup callbacks for the application lifecycle.
| Parameters | |
runtime:Runtime | The runtime environment (HTTP or CLI) for which to execute startup callbacks. |
httpstr, optional | HTTP transport recorded when the kernel is warmed during startup. |
| Returns | |
None | This method executes startup callbacks and does not return a value. |
Persist the compiled application state to cache.
Save the current bootstrap configuration to the cache if the application is running in compiled mode and the cache driver is initialized.
| Returns | |
None | This method does not return a value. It persists the configuration state to cache if applicable. |
str | list[ str] | None, required_imports: set[ str]) -> list[ Path]:
(source)
¶
Resolve and validate routing file paths.
| Parameters | |
paths:str | list[str] | None | Routing file path(s) to validate and resolve. |
requiredset[str] | Set of required module imports for validation. |
| Returns | |
list[Path] | List of resolved Path objects for valid routing files. |
| Raises | |
TypeError | If paths is not a str, list[str], or None, or if a file does not
contain valid routing definitions. |
FileNotFoundError | If a specified routing file does not exist. |
Resolve and register all eager service providers.
Resolves all eager service providers defined in the application's bootstrap configuration. Registers each provider and schedules its boot method if asynchronous.
| Returns | |
None | This method does not return a value. It registers and schedules eager providers for booting. |
Scope, protocol: HTTPProtocol | WebsocketProtocol | ProtocolError | ProtocolClosed) -> object:
(source)
¶
Handle the RSGI protocol for incoming requests.
| Parameters | |
scope:Scope | The connection scope information. |
protocol:HTTPProtocol | WebsocketProtocol | ProtocolError | ProtocolClosed | The RSGI protocol instance representing the connection. |
| Returns | |
object | The result of handling the RSGI request. |
Execute the RSGI application shutdown lifecycle.
| Parameters | |
loop:asyncio.AbstractEventLoop | The event loop for asynchronous execution. |
| Returns | |
None | This method executes shutdown callbacks and does not return a value. |
Initialize the RSGI application lifecycle and execute startup callbacks.
| Parameters | |
loop:asyncio.AbstractEventLoop | The event loop for asynchronous execution. |
| Returns | |
None | This method executes startup callbacks and does not return a value. |
Set system timezone and locale from application configuration.
Uses the application's configuration to set the system timezone and locale. This method updates environment variables and system locale settings if the relevant configuration values are present.
| Returns | |
None | This method updates environment variables and system locale settings in place. It does not return a value. |
Store a deferred service provider instance in the deferred registry.
| Parameters | |
provider:type[IDeferrableProvider] | The service provider class to register. |
| Returns | |
None | This method does not return a value. |
| Raises | |
TypeError | If the provider is not a class or not a subclass of IServiceProvider. |
Store an eager service provider instance in the eager registry.
| Parameters | |
provider:type[IServiceProvider] | The service provider class to register. |
| Returns | |
None | This method does not return a value. It modifies the internal eager providers registry in-place. |
| Raises | |
TypeError | If the provider is not a class or not a subclass of IServiceProvider. |
Store a service provider instance in the appropriate registry.
Register the provider class in either the eager or deferred registry based on its inheritance hierarchy. Validates provider type and ensures proper registry structure before storage.
| Parameters | |
provider:type[IServiceProvider] | The service provider class to register. |
| Returns | |
None | This method does not return a value. |
| Raises | |
TypeError | If the provider is not a class or not a subclass of IServiceProvider. |
Validate that the provider class meets IServiceProvider requirements.
| Parameters | |
providertype[IServiceProvider] | The service provider class to validate. |
| Returns | |
None | This method does not return a value. Raises exceptions if validation fails. |
| Raises | |
TypeError | If the provider is not a class or not a subclass of IServiceProvider. |
orionis.IApplication.bootCreate the application and await eager providers for headless use.
Repeated and concurrent calls share provider startup coordination. HTTP and Reactor continue to own their kernels and lifecycle callbacks.
| Returns | |
Self | The application with all eager provider boot methods completed. |
| Raises | |
Exception | Propagate configuration or provider startup failures. An unfinished provider remains pending so another call can retry its startup. |
orionis.IApplication.compileCompile the application with the specified caching and invalidation settings.
| Parameters | |
path:str | None, optional | The path where compiled files should be stored. Defaults to None. |
invalidationlist[str] | None, optional | List of paths that trigger cache invalidation when modified. Defaults to None. |
| Returns | |
None | This method does not return a value. |
orionis.IApplication.configGet or set an application configuration value.
| Parameters | |
key:str or None, optional | Dot-notated key specifying the configuration value to get or set. If None and value is not provided, returns the entire configuration. |
value:object, optional | Value to set at the specified key. If not provided, retrieves the value. |
| Returns | |
object | The configuration value for the given key, or the entire configuration if no key is provided. If setting a value, returns the value set. |
| Raises | |
RuntimeError | If the application configuration is not initialized. |
TypeError | If the configuration key is not a string. |
orionis.IApplication.createBootstrap and initialize the application framework.
Register the application instance, load all configurations, set timezone and locale, and mark the application as booted.
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.getExceptionHandlerRetrieve the registered exception handler instance.
| Parameters | |
self:Application | The current application instance. |
| Returns | |
IBaseExceptionHandler | The registered exception handler instance. If none is set, returns the default BaseExceptionHandler instance. |
| Raises | |
RuntimeError | If called before the application is booted. |
orionis.IApplication.getMiddlewareRetrieve the list of registered middleware classes.
| Returns | |
list[type[IBaseMiddleware]] | A list of middleware classes registered in the application. |
orionis.IApplication.getSchedulerRetrieve the currently registered scheduler instance.
| Returns | |
IBaseScheduler | The registered scheduler instance. |
| Raises | |
RuntimeError | If the application is not booted. |
orionis.IApplication.handleCommandHandle a CLI command using the configured KernelCLI.
| Parameters | |
args:list[str] | None, optional | Arguments to pass to the kernel's handle method. Defaults to an empty list if not provided. |
| Returns | |
int | The exit code returned by the CLI kernel's handle method. |
| Raises | |
RuntimeError | If KernelCLI is not configured in the application. |
TypeError | If the CLI kernel does not have a handle method. |
orionis.IApplication.isDebugDetermine if the application is running in debug mode.
| Returns | |
bool | True if debug mode is enabled in the configuration, otherwise False. |
| Raises | |
RuntimeError | If the application configuration is not initialized. |
orionis.IApplication.isProductionDetermine if the application is running in a production environment.
Checks the 'app.env' configuration value to see if it contains 'prod'. This is useful for toggling production-specific features.
| Returns | |
bool | True if the application environment contains 'prod', otherwise False. |
| Raises | |
RuntimeError | If the application configuration is not initialized. |
Lifespan, *callbacks: Callable[ ..., Any] | Callable[ ..., Awaitable[ Any]], runtime: Runtime | None = None) -> Self:
(source)
¶
orionis.IApplication.onRegister callbacks for a specific application lifespan event.
Notes
Callbacks are stored as-is and executed during the specified lifespan event. Lambdas and dynamic callables are supported.
| Parameters | |
lifespan:Lifespan | The application lifespan event to register callbacks for. |
*callbacks:Callable[..., Any] | Callable[..., Awaitable[Any]] | One or more callback functions to execute during the event. |
runtime:Runtime | None, optional | The runtime environment for which to register the callbacks. If None, callbacks are registered for all runtimes. |
| Returns | |
Self | The current Application instance for method chaining. |
| Raises | |
TypeError | If lifespan is not a Lifespan enum or any callback is not callable. |
ValueError | If no callbacks are provided. |
orionis.IApplication.pathRetrieve an application path by key or return all paths.
| Parameters | |
key:str | None, optional | The key for the desired path. If None, returns all paths. |
| Returns | |
Path | Mapping[str, Path] | None | The resolved path for the given key, all paths as a read-only mapping, or None if the key does not exist. |
| Raises | |
RuntimeError | If the application configuration is not initialized. |
TypeError | If the key is not a string. |
orionis.IApplication.resetRuntimeConfigReset the runtime configuration to a mutable copy of the bootstrap config.
Resets the application's runtime configuration to a mutable and isolated copy of the bootstrap configuration. The application remains booted and subsequent accesses use the restored runtime values.
| Returns | |
bool | True if the configuration was reset successfully. |
orionis.IApplication.routingPathsRetrieve routing file paths from configuration.
The 'api', 'web', 'console', 'ai', and 'websocket' types are supported. The health-check route is exposed through the routeHealthCheck property and is not accessible via this method.
| Parameters | |
key:str | None, optional | Routing type: 'api', 'web', 'console', 'ai', or 'websocket'. If None, returns the complete routing configuration dictionary. |
| Returns | |
list[Path] | dict | None | List of Path objects for the specified routing type, the complete routing configuration dictionary if no key is provided, or None if the key is not one of the valid routing types. |
| Raises | |
RuntimeError | If the application configuration is not initialized. |
TypeError | If the key is not a string or None. |
orionis.IApplication.underMaintenanceDetermine if the application is currently in maintenance mode.
The shared marker is refreshed at most once every 100 ms per worker. Runtime changes from other processes become visible after that interval.
| Returns | |
bool | True when the effective maintenance state is enabled. The runtime marker overrides the configured value when present. |
| Raises | |
RuntimeError | If the application configuration is not initialized. |
orionis.IApplication.withConfigAppConfigure application settings using keyword arguments.
| Parameters | |
**appobject | Configuration parameters for the application. Keys must match the field names and types expected by the App dataclass from orionis.foundation.config.app.entities.app.App. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigAuthConfigure authentication subsystem using keyword arguments.
| Parameters | |
**authobject | Keyword arguments for authentication configuration. Keys must match
the fields of the Auth dataclass from
orionis.foundation.config.auth.entities.auth.Auth. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigCacheConfigure the cache subsystem using keyword arguments.
| Parameters | |
**cacheobject | Keyword arguments representing cache configuration options. Keys must
match the field names and types expected by the Cache dataclass from
orionis.foundation.config.cache.entities.cache.Cache. |
| Returns | |
Self | The current Application instance to enable method chaining. |
orionis.IApplication.withConfigDatabaseConfigure the database subsystem using keyword arguments.
| Parameters | |
**databaseobject | Keyword arguments for database configuration. Keys must match the
fields of the Database dataclass from
orionis.foundation.config.database.entities.database.Database. |
| Returns | |
Self | The current Application instance for method chaining. |
Configure the filesystems subsystem using keyword arguments.
| Parameters | |
**filesystemsobject | Keyword arguments for filesystems configuration. Keys must match the
fields of the Filesystems dataclass from
orionis.foundation.config.filesystems.entitites.filesystems.Filesystems. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigHttpConfigure the HTTP subsystem using keyword arguments.
| Parameters | |
**httpobject | Keyword arguments for HTTP configuration. Keys must match the field
names and types expected by the HTTP dataclass from
orionis.foundation.config.http.entitites.http.HTTP. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigLoggingConfigure logging subsystem using keyword arguments.
| Parameters | |
**loggingobject | Keyword arguments for logging configuration. Keys must match the
fields of the Logging dataclass from
orionis.foundation.config.logging.entities.logging.Logging. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigMailConfigure mail subsystem using keyword arguments.
| Parameters | |
**mailobject | Keyword arguments for mail configuration. Keys must match the fields
of the Mail dataclass from
orionis.foundation.config.mail.entities.mail.Mail. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigMcpConfigure validated MCP limits and the explicit Origin allowlist.
| Parameters | |
**mcpobject | Fields accepted by the native McpConfig entity. |
| Returns | |
Self | The application for further configuration. |
orionis.IApplication.withConfigPathsSet and resolve application directory paths.
| Parameters | |
**paths:str | Path | None | Optional directory path overrides. Valid keys are 'app', 'console', 'exceptions', 'http', 'models', 'providers', 'notifications', 'services', 'jobs', 'bootstrap', 'config', 'database', 'resources', 'routes', 'storage' and 'tests'. The root always comes from basePath. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigQueueConfigure the queue subsystem using keyword arguments.
| Parameters | |
**queueobject | Keyword arguments representing queue configuration options. Keys must
match the field names and types expected by the Queue dataclass from
orionis.foundation.config.queue.entities.queue.Queue. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigSessionConfigure session subsystem using keyword arguments.
| Parameters | |
**sessionobject | Keyword arguments for session configuration. Keys must match the
fields of the Session dataclass from
orionis.foundation.config.session.entities.session.Session. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withConfigTestingConfigure the testing subsystem using keyword arguments.
| Parameters | |
**testingobject | Keyword arguments for testing configuration. Keys must match the
fields of the Testing dataclass from
orionis.foundation.config.testing.entities.testing.Testing. |
| Returns | |
Self | The current Application instance for method chaining. |
Register a custom exception handler class for the application.
Notes
Stores the handler class for later instantiation. Any previously registered handler is silently replaced.
| Parameters | |
handler:type[IBaseExceptionHandler] | Exception handler class to use. Must inherit from BaseExceptionHandler. |
| Returns | |
Self | The current Application instance for method chaining. |
| Raises | |
TypeError | If the handler is not a class or not a subclass of BaseExceptionHandler. |
RuntimeError | If attempting to set handler after application has been booted. |
orionis.IApplication.withMiddlewareRegister middleware for the application.
| Parameters | |
*middleware:tuple[type[IBaseMiddleware], ...] | Middleware classes to register. Each must inherit from IBaseMiddleware. |
| Returns | |
Self | The current Application instance for method chaining. |
orionis.IApplication.withProvidersRegister service providers for the application.
| Parameters | |
*providers:tuple[type[IServiceProvider], ...] | Service provider classes to register. Each must inherit from IServiceProvider. |
| Returns | |
Self | The current Application instance for method chaining. |
| Raises | |
TypeError | If any argument is not a class or does not inherit from IServiceProvider. |
str | list[ str] | None = None, web: str | list[ str] | None = None, console: str | list[ str] | None = None, health: str | None = None, ai: str | list[ str] | None = None, *, websocket: str | list[ str] | None = None) -> Self:
(source)
¶
orionis.IApplication.withRoutingConfigure separate routing files for each application protocol.
| Parameters | |
api:str | list[str] | None | Path or list of paths to API routing files. |
web:str | list[str] | None | Path or list of paths to web routing files. |
console:str | list[str] | None | Path or list of paths to console routing files. |
health:str | None | Path to the health check route. |
ai:str | list[str] | None | MCP registration files loaded before HTTP or CLI startup. |
websocket:str | list[str] | None | WebSocket and Hub route files using the web middleware profile. |
| Returns | |
Self | The current Application instance for method chaining. |
| Raises | |
TypeError | If routing arguments are of invalid types or do not contain valid routing definitions. |
FileNotFoundError | If a specified routing file does not exist. |
orionis.IApplication.withSchedulerRegister a custom scheduler class for the application.
Notes
Stores the scheduler class metadata for later instantiation. Any previously registered scheduler is silently replaced.
| Parameters | |
scheduler:type[IBaseScheduler] | The scheduler class to be used. Must inherit from IBaseScheduler. |
| Returns | |
Self | The current Application instance for method chaining. |
| Raises | |
RuntimeError | If attempting to set scheduler after application has been booted. |
TypeError | If the provided scheduler is not a subclass of IBaseScheduler. |
orionis.IApplication.areProvidersBootedCheck whether every registered eager provider has finished startup.
| Returns | |
bool | True after creation and successful eager provider startup. Deferred providers still boot on first resolution. |
orionis.IApplication.basePathReturn the base path of the application.
| Returns | |
Path | The base directory path of the application. |
orionis.IApplication.compiledIndicate whether the application is running in compiled mode.
| Returns | |
bool | True if the application is configured to run in compiled mode, otherwise False. |
Return the list of directory paths monitored for cache invalidation.
| Returns | |
list of Path | List of directory paths monitored for cache invalidation. |
Return the list of file paths monitored for cache invalidation.
| Returns | |
list of Path | List of file paths monitored for cache invalidation. |
orionis.IApplication.compiledPathReturn the path where compiled cache files are stored.
| Returns | |
Path or None | The directory path for compiled cache storage, or None if not configured. |
orionis.IApplication.entryPointReturn the entry point module path where the application was created.
| Returns | |
str | None | The module path in the format 'folder.subfolder.file:app' where the application instance was created, or None if not available. |
orionis.IApplication.isBootedCheck whether configuration and provider registration have completed.
| Returns | |
bool | True after create() finishes. Asynchronous provider startup and HTTP kernel readiness are completed separately during lifespan startup. |
orionis.IApplication.isCreatedCheck whether configuration and service registration are complete.
| Returns | |
bool | Alias of the legacy isBooted configuration-stage flag. |
orionis.IApplication.isHttpReadyCheck whether both HTTP protocol handlers have been published.
| Returns | |
bool | True after eager providers and the HTTP kernel finish startup. This flag does not report listening sockets or deployment health. |
orionis.IApplication.routeHealthCheckReturn the health check route for the application.
| Returns | |
str | The configured health check route path. Returns "/up" if not set. |