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 IConsole(ABC): (source)

Known subclasses: orionis.console.Console

View In Hierarchy

Undocumented

Method anticipate Provide autocomplete suggestions based on user input.
Method ask Prompt user for input and return the response.
Method choice Prompt user to select an option from a list.
Method clear Clear the console screen.
Method clearLine Clear the current line in the console.
Method confirm Ask for confirmation and return True or False.
Method dump Dump variable information to the console with formatting options.
Method error Print an error message with a red background.
Method exception Print exception details and stack trace.
Method exitError Exit the program with an error message.
Method exitSuccess Exit the program with a success message.
Method fail Print a failure message with a red background.
Method info Print an informational message with a blue background.
Method line Print a horizontal line in the console.
Method newLine Print multiple new lines.
Method secret Prompt for hidden input using the provided question.
Async Method sleep Asynchronously sleep for a specified number of seconds.
Method success Print a success message with a green background.
Method table Print a formatted table with bold headers and box-drawing borders.
Method textError Print an error message in red.
Method textErrorBold Print a bold error message in red.
Method textInfo Print an informational message in blue.
Method textInfoBold Print a bold informational message in blue.
Method textMuted Print a muted (gray) message.
Method textMutedBold Print a bold muted (gray) message.
Method textSuccess Print a success message in green.
Method textSuccessBold Print a bold success message in green.
Method textUnderline Print an underlined message.
Method textWarning Print a warning message in yellow.
Method textWarningBold Print a bold warning message in yellow.
Method warning Print a warning message with a yellow background.
Method write Write values to the output stream and move to the next line.
Method writeLine Print a message and move to the next line.
Property progressBar Get a new instance of the ProgressBar class.
def anticipate(self, question: str, options: list, default: None = None) -> str: (source)

Provide autocomplete suggestions based on user input.

Notes

Match the beginning of user input with available options. Return the first match, or default/user input if no match.

Parameters
question:strPrompt for the user.
options:list of strList of possible autocomplete options.
default:str, optionalDefault value if no match is found. Defaults to None.
Returns
strChosen option if matched, otherwise default or user input.
def ask(self, question: str) -> str: (source)

Prompt user for input and return the response.

Parameters
question:strMessage to display to the user.
Returns
strUser's input as a string.
def choice(self, question: str, choices: list, default_index: int = 0) -> str: (source)

Prompt user to select an option from a list.

Notes

Display a numbered list of choices and prompt the user to select one. Re-prompt until a valid selection is made.

Parameters
question:strPrompt message for the user.
choices:list of strList of available choices.
default_index:int, optionalIndex of the default choice (zero-based). Default is 0.
Returns
strSelected choice from the list.
Raises
ValueErrorIf choices is empty or default_index is out of range.
def clear(self): (source)

Clear the console screen.

Notes

Emite códigos de escape ANSI para limpiar la pantalla y mover el cursor al origen, evitando el overhead de lanzar un subproceso.

Returns
NoneThis method does not return any value.
def clearLine(self): (source)

Clear the current line in the console.

Notes

Move the cursor to the start of the line and overwrite it with a space. Return the cursor to the beginning.

Returns
NoneThis method does not return any value.
def confirm(self, question: str, *, default: bool = False) -> bool: (source)

Ask for confirmation and return True or False.

Parameters
question:strConfirmation prompt for the user.
default:bool, optionalDefault response if user presses Enter. False means 'No'.
Returns
boolTrue if user enters 'Y' or 'YES', False otherwise.
def dump(self, *args: type[Any], show_types: bool = True, show_index: bool = False, expand_all: bool = True, max_depth: int | None = None, module_path: str | None = None, line_number: int | None = None, force_exit: bool = False, redirect_output: bool = False, insert_line: bool = False): (source)

Dump variable information to the console with formatting options.

Parameters
*args:AnyVariables to be dumped.
show_types:bool, optionalShow variable types (default is True).
show_index:bool, optionalShow index for collections (default is False).
expand_all:bool, optionalExpand all nested structures (default is True).
max_depth:int or None, optionalMaximum depth to expand (default is None).
module_path:str or None, optionalPath of the module (default is None).
line_number:int or None, optionalLine number for context (default is None).
force_exit:bool, optionalForce program exit after dump (default is False).
redirect_output:bool, optionalRedirect output to file or stream (default is False).
insert_line:bool, optionalInsert a line after output (default is False).
Returns
NoneThis method does not return any value.
def error(self, message: str, *, timestamp: bool = True): (source)

Print an error message with a red background.

Notes

Uses ANSI escape codes for error style.

Parameters
message:strError message to print.
timestamp:bool, optionalIf True, include a timestamp (default is True).
Returns
NoneThis method does not return any value.
def exception(self, exception: Exception): (source)

Print exception details and stack trace.

Notes

Shows exception type, message, and stack trace using rich formatting.

Parameters
exception:ExceptionException to display.
Returns
NoneThis method does not return any value.
def exitError(self, message: str | None = None): (source)

Exit the program with an error message.

Parameters
message:str, optionalError message to print before exiting.
Returns
NoneThis method does not return any value.
def exitSuccess(self, message: str | None = None): (source)

Exit the program with a success message.

