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

Load and render source templates used by code-generation commands.

Method __compileFilenameAndClassname Compile the generated filename and class name.
Method __init__ Initialize a stub generator.
Method __loadTemplate Load the requested stub template.
Method __parseName Normalize a generated name and reject unsafe path components.
Method __replaceTemplateContent Replace placeholders in the loaded template.
Method create Create the generated source file.
Method render Render a packaged template without choosing a destination.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _class_name Name used to derive the generated filename and class name.
Instance Variable _classname Python class name substituted into the generated source.
Instance Variable _directory_parts Path components locating the generated resource directory.
Instance Variable _filename Filename used when rendering or storing the resource.
Instance Variable _postfix Suffix appended to the derived filename and class name.
Instance Variable _prefix Prefix prepended to the derived filename and class name.
Instance Variable _replacements Placeholder values to apply to the loaded template.
Instance Variable _template_name Name of the template file without its .stub suffix.
def __compileFilenameAndClassname(self): (source)

Compile the generated filename and class name.

Returns
NoneThe derived filename and class name are stored on the instance.
Raises
ValueErrorIf the generated filename does not match the accepted format.
def __init__(self, template_name: str, class_name: str, prefix: str | None = None, postfix: str | None = None, replacements: dict[str, str] | None = None): (source)

Initialize a stub generator.

Parameters
template_name:strName of the template file without its .stub suffix.
class_name:strName used to derive the generated filename and class name.
prefix:str | None, optionalPrefix prepended to the derived filename and class name.
postfix:str | None, optionalSuffix appended to the derived filename and class name.
replacements:dict[str, str] | None, optionalPlaceholder values to apply to the loaded template.
Returns
NoneThe instance is initialized in place.
def __loadTemplate(self) -> str: (source)

Load the requested stub template.

Returns
strThe unmodified template content.
Raises
FileNotFoundErrorIf the requested stub file does not exist.
ValueErrorIf the template name does not identify a packaged stub.
def __parseName(self) -> tuple[str, ...]: (source)

Normalize a generated name and reject unsafe path components.

Returns
tuple[str, ...]Directory components followed by the file stem.
Raises
ValueErrorIf the name is empty, absolute, traverses a parent directory, or contains a component that cannot form a Python module name.
def __replaceTemplateContent(self, content: str) -> str: (source)

Replace placeholders in the loaded template.

Parameters
content:strTemplate content to update.
Returns
strTemplate content with the class name and replacements applied.
Raises
TypeErrorIf a replacement key or value is not a string.
def create(self, directory: Path, relative_to: Path | None = None, extension: str = 'py') -> str: (source)

Create the generated source file.

Parameters
directory:pathlib.PathDirectory where the generated Python file is created.
relative_to:pathlib.Path | None, optionalPath to which the generated file path should be made relative. Both paths are resolved before computing the relative path. If None, the file path is returned as an absolute path.
extension:str, optionalFile extension for the generated Python file. Defaults to "py".
Returns
strPath to the generated file as a string.
Raises
FileNotFoundErrorIf the requested stub template does not exist.
TypeErrorIf a replacement key or value is not a string.
ValueErrorIf the generated filename, template name, or extension is invalid, or the resolved file is outside relative_to.
def render(self) -> str: (source)

Render a packaged template without choosing a destination.

Returns
strTemplate content with its class name and replacements applied.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

_class_name: str = (source)

Name used to derive the generated filename and class name.

_classname: str | None = (source)

Python class name substituted into the generated source.

_directory_parts: tuple[str, ...] = (source)

Path components locating the generated resource directory.

_filename: str | None = (source)

Filename used when rendering or storing the resource.

_postfix: str | None = (source)

Suffix appended to the derived filename and class name.

_prefix: str | None = (source)

Prefix prepended to the derived filename and class name.

_replacements: dict[str, str] | None = (source)

Placeholder values to apply to the loaded template.

_template_name: str = (source)

Name of the template file without its .stub suffix.