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.

module documentation

Provide http adapters response operations.

Includes close_stream, await_cleanup, send_until_disconnect.

Class _SyncStreamIterator Own a synchronous byte source before its first asynchronous read.
Async Function _cancel_tasks Cancel and join both owned tasks without abandoning asynchronous cleanup.
Async Function _finish_cancelled_cleanup Join owned cleanup after cancellation and retain its failure cause.
Function _raise_task_errors Propagate real sender and watcher failures after both tasks finish.
Function _record_completion Record the first completed future in event-loop callback order.
Async Function await_cleanup Await owned cleanup before propagating cancellation to its caller.
Async Function close_stream Close an iterator without letting cleanup erase a delivery failure.
Async Function send_until_disconnect Race a stream delivery against the transport's disconnect notification.
Constant _CLEANUP_PHASE Central reporting phase shared by response-stream finalizers.
async def _cancel_tasks(tasks: tuple[Task[None], Task[None]]): (source)

Cancel and join both owned tasks without abandoning asynchronous cleanup.

Parameters
tasks:tuple[asyncio.Task[None], asyncio.Task[None]]Sender and disconnect watcher owned by one response.
Returns
NoneFinish both tasks before propagating their errors or cancellation.
async def _finish_cancelled_cleanup(pending: Future[T], ready: Future[Future[T]]): (source)

Join owned cleanup after cancellation and retain its failure cause.

Parameters
pending:asyncio.Future[T]Cleanup operation which must finish before its owner returns.
ready:asyncio.Future[asyncio.Future[T]]Completion notification carrying no cleanup exception.
Returns
NoneFinish cleanup while deferring additional cancellation requests.
def _raise_task_errors(results: list[BaseException | None]): (source)

Propagate real sender and watcher failures after both tasks finish.

Parameters
results:list[BaseException | None]Outcomes collected from both owned response tasks.
Returns
NoneReturn when both tasks succeeded or were cancelled.
Raises
BaseExceptionPreserve one failure or group simultaneous failures.
def _record_completion(first: Future[Future[T]], completed: Future[T]): (source)

Record the first completed future in event-loop callback order.

Parameters
first:asyncio.Future[asyncio.Future[T]]Completion notification awaited by the stream coordinator or cleanup.
completed:asyncio.Future[T]Operation whose completion triggered this callback.
Returns
NonePreserve the first completion without changing a cancelled result.
async def await_cleanup(pending: Future[T]) -> T: (source)

Await owned cleanup before propagating cancellation to its caller.

Parameters
pending:asyncio.Future[T]Cleanup operation protected from cancellation of its owner.
Returns
TCompleted cleanup result when the owner was not cancelled.
Raises
BaseExceptionPropagate cleanup failure, or cancellation after successful cleanup.
async def close_stream(iterator: AsyncIterable[bytes] | None, failure: BaseException | None): (source)

Close an iterator without letting cleanup erase a delivery failure.

Parameters
iterator:collections.abc.AsyncIterable[bytes] | NoneOwned source whose optional asynchronous close must be awaited, if present.
failure:BaseException | NoneProducer or transport failure already propagating through cleanup.
Returns
NoneFinish cleanup, retaining a real delivery error if cancellation races it.
async def send_until_disconnect(sending: Coroutine[None, None, None], disconnected: Coroutine[None, None, None]) -> bool: (source)

Race a stream delivery against the transport's disconnect notification.

Parameters
sending:collections.abc.Coroutine[None, None, None]Delivery operation, including iterator cleanup and final framing.
disconnected:collections.abc.Coroutine[None, None, None]Operation returning when the client disconnects.
Returns
boolWhether delivery completed before the disconnect watcher.
Raises
BaseExceptionPropagate delivery, notification, cleanup errors or request cancellation.
_CLEANUP_PHASE: str = (source)

Central reporting phase shared by response-stream finalizers.

Value
'stream.cleanup'