ORIONIS API REFERENCE

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 Loader(ILoader): (source)

Constructor: Loader(app)

View In Hierarchy

Undocumented

Method __argFromDict Reconstruct an Argument instance from a serialized dictionary.
Method __argToDict Convert an Argument instance to a JSON-compatible dictionary.
Method __buildArgumentParser Construct and configure an ArgumentParser for a command class.
Method __buildCommand Build a Command instance from metadata.
Method __getArguments Retrieve and validate Argument inputs for a command class.
Method __getCachePersistence Get the persistence mechanism for command caching.
Method __getDescription Retrieve and validate the 'description' attribute of a command class.
Method __getSignature Validate and return the 'signature' attribute of a command class.
Method __getTimestamps Retrieve the 'timestamps' attribute from a command class.
Method __importFluentCommandRoutes Import fluent command route modules from application routing paths.
Method __init__ Initialize the Loader instance.
Async Method __load Load command classes from metadata and populate the commands dictionary.
Async Method __loadCoreCommands Load and register core command classes provided by the Orionis framework.
Async Method __loadCustomCommands Load custom command classes from the commands directory.
Method __loadFluentCommands Register commands defined via the fluent interface.
Async Method __loadMetadata Load command metadata from cache or discover commands.
Method addFluentCommand Define a new command using the fluent interface.
Async Method all Return all loaded commands.
Async Method get Retrieve a command instance by its signature.
Async Method load Load all command classes and their metadata.
Instance Variable __all_loaded Undocumented
Instance Variable __app Undocumented
Instance Variable __commands Undocumented
Instance Variable __fluent_commands Undocumented
Instance Variable __imported_modules Undocumented
Instance Variable __metadata Undocumented
Instance Variable __metadata_loaded Undocumented
Instance Variable __persistence Undocumented
Instance Variable __use_cache Undocumented
def __argFromDict(self, d: dict) -> Argument: (source)

Reconstruct an Argument instance from a serialized dictionary.

Deserialize argument metadata by restoring callable types, MISSING sentinels, and tuple metavar from their serialized representations.

Parameters
d:dictDictionary produced by __argToDict containing serialized argument properties.
Returns
ArgumentA reconstructed Argument instance with restored properties.
def __argToDict(self, arg: Argument) -> dict: (source)

Convert an Argument instance to a JSON-compatible dictionary.

Serialize argument metadata including name, action, type, and other properties into a dictionary suitable for caching or transport.

Parameters
arg:ArgumentThe Argument instance to serialize.
Returns
dictA dictionary with serialized argument properties.
def __buildArgumentParser(self, arguments: list[dict], signature: str, description: str) -> argparse.ArgumentParser | None: (source)

Construct and configure an ArgumentParser for a command class.

Build an ArgumentParser using the provided Argument options. Returns the parser if arguments exist, otherwise returns None.

Parameters
arguments:list[dict]List of Argument option dictionaries.
signature:strCommand signature.
description:strCommand description.
Returns
argparse.ArgumentParser | NoneArgumentParser instance configured with the command's arguments, or None if no arguments are present.
def __buildCommand(self, meta: dict) -> Command: (source)

Build a Command instance from metadata.

Parameters
meta:dictMetadata dictionary containing command information.
Returns
CommandThe constructed Command instance.
def __getArguments(self, obj: IBaseCommand) -> list[dict]: (source)

Retrieve and validate Argument inputs for a command class.

Parameters
obj:IBaseCommandCommand class instance to validate.
Returns
list of dictList of Argument instances as dictionaries. Returns an empty list if no inputs are present.
Raises
TypeErrorIf the 'inputs' method does not return a list or contains non- Argument instances.
def __getCachePersistence(self) -> IFileBasedCache | None: (source)

Get the persistence mechanism for command caching.

Returns
FileBasedCache | NoneFileBasedCache instance for command caching, or None if no cache configuration is available.
def __getDescription(self, obj: IBaseCommand) -> str: (source)

Retrieve and validate the 'description' attribute of a command class.

Ensure the command class has a non-empty string 'description' attribute. If missing, set a default description. Raise an error if the attribute is not a string or is empty.

Parameters
obj:IBaseCommandCommand class instance to validate.
Returns
strThe validated and stripped description string.
Raises
ValueErrorIf the 'description' attribute is empty.
TypeErrorIf the 'description' attribute is not a string.
def __getSignature(self, obj: IBaseCommand) -> str: (source)