Parameters
message:str or None, optionalSuccess message to print before exiting.
Returns
NoneThis method does not return any value.
def fail(self, message: str, *, timestamp: bool = True): (source)

Print a failure message with a red background.

Notes

Uses ANSI escape codes for fail style.

Parameters
message:strFailure message to print.
timestamp:bool, optionalIf True, include a timestamp (default is True).
Returns
NoneThis method does not return any value.
def info(self, message: str, *, timestamp: bool = True): (source)

Print an informational message with a blue background.

Parameters
message:strInformational message to print.
timestamp:bool, optionalIf True, include a timestamp (default is True).
Returns
NoneThis method does not return any value.

Print a horizontal line in the console.

Notes

Outputs a newline character as a visual separator.

Returns
NoneThis method does not return any value.
def newLine(self, count: int = 1): (source)

Print multiple new lines.

Parameters
count:int, optionalNumber of new lines to print (default is 1).
Returns
NoneThis method does not return any value.
Raises
ValueErrorIf count is less than or equal to 0.
def secret(self, question: str) -> str: (source)

Prompt for hidden input using the provided question.

Notes

Uses getpass to hide input, suitable for passwords.

Parameters
question:strPrompt message for the user.
Returns
strUser's hidden input as a string.
async def sleep(self, seconds: float): (source)

Asynchronously sleep for a specified number of seconds.

Parameters
seconds:floatNumber of seconds to sleep.
Returns
NoneThis method does not return any value.
def success(self, message: str, *, timestamp: bool = True): (source)

Print a success message with a green background.

Parameters
message:strSuccess message to print.
timestamp:bool, optionalIf True, include a timestamp (default is True).
Returns
NoneThis method does not return any value.
def table(self, headers: list, rows: list): (source)

Print a formatted table with bold headers and box-drawing borders.

Notes

Adjust column widths dynamically and use bold for headers.

Parameters
headers:list of strColumn headers for the table.
rows:list of list of strTable rows, each as a list of column values.
Returns
NoneThis method does not return any value.
Raises
ValueErrorIf headers or rows are empty.
def textError(self, message: str): (source)

Print an error message in red.

Notes

Uses ANSI escape codes for error style.

Parameters
message:strError message to print.
Returns
NoneThis method does not return any value.
def textErrorBold(self, message: str): (source)

Print a bold error message in red.

Notes

Uses ANSI escape codes for bold error style.

Parameters
message:strError message to print.
Returns
NoneThis method does not return any value.
def textInfo(self, message: str): (source)

Print an informational message in blue.

Parameters
message:strInformational message to print.
Returns
NoneThis method does not return any value.
def textInfoBold(self, message: str): (source)

Print a bold informational message in blue.

Parameters
message:strInformational message to print.
Returns
NoneThis method does not return any value.
def textMuted(self, message: str): (source)

Print a muted (gray) message.

Notes

Uses ANSI escape codes for muted style.

Parameters
message:strMessage to print.
Returns
NoneThis method does not return any value.
def textMutedBold(self, message: str): (source)

Print a bold muted (gray) message.

Notes

Uses ANSI escape codes for bold muted style.

Parameters
message:strMessage to print.
Returns
NoneThis method does not return any value.
def textSuccess(self, message: str): (source)

Print a success message in green.

Parameters
message:strSuccess message to print.
Returns
NoneThis method does not return any value.
def textSuccessBold(self, message: str): (source)

Print a bold success message in green.

Parameters
message:strSuccess message to print.
Returns
NoneThis method does not return any value.
def textUnderline(self, message: str): (source)

Print an underlined message.

Notes

Uses ANSI escape codes for underline style.

Parameters
message:strMessage to print.
Returns
NoneThis method does not return any value.
def textWarning(self, message: str): (source)

Print a warning message in yellow.

Notes

Uses ANSI escape codes for warning style.

Parameters
message:strWarning message to print.
Returns
NoneThis method does not return any value.
def textWarningBold(self, message: str): (source)

Print a bold warning message in yellow.

Notes

Uses ANSI escape codes for bold warning style.

Parameters
message:strWarning message to print.
Returns
NoneThis method does not return any value.
def warning(self, message: str, *, timestamp: bool = True): (source)

Print a warning message with a yellow background.

Notes

Uses ANSI escape codes for warning style.

Parameters
message:strWarning message to print.
timestamp:bool, optionalIf True, include a timestamp (default is True).
Returns
NoneThis method does not return any value.
def write(self, *values: object, sep: str | None = ' ', end: str | None = '\n', file: SupportsWrite[str] | None = None, flush: bool = False): (source)

Write values to the output stream and move to the next line.

Parameters
*values:objectValues to print.
sep:str | None, optionalSeparator between values. Defaults to " ".
end:str | None, optionalString appended after the last value. Defaults to "n".
file:SupportsWrite[str] | None, optionalOutput stream. Defaults to sys.stdout.
flush:bool, optionalWhether to forcibly flush the stream. Defaults to False.
Returns
NoneThis method prints values and returns None.
def writeLine(self, message: str): (source)

Print a message and move to the next line.

Parameters
message:strMessage to print.
Returns
NoneThis method does not return any value.

Get a new instance of the ProgressBar class.

Returns
IProgressBarA new instance of the ProgressBar class.