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 VarDumper(IVarDumper): (source)

Constructor: VarDumper()

View In Hierarchy

Format Python values for structured console inspection.

Method __forceExit Terminate the program if the force exit flag is set.
Method __init__ Initialize the VarDumper instance with default configuration.
Method __makeConsole Create and return a configured Console instance for output formatting.
Method __makePanel Create a Rich Panel with a pretty-printed representation of the value.
Method __makePretty Format a value consistently for terminal and HTML output.
Method __printLine Print a blank line to the console if requested.
Method __redirectOutput Redirect standard output and error streams temporarily.
Method __render Render the stored values to the selected console without exiting.
Method __resolveCallerInfo Resolve and set the caller's module path and line number.
Method __storeClonedValue Clone the given value using deep copy and store its type information.
Method expandAll Set whether to expand all nested data structures.
Method forceExit Set whether to terminate the program after dumping.
Method lineNumber Set the line number for header display.
Method maxDepth Set the maximum depth for nested structures.
Method modulePath Set the module path to display in the header.
Method print Print the stored values to the console in a formatted manner.
Method redirectOutput Set whether to temporarily restore stdout/stderr during output.
Method showIndex Set whether to display an index number for each argument.
Method showTypes Set whether to display the type of each argument in the panel title.
Method toHtml Generate the HTML representation of the dumped output.
Method value Add a value to be dumped.
Method values Receive and store multiple values to be dumped.
Instance Variable __args Store the arguments to be dumped.
Instance Variable __console Create a Console instance for output formatting.
Instance Variable __expand_all Set whether to expand all nested structures.
Instance Variable __force_exit Set whether to force program exit after dumping.
Instance Variable __html_line_number Current line number used when rendering inspected values as HTML.
Instance Variable __html_module_path HTML capture must not replace the terminal's module header.
Instance Variable __last_index Initialize the last index for tracking.
Instance Variable __line_number Store the line number for display in the header.
Instance Variable __max_depth Set the maximum depth for nested structures; None means unlimited.
Instance Variable __module_path Store the module path for display in the header.
Instance Variable __original_stderr Standard-error stream restored after temporary redirection.
Instance Variable __original_stdout Standard-output stream restored after temporary redirection.
Instance Variable __redirect_output Set whether to redirect output streams during dumping.
Instance Variable __redirected_output Redirected output flag used by VarDumper.
Instance Variable __show_index Set whether to show index numbers in output.
Instance Variable __show_types Set whether to show types in output.
def __forceExit(self): (source)

Terminate the program if the force exit flag is set.

If the internal force exit flag is True, terminate the program using os._exit(1) or sys.exit(1) depending on the redirect output flag.

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

Initialize the VarDumper instance with default configuration.

Sets up internal state for variable dumping, including display options, output formatting, and argument storage.

Returns
NoneThis method does not return a value.
def __makeConsole(self, *, file: TextIO | None = None) -> Console: (source)

Create and return a configured Console instance for output formatting.

Parameters
file:typing.TextIO or None, optionalOutput stream; None uses the terminal's standard output.
Returns
orionis.console.ConsoleA Console object with a custom theme for variable dumping and recording enabled.
def __makePanel(self, value: type[T], _type: str, *, console: Console) -> Panel: (source)

Create a Rich Panel with a pretty-printed representation of the value.

Notes

Uses internal configuration for indentation, expansion, and panel width.

Parameters
value:type[orionis.console.output.var_dumper.T]Object to be pretty-printed inside the panel.
_type:strType name of the value for display in the panel title.
console:orionis.console.ConsoleConsole whose width is used to size the panel.
Returns
rich.panel.PanelRich Panel object displaying the formatted content.
def __makePretty(self, value: object) -> Pretty: (source)

Format a value consistently for terminal and HTML output.

Parameters
value:objectStored value to format.
Returns
rich.pretty.PrettyValue formatted with the configured expansion and depth.
def __printLine(self, *, insert_line: bool = False): (source)

Print a blank line to the console if requested.

Notes

Prints a blank line to the standard output if insert_line is True.

Parameters
insert_line:bool, optionalIf True, print a blank line. Default is False.
Returns
NoneThis method does not return a value.
def __redirectOutput(self): (source)

Redirect standard output and error streams temporarily.

If output redirection is enabled and not already redirected, this method saves the current stdout and stderr, then redirects them to the original system streams. If already redirected, it restores stdout and stderr to their previously saved values.

Returns
NoneThis method does not return a value.
def __render(self, console: Console, *, show_header: bool): (source)

Render the stored values to the selected console without exiting.

Parameters
console:orionis.console.ConsoleDestination for the formatted output.
show_header:boolWhether to include the caller's module and line.
Returns
NoneWrite the formatted values to the selected console.
def __resolveCallerInfo(self, *, html: bool = False): (source)

Resolve and set the caller's module path and line number.

If the internal module path or line number is not set, this method uses the inspect module to retrieve the caller's frame and extract the relevant information. If the frame is unavailable, it sets default values.

Parameters
html:bool, optionalCapture the filename separately from the terminal's module name.
Returns
NoneThis method does not return any value.
def __storeClonedValue(self, value: type[T]): (source)

Clone the given value using deep copy and store its type information.

Notes

The type information is obtained from the __name__ attribute of the value's type.

