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 support operations.

Includes WorkQueueFullError, wait_for_completion, complete_on_cancel, close_abandoned_awaitable, BoundedExecutor, threaded.

Class BoundedExecutor Own a lazy thread pool with bounded running and queued work.
Exception WorkQueueFullError Signal that a bounded worker pool cannot admit another operation.
Function _cancel_abandoned_future Cancel an abandoned future or raise its already completed failure.
Function close_abandoned_awaitable Release an awaitable that its cancelled owner cannot consume.
Async Function complete_on_cancel Wait for owned work before propagating caller cancellation.
Function threaded Opt a synchronous handler into bounded thread execution.
Async Function wait_for_completion Await completion without cancelling work or copying its exception.
Constant _CALLBACK_WORKERS Callback workers used by concurrency.
def _cancel_abandoned_future(future: asyncio.Future[object]): (source)

Cancel an abandoned future or raise its already completed failure.

Parameters
future:asyncio.Future[object]Abandoned future accessed on its owning loop.
Returns
NoneNo return value.
Raises
BaseExceptionOriginal failure if completion occurred before cancellation.
def close_abandoned_awaitable(result: object, *, on_error: Callable[[Exception], object]): (source)

Release an awaitable that its cancelled owner cannot consume.

Request cancellation of futures on their owning open loops. Close other awaitables only when they expose a synchronous close operation.

Parameters
result:objectResult produced after its owner has stopped awaiting it.
on_error:collections.abc.Callable[[Exception], object]Observer for failures deferred to another future's owning loop.
Returns
NoneNo return value.
Raises
ExceptionIf closing the awaitable or scheduling cancellation fails for a reason other than the owning loop already being closed.
async def complete_on_cancel(awaitable: Awaitable[T], *, on_cancel: Callable[[], object] | None = None) -> T: (source)

Wait for owned work before propagating caller cancellation.

Parameters
awaitable:collections.abc.Awaitable[T]Operation that must finish before its resources can be released.
on_cancel:collections.abc.Callable[[], object] | NoneOptional request to stop work that has not started yet.
Returns
TOperation result unless the caller was cancelled.
def threaded(callback: Callable[P, T]) -> Callable[P, Awaitable[T]]: (source)

Opt a synchronous handler into bounded thread execution.

Parameters
callback:collections.abc.Callable[P, T]Blocking synchronous function. Dependencies must support worker threads.
Returns
collections.abc.Callable[P, collections.abc.Awaitable[T]]Async wrapper preserving the signature used for dependency injection. Context variables propagate; CPU-bound Python still contends for the GIL.
async def wait_for_completion(pending: asyncio.Future[T]) -> T: (source)

Await completion without cancelling work or copying its exception.

Notes

Cancellation only interrupts this wait. The caller remains responsible for draining pending before releasing resources used by its operation.

Parameters
pending:asyncio.Future[T]Owned operation whose result is collected after a successful notice.
Returns
TThe operation's result, preserving its original exception on failure.
_CALLBACK_WORKERS = (source)

Callback workers used by concurrency.

Value
BoundedExecutor(name='orionis-callback')