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 documentation
class Reactor(IReactor): (source)
Constructor: Reactor(app, loader, executer, logger, ...)
Resolve and execute registered console commands.
| Async Method | __call |
Execute a command within a scoped application context. |
| Method | __init__ |
Initialize the command dispatcher and its services. |
| Method | __parse |
Parse command arguments and omit values marked as missing. |
| Async Method | call |
Execute a command in an isolated failure-reporting context. |
| Method | command |
Register a command and return its fluent configuration. |
| Async Method | has |
Check whether a command signature is registered. |
| Async Method | info |
Return cached metadata for non-internal commands. |
| Instance Variable | __app |
Application instance for command processing. |
| Instance Variable | __cache |
Initialize cache for command information. |
| Instance Variable | __catch |
Catch instance for handling exceptions. |
| Instance Variable | __executer |
Executor instance for managing command output. |
| Instance Variable | __loader |
Loader instance for managing command loading. |
| Instance Variable | __logger |
Logger instance for logging command execution details. |
| Instance Variable | __performance |
PerformanceCounter instance for measuring command execution time. |
Execute a command within a scoped application context.
Parse arguments, resolve the handler, and report execution status and handled failures.
| Parameters | |
signature:str | Registered command signature to execute. |
args:list[str] or None, optional | Command-line tokens to parse; use an empty list when None. |
| Returns | |
int | Handler exit code, 0 for non-integer results, or 1 after handling a dispatch or execution error. |
| Raises | |
SystemExit | If argument parsing fails or command help is requested. |
Exception | If scope management, initial timing, or failure reporting fails. |
def __init__(self, app:
IApplication, loader: Loader, executer: Executor, logger: ILogger, catch: ICatch, performance_counter: PerformanceCounter):
(source)
¶
Initialize the command dispatcher and its services.
| Parameters | |
app:orionis.foundation.contracts.application.IApplication | Application container used to resolve and invoke command handlers. |
loader:orionis.console.core.loader.Loader | Loader used to register and discover commands. |
executer:orionis.console.output.executor.Executor | Output service used to display command execution status. |
logger:orionis.logging.contracts.logger.ILogger | Logger used to record command outcomes. |
catch:orionis.failure.contracts.catch.ICatch | Exception handler used to present command failures. |
performanceorionis.support.performance.counter.PerformanceCounter | Timer used to measure command execution. |
| Returns | |
None | Initialize the dispatcher with an empty metadata cache. |
Parse command arguments and omit values marked as missing.
| Parameters | |
command:orionis.console.entities.command.Command | Command whose argument parser supplies the parsed values. |
args:list[str] or None, optional | Command-line tokens to parse; use an empty list when None. |
| Returns | |
dict | Parsed arguments without MISSING values, or an empty dictionary when the command has no argument parser. |
| Raises | |
SystemExit | If argument parsing fails or help is requested. |
Execute a command in an isolated failure-reporting context.
| Parameters | |
signature:str | Registered command signature to execute. |
args:list[str] or None, optional | Command-line tokens to parse; use an empty list when None. |
| Returns | |
int | Handler exit code, 0 for non-integer results, or 1 for failures handled during dispatch. |
| Raises | |
SystemExit | If argument parsing fails or command help is requested. |
Exception | If dispatch or failure reporting raises an unhandled error. |
def command(self, signature:
str, handler: list[ type[ Any] | str | None] | str) -> ICommand:
(source)
¶
Register a command and return its fluent configuration.
| Parameters | |
signature:str | Signature used to identify the command. |
handler:list[type[typing.Any] | str | None] | str | Handler definition forwarded to the loader; default the method to __call__ when omitted. |
| Returns | |
orionis.console.fluent.contracts.command.ICommand | Fluent command definition for further configuration. |
| Raises | |
TypeError | If the handler class or method name has an invalid type. |
ValueError | If the handler list is empty. |
AttributeError | If the handler method is missing or not callable. |