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

Join source cleanup before propagating delivery errors or cancellation.

Method __aiter__ Return this stream as its single-consumer asynchronous iterator.
Async Method __anext__ Return the next source item and close on exhaustion or failure.
Method __init__ Take lazy ownership of a synchronous or asynchronous iterator.
Async Method _close Share cleanup while transferring its primary incident to the owned task.
Async Method _closeOwned Close the source before releasing its nested owner.
Async Method aclose Await one shared cleanup task across repeated close calls.
Class Variable __slots__ Declare the instance attribute slots reserved by this class.
Instance Variable _cleanup Cleanup task shared by callers closing the owned stream.
Instance Variable _closed Whether this resource has completed its close lifecycle.
Instance Variable _owner Value supplied for owner.
Instance Variable _source Source whose values or lifecycle are consumed by this operation.
def __aiter__(self) -> AsyncIterator[T]: (source)

Return this stream as its single-consumer asynchronous iterator.

Returns
collections.abc.AsyncIterator[T]This stream, without creating or advancing another iterator.
async def __anext__(self) -> T: (source)

Return the next source item and close on exhaustion or failure.

Returns
TNext value from the owned synchronous or asynchronous iterator.
Raises
StopAsyncIterationIf the stream is closed or exhausted and cleanup succeeds.
BaseExceptionIf iteration or cleanup fails. Preserve an iteration failure when cleanup also fails; surface cleanup errors after normal exhaustion. Genuine caller cancellation propagates after cleanup is drained.
def __init__(self, source: AsyncIterator[T] | Iterator[T], owner: OwnedStream[object] | None = None): (source)

Take lazy ownership of a synchronous or asynchronous iterator.

Parameters
source:AsyncIterator[T] or Iterator[T]Iterator whose values and cleanup lifecycle this stream owns.
owner:orionis.mcp.streams.OwnedStream[object] or None, optionalNested owner to close after this source, even if iteration never begins.
Returns
NoneStore source and owner without advancing either iterator.
async def _close(self, *, parent_event_id: str | None = None): (source)

Share cleanup while transferring its primary incident to the owned task.

Parameters
parent_event_id:str or None, optionalProducer incident associated with failures during resource closure.
Returns
NoneJoin the existing cleanup or start it once with causal metadata.
async def _closeOwned(self, parent_event_id: str | None = None): (source)

Close the source before releasing its nested owner.

Prefer aclose over close and release the owner even when source cleanup fails or iteration never started.

Parameters
parent_event_id:str or None, optionalProducer incident transferred without changing exception chains.
Returns
NoneComplete available source hooks and nested-owner cleanup.
Raises
BaseExceptionIf either cleanup fails; retain the source failure as primary when both source and owner cleanup fail.
async def aclose(self): (source)

Await one shared cleanup task across repeated close calls.

Returns
NoneFinish source and nested-owner cleanup without starting another task.
Raises
BaseExceptionIf cleanup fails, or if caller cancellation must propagate after cleanup has finished.
__slots__: tuple[str, ...] = (source)

Declare the instance attribute slots reserved by this class.

Cleanup task shared by callers closing the owned stream.

Whether this resource has completed its close lifecycle.

Value supplied for owner.

Source whose values or lifecycle are consumed by this operation.