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.
Undocumented
| Method | __arg |
Reconstruct an Argument instance from a serialized dictionary. |
| Method | __arg |
Convert an Argument instance to a JSON-compatible dictionary. |
| Method | __build |
Construct and configure an ArgumentParser for a command class. |
| Method | __build |
Build a Command instance from metadata. |
| Method | __get |
Retrieve and validate Argument inputs for a command class. |
| Method | __get |
Get the persistence mechanism for command caching. |
| Method | __get |
Retrieve and validate the 'description' attribute of a command class. |
| Method | __get |
Validate and return the 'signature' attribute of a command class. |
| Method | __get |
Retrieve the 'timestamps' attribute from a command class. |
| Method | __import |
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 | __load |
Load and register core command classes provided by the Orionis framework. |
| Async Method | __load |
Load custom command classes from the commands directory. |
| Method | __load |
Register commands defined via the fluent interface. |
| Async Method | __load |
Load command metadata from cache or discover commands. |
| Method | add |
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 |
Undocumented |
| Instance Variable | __app |
Undocumented |
| Instance Variable | __commands |
Undocumented |
| Instance Variable | __fluent |
Undocumented |
| Instance Variable | __imported |
Undocumented |
| Instance Variable | __metadata |
Undocumented |
| Instance Variable | __metadata |
Undocumented |
| Instance Variable | __persistence |
Undocumented |
| Instance Variable | __use |
Undocumented |
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:dict | Dictionary produced by __argToDict containing serialized argument properties. |
| Returns | |
Argument | A reconstructed Argument instance with restored properties. |
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:Argument | The Argument instance to serialize. |
| Returns | |
dict | A dictionary with serialized argument properties. |
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:str | Command signature. |
description:str | Command description. |
| Returns | |
argparse.ArgumentParser | None | ArgumentParser instance configured with the command's arguments, or None if no arguments are present. |
Build a Command instance from metadata.
| Parameters | |
meta:dict | Metadata dictionary containing command information. |
| Returns | |
Command | The constructed Command instance. |
Retrieve and validate Argument inputs for a command class.
| Parameters | |
obj:IBaseCommand | Command class instance to validate. |
| Returns | |
list of dict | List of Argument instances as dictionaries. Returns an empty list if no inputs are present. |
| Raises | |
TypeError | If the 'inputs' method does not return a list or contains non- Argument instances. |
Get the persistence mechanism for command caching.
| Returns | |
FileBasedCache | None | FileBasedCache instance for command caching, or None if no cache configuration is available. |
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:IBaseCommand | Command class instance to validate. |
| Returns | |
str | The validated and stripped description string. |
| Raises | |
ValueError | If the 'description' attribute is empty. |
TypeError | If the 'description' attribute is not a string. |
Validate and return the 'signature' attribute of a command class.
| Parameters | |
obj:IBaseCommand | Command class instance to validate. |
| Returns | |
str | The validated signature string. |
| Raises | |
ValueError | If the class lacks a 'signature' attribute, if the signature is empty, or if the signature does not match the required pattern. |
TypeError | If the 'signature' attribute is not a string. |
Retrieve the 'timestamps' attribute from a command class.
| Parameters | |
obj:IBaseCommand | Command class instance to inspect. |
| Returns | |
bool | True if the 'timestamps' attribute exists and is a boolean, otherwise False. |
| Raises | |
TypeError | If the 'timestamps' attribute exists but is not a boolean. |
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 | |
None | Imports route modules without returning a value. |
Initialize the Loader instance.
| Parameters | |
app:IApplication | The application instance providing configuration and paths. |
| Returns | |
None | Initializes internal state and sets up command caching. |
Load command classes from metadata and populate the commands dictionary.
| Parameters | |
signature:str | None | The unique signature of the command to load, or None to load all. |
| Returns | |
None | This method populates the internal commands dictionary and does not return a value. |
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 | |
None | Registers core commands internally for later lookup and execution. |
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 | |
None | Registers command classes internally in the reactor's command registry. |
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 | |
None | Registers fluent commands internally for later lookup and execution. |
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 | |
None | Populates the internal metadata dictionary. |
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:str | Unique identifier for the command. |
handler:list of Any | List containing the class and optionally the method name. |
| Returns | |
ICommand | The created FluentCommand instance. |
| Raises | |
TypeError | If the signature is not a string or the handler is not a valid list. |
ValueError | If the signature does not meet naming conventions. |
Retrieve a command instance by its signature.
| Parameters | |
signature:str | The unique signature identifying the command. |
| Returns | |
Command | None | The Command instance if found, otherwise None. |
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 | |
None | This method populates the internal commands dictionary and does not return a value. |