Parameters
value:type[orionis.console.output.var_dumper.T]Value to be cloned.
Returns
NoneThis method does not return a value.
def expandAll(self, *, expand: bool = True) -> VarDumper: (source)

Set whether to expand all nested data structures.

Parameters
expand:bool, optionalIf True, expands all nested data structures. Default is True.
Returns
orionis.console.output.var_dumper.VarDumperThe current instance with updated expand all setting.
def forceExit(self, *, force: bool = True) -> VarDumper: (source)

Set whether to terminate the program after dumping.

Parameters
force:bool, optionalIf True, the program will terminate after dumping. Default is True.
Returns
orionis.console.output.var_dumper.VarDumperReturns the current instance with the updated force exit setting.
Raises
TypeErrorIf 'force' is not of type bool.
def lineNumber(self, number: int | None) -> VarDumper: (source)

Set the line number for header display.

Parameters
number:int or NoneLine number to display in the header.
Returns
orionis.console.output.var_dumper.VarDumperReturns self with updated line number.
Raises
TypeErrorIf 'number' is not of type int or None.
def maxDepth(self, depth: int | None) -> VarDumper: (source)

Set the maximum depth for nested structures.

Parameters
depth:int or NoneMaximum depth for nested structures. None means unlimited.
Returns
orionis.console.output.var_dumper.VarDumperReturns self with updated max depth.
Raises
TypeErrorIf 'depth' is not int or None.
def modulePath(self, path: str | None) -> VarDumper: (source)

Set the module path to display in the header.

Parameters
path:str or NoneModule path to display in the header.
Returns
orionis.console.output.var_dumper.VarDumperReturns the current instance with updated module path.
Raises
TypeErrorIf 'path' is not of type str or None.
def print(self, *, insert_line: bool = False): (source)

Print the stored values to the console in a formatted manner.

Optionally inserts a blank line before and after the output, resolves caller information, prints a header with module and line details, and displays each stored value in a styled panel. Handles optional output redirection and program termination.

Parameters
insert_line:bool, optionalIf True, insert a blank line before and after the output. Default is False.
Returns
NoneThis method does not return any value.
def redirectOutput(self, *, redirect: bool = True) -> VarDumper: (source)

Set whether to temporarily restore stdout/stderr during output.

Parameters
redirect:bool, optionalIf True, temporarily restores stdout and stderr to their original streams during output. Default is True.
Returns
orionis.console.output.var_dumper.VarDumperThe current instance with the updated redirect output setting.
Raises
TypeErrorIf 'redirect' is not of type bool.
def showIndex(self, *, show: bool = True) -> VarDumper: (source)

Set whether to display an index number for each argument.

Parameters
show:bool, optionalIf True, show an index number for each argument. Default is True.
Returns
orionis.console.output.var_dumper.VarDumperThe current instance with updated show index setting.
def showTypes(self, *, show: bool = True) -> VarDumper: (source)

Set whether to display the type of each argument in the panel title.

Parameters
show:bool, optionalIf True, display the type of each argument in the panel title. Default is True.
Returns
orionis.console.output.var_dumper.VarDumperThe current instance with updated show types setting.
def toHtml(self, *, insert_line: bool = False) -> str: (source)

Generate the HTML representation of the dumped output.

Notes

Renders to an isolated in-memory console and exports with a light diagnostic palette and native HTML panels with inline styles. Does not write to stdout or stderr, redirect streams, or terminate execution, regardless of console options. Panel headers show the source filename and line, using configured values or the first HTML export's caller. HTML source metadata and indices do not affect terminal output.

Parameters
insert_line:bool, optionalIf True, insert a blank line before and after the output. Default is False.
Returns
strHTML fragment containing the formatted dumped output.
def value(self, value: type[T]) -> VarDumper: (source)

Add a value to be dumped.

Notes

The value is deep-copied and stored internally for later output.

Parameters
value:type[orionis.console.output.var_dumper.T]The value to be stored for dumping.
Returns
orionis.console.output.var_dumper.VarDumperReturns the current instance for method chaining.
def values(self, *args: tuple | list) -> VarDumper: (source)

Receive and store multiple values to be dumped.

Parameters
*args:tupleValues to be dumped.
Returns
orionis.console.output.var_dumper.VarDumperReturns the current instance for method chaining.
Raises
TypeErrorIf 'args' is not of type tuple or list.

Store the arguments to be dumped.

__console: Console = (source)

Create a Console instance for output formatting.

__expand_all: bool = (source)

Set whether to expand all nested structures.

__force_exit: bool = (source)

Set whether to force program exit after dumping.

__html_line_number: int | str | None = (source)

Current line number used when rendering inspected values as HTML.

__html_module_path: str | None = (source)

HTML capture must not replace the terminal's module header.

__last_index: int = (source)

Initialize the last index for tracking.

__line_number: int | str | None = (source)

Store the line number for display in the header.

__max_depth: int | None = (source)

Set the maximum depth for nested structures; None means unlimited.

__module_path: str | None = (source)

Store the module path for display in the header.

__original_stderr: Any = (source)

Standard-error stream restored after temporary redirection.

__original_stdout: Any = (source)

Standard-output stream restored after temporary redirection.

__redirect_output: bool = (source)

Set whether to redirect output streams during dumping.

__redirected_output: bool = (source)

Redirected output flag used by VarDumper.

__show_index: bool = (source)

Set whether to show index numbers in output.

__show_types: bool = (source)

Set whether to show types in output.