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

Represent an awaitable, chainable template rendering result.

Created by orionis.view.contracts.factory.IViewFactory.make.

Rendering is deferred until the object is awaited, so response mutators such as withInput(), withErrors(), withFlash() or withCookie() can be chained directly on the make() call:

return await View.make("auth.login").withErrors(errors)

Callable attributes on orionis.http.HTMLResponse are accepted and replayed on the real response once the template has been rendered. Initial response options are applied before queued mutations, in call order.

Method __await__ Render the template and apply every queued mutation.
Async Method __flashToSession Write the queued flash data into the active session.
Method __getattr__ Queue a orionis.http.HTMLResponse call to replay after rendering.
Method __init__ Store the rendering intent without performing any work.
Method __queueMutation Retain a response mutation in call order without rendering.
Async Method render Render the template into a fully formed orionis.http.HTMLResponse.
Method withBackground Queue a background task change and return the pending view.
Method withHeaders Queue response headers and return the pending view.
Method withStatusCode Queue an HTTP status change and return the pending view.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _background Initial background task, executed only after response delivery.
Instance Variable _context Template variables forwarded to the engine.
Instance Variable _engine Engine used to render the template once awaited.
Instance Variable _flash Session values scheduled for availability during the next request.
Instance Variable _headers Initial response headers, separate from template variables.
Instance Variable _mutations Response changes queued while configuring the pending view.
Instance Variable _status_code Initial HTTP status code, validated when the view is rendered.
Instance Variable _template Template name using dot notation or a relative path.

Inherited from _FlashData:

Method withErrors Flash validation errors for the next request.
Method withFlash Queue a status message for the owning response or pending view.
Method withInput Flash the submitted payload so the next request can repopulate it.
def __await__(self: Self) -> Generator[Any, None, HTMLResponse]: (source)

Render the template and apply every queued mutation.

Returns
collections.abc.Generator[typing.Any, None, orionis.http.HTMLResponse]Generator yielding control until the response is ready.
async def __flashToSession(self: Self): (source)

Write the queued flash data into the active session.

Skip writes when the session is unavailable, such as on routes without session middleware, and centrally observe unexpected resolution failures.

Returns
NoneNo return value.
def __getattr__(self: Self, name: str) -> Callable[..., PendingView]: (source)

Queue a orionis.http.HTMLResponse call to replay after rendering.

Parameters
name:strName of the response method being chained.
Returns
collections.abc.Callable[..., orionis.view.pending.PendingView]Callable that records the invocation and returns self.
Raises
AttributeErrorIf orionis.http.HTMLResponse exposes no callable named name.
def __init__(self: Self, engine: IViewEngine, template: str, context: dict[str, Any], *, status_code: HTTPStatus | int = 200, headers: Mapping[str, str] | None = None, background: BackgroundTask | None = None): (source)

Store the rendering intent without performing any work.

Parameters
engine:orionis.view.contracts.engine.IViewEngineEngine used to render the template once awaited.
template:strTemplate name using dot notation or a relative path.
context:dict[str, typing.Any]Template variables forwarded to the engine.
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.
Returns
NoneNo return value.
def __queueMutation(self: Self, name: str, /, *args: Any, **kwargs: Any) -> Self: (source)

Retain a response mutation in call order without rendering.

Parameters
name:strName of the response method to invoke after rendering.
*args:typing.AnyPositional arguments for the response method.
**kwargs:typing.AnyKeyword arguments for the response method.
Returns
SelfThe same pending view for fluent chaining.
async def render(self: Self) -> HTMLResponse: (source)

Render the template into a fully formed orionis.http.HTMLResponse.

Returns
orionis.http.HTMLResponseAn HTTP response whose body is the rendered HTML content.
Raises
orionis.view.exceptions.ViewTemplateNotFoundExceptionWhen the view file cannot be located.
orionis.view.exceptions.ViewRenderExceptionWhen rendering fails for any reason.
orionis.support.concurrency.WorkQueueFullErrorWhen the engine's template loading workers are saturated.
TypeErrorWhen response options have incompatible types.
ValueErrorWhen a response status code is outside the supported range.
def withBackground(self: Self, background: BackgroundTask | None) -> Self: (source)

Queue a background task change and return the pending view.

Parameters
background:orionis.background.BackgroundTask | NoneTask to run after delivery, or None to clear the current task. Validated when the view is awaited.
Returns
SelfThe same pending view for fluent chaining.
def withHeaders(self: Self, headers: Mapping[str, str]) -> Self: (source)

Queue response headers and return the pending view.

Parameters
headers:collections.abc.Mapping[str, str]Headers to merge, replacing matching names without regard to case. Unrelated headers remain unchanged.
Returns
SelfThe same pending view for fluent chaining.
def withStatusCode(self: Self, status_code: HTTPStatus | int) -> Self: (source)

Queue an HTTP status change and return the pending view.

Parameters
status_code:orionis.http.enums.HTTPStatus | intHTTP status code, validated when the view is awaited.
Returns
SelfThe same pending view for fluent chaining.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

_background: BackgroundTask | None = (source)

Initial background task, executed only after response delivery.

_context: dict[str, Any] = (source)

Template variables forwarded to the engine.

Engine used to render the template once awaited.

Session values scheduled for availability during the next request.

Initial response headers, separate from template variables.

Response changes queued while configuring the pending view.

_status_code: HTTPStatus | int = (source)

Initial HTTP status code, validated when the view is rendered.

_template: str = (source)

Template name using dot notation or a relative path.