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.
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 | _normalise |
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 |
Synchronization primitive controlling access to load lock. |
Convert a template identifier to a Jinja2-loader-compatible path.
Rules applied in order
- If the identifier already contains / it is treated as a direct path and returned unchanged (except for extension injection).
- Otherwise dot separators are converted to slashes.
- A '.html' extension is appended when no file extension is present.
| Parameters | |
template:str | Raw template identifier supplied by the caller. |
| Returns | |
str | Normalised template path suitable for jinja2.Environment.get_template. |
Initialise the engine with the configured view environment.
| Parameters | |
environment:orionis.view.contracts.environment.IViewEnvironment | View environment providing the configured Jinja2 Environment instance. |
| Returns | |
None | No return value. |
Serialize loader and compiler access to this environment.
| Parameters | |
path:str | Template path resolved within the configured environment. |
| Returns | |
jinja2.Template | Loaded and compiled template from the environment cache or loader. |
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:str | Template 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 | |
str | Rendered HTML string. |
| Raises | |
orionis.view.exceptions.ViewTemplateNotFoundException | When the template file cannot be located by the configured loaders. |
orionis.view.exceptions.ViewRenderException | When Jinja2 raises a template error while loading or rendering. |
orionis.support.concurrency.WorkQueueFullError | When the bounded template workers cannot admit a cold load. |