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

Prepare named templates for deferred rendering into HTML responses.

Create one orionis.view.pending.PendingView per rendering operation. Call make synchronously to retain the context and queue response mutations. Await the returned value to render through the injected orionis.view.contracts.engine.IViewEngine and obtain an orionis.http.HTMLResponse.

Method __init__ Initialise the factory with a rendering engine.
Method make Prepare a template render as an awaitable, chainable response.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _engine The view engine used to render templates.
def __init__(self, engine: IViewEngine): (source)

Initialise the factory with a rendering engine.

Parameters
engine:orionis.view.contracts.engine.IViewEngineThe view engine used to render templates.
Returns
NoneNo return value.
def make(self, template: str, *, status_code: HTTPStatus | int = 200, headers: Mapping[str, str] | None = None, background: BackgroundTask | None = None, context: Mapping[str, Any] | None = None, **variables: Any) -> PendingView: (source)

Prepare a template render as an awaitable, chainable response.

Notes

Template lookup and rendering errors are raised when the returned value is awaited, rather than when this method prepares it. Response options are also validated on await; chained mutations are applied after the initial options, in call order.

Parameters
template:strTemplate name using dot notation (e.g. 'users.index') or a relative path (e.g. 'users/index.html').
status_code:orionis.http.enums.HTTPStatus | int, optionalHTTP status code for the rendered response.
headers:collections.abc.Mapping[str, str] | None, optionalResponse headers. The SSR marker is added when not supplied.
background:orionis.background.BackgroundTask | None, optionalTask to run after the response is sent.
context:collections.abc.Mapping[str, typing.Any] | None, optionalTemplate variables, including names reserved for response options.
**variables:typing.AnyAdditional template variables, overriding matching context entries.
Returns
orionis.view.pending.PendingViewAwaitable proxy that renders the template on await and accepts chained response mutators such as withStatusCode(), withHeaders(), withBackground() or withErrors().
Raises
TypeErrorIf context is neither a mapping nor None.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

The view engine used to render templates.