Validate and return the 'signature' attribute of a command class.

Parameters
obj:IBaseCommandCommand class instance to validate.
Returns
strThe validated signature string.
Raises
ValueErrorIf the class lacks a 'signature' attribute, if the signature is empty, or if the signature does not match the required pattern.
TypeErrorIf the 'signature' attribute is not a string.
def __getTimestamps(self, obj: IBaseCommand) -> bool: (source)

Retrieve the 'timestamps' attribute from a command class.

Parameters
obj:IBaseCommandCommand class instance to inspect.
Returns
boolTrue if the 'timestamps' attribute exists and is a boolean, otherwise False.
Raises
TypeErrorIf the 'timestamps' attribute exists but is not a boolean.
def __importFluentCommandRoutes(self): (source)

Import fluent command route modules from application routing paths.

Load and import all route modules defined in the application's console routing configuration. Convert file paths to module names and import them to register fluent commands.

Returns
NoneImports route modules without returning a value.
def __init__(self, app: IApplication): (source)

Initialize the Loader instance.

Parameters
app:IApplicationThe application instance providing configuration and paths.
Returns
NoneInitializes internal state and sets up command caching.
async def __load(self, signature: str | None = None): (source)

Load command classes from metadata and populate the commands dictionary.

Parameters
signature:str | NoneThe unique signature of the command to load, or None to load all.
Returns
NoneThis method populates the internal commands dictionary and does not return a value.
async def __loadCoreCommands(self): (source)

Load and register core command classes provided by the Orionis framework.

Discover and register core command classes bundled with the Orionis framework. Validate required attributes for each command and add them to the internal registry.

Returns
NoneRegisters core commands internally for later lookup and execution.
async def __loadCustomCommands(self): (source)

Load custom command classes from the commands directory.

Walk through the commands directory, import Python modules, and register command classes that inherit from BaseCommand. Sanitize module paths and validate command structure before registration.

Returns
NoneRegisters command classes internally in the reactor's command registry.
def __loadFluentCommands(self): (source)

Register commands defined via the fluent interface.

Discover and register all commands created using the fluent API. Validate their structure and metadata before adding them to the internal registry.

Returns
NoneRegisters fluent commands internally for later lookup and execution.
async def __loadMetadata(self): (source)

Load command metadata from cache or discover commands.

Loads metadata from cache if available and caching is enabled. If no cached metadata exists, discovers all command types and optionally saves to cache.

Returns
NonePopulates the internal metadata dictionary.
def addFluentCommand(self, signature: str, handler: list[type[Any], str | None]) -> ICommand: (source)

Define a new command using the fluent interface.

Create a command with the given signature and handler. The handler must be a list containing the class and optionally the method name. Validate input types and conventions. Return the created ICommand instance.

Parameters
signature:strUnique identifier for the command.
handler:list of AnyList containing the class and optionally the method name.
Returns
ICommandThe created FluentCommand instance.
Raises
TypeErrorIf the signature is not a string or the handler is not a valid list.
ValueErrorIf the signature does not meet naming conventions.
async def all(self) -> dict[str, Command]: (source)

Return all loaded commands.

Returns
dict[str, Command]A dictionary mapping command signatures to Command instances.
async def get(self, signature: str) -> Command | None: (source)

Retrieve a command instance by its signature.

Parameters
signature:strThe unique signature identifying the command.
Returns
Command | NoneThe Command instance if found, otherwise None.
async def load(self): (source)

Load all command classes and their metadata.

This method loads command metadata from cache if available, otherwise discovers core commands, custom commands, and fluent commands. It then builds Command instances for each command and populates the internal commands dictionary.

Returns
NoneThis method populates the internal commands dictionary and does not return a value.
__all_loaded: bool = (source)

Undocumented

__app: IApplication = (source)

Undocumented

__commands: dict[str, Command] = (source)

Undocumented

__fluent_commands: list[ICommand] = (source)

Undocumented

__imported_modules: dict[str, Any] = (source)

Undocumented

__metadata: dict[str, Any] = (source)

Undocumented

__metadata_loaded: bool = (source)

Undocumented

__persistence: IFileBasedCache | None = (source)

Undocumented

__use_cache: bool = (source)

Undocumented