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

Render templates with Jinja2 through the view-engine contract.

Converts dot-notation template names to filesystem paths and delegates all rendering to Jinja2's async rendering pipeline (render_async). The synchronous render method of Jinja2 is never called from this class.

Static Method _normalisePath Convert a template identifier to a Jinja2-loader-compatible path.
Method __init__ Initialise the engine with the configured view environment.
Method _load Serialize loader and compiler access to this environment.
Async Method render Render a template asynchronously using Jinja2.
Async Method warmup Compile known templates before serving requests, without rendering globals.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _environment View environment providing the configured Jinja2 Environment instance.
Instance Variable _jinja The environment instance is built once and mutated in place, so the reference stays valid for the whole application lifetime.
Instance Variable _load_lock Synchronization primitive controlling access to load lock.
def _normalisePath(template: str) -> str: (source)

Convert a template identifier to a Jinja2-loader-compatible path.

Rules applied in order

  1. If the identifier already contains / it is treated as a direct path and returned unchanged (except for extension injection).
  2. Otherwise dot separators are converted to slashes.
  3. A '.html' extension is appended when no file extension is present.
Parameters
template:strRaw template identifier supplied by the caller.
Returns
strNormalised template path suitable for jinja2.Environment.get_template.
def __init__(self: Self, environment: IViewEnvironment): (source)

Initialise the engine with the configured view environment.

Parameters
environment:orionis.view.contracts.environment.IViewEnvironmentView environment providing the configured Jinja2 Environment instance.
Returns
NoneNo return value.
def _load(self: Self, path: str) -> jinja2.Template: (source)

Serialize loader and compiler access to this environment.

Parameters
path:strTemplate path resolved within the configured environment.
Returns
jinja2.TemplateLoaded and compiled template from the environment cache or loader.
async def render(self: Self, template: str, context: dict[str, Any]) -> str: (source)

Render a template asynchronously using Jinja2.

Interpret identifiers without / as dot notation, including their final segment ('users.index' becomes 'users/index.html'). Include / to pass a relative filename with an extension directly.

Parameters
template:strTemplate identifier using dot notation or a direct relative path. A .html suffix is appended when absent.
context:dict[str, typing.Any]Variables made available inside the template during rendering.
Returns
strRendered HTML string.
Raises
orionis.view.exceptions.ViewTemplateNotFoundExceptionWhen the template file cannot be located by the configured loaders.
orionis.view.exceptions.ViewRenderExceptionWhen Jinja2 raises a template error while loading or rendering.
orionis.support.concurrency.WorkQueueFullErrorWhen the bounded template workers cannot admit a cold load.
async def warmup(self: Self, *templates: str): (source)

Compile known templates before serving requests, without rendering globals.

Parameters
*templates:strTemplate identifiers, including known includes and parent templates.
Returns
NoneNo return value.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

View environment providing the configured Jinja2 Environment instance.

_jinja: jinja2.Environment = (source)

The environment instance is built once and mutated in place, so the reference stays valid for the whole application lifetime.

_load_lock = (source)

Synchronization primitive controlling access to load lock.