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.
Provide support operations.
Includes WorkQueueFullError, wait_for_completion, complete_on_cancel, close_abandoned_awaitable, BoundedExecutor, threaded.
| Class | |
Own a lazy thread pool with bounded running and queued work. |
| Exception | |
Signal that a bounded worker pool cannot admit another operation. |
| Function | _cancel |
Cancel an abandoned future or raise its already completed failure. |
| Function | close |
Release an awaitable that its cancelled owner cannot consume. |
| Async Function | complete |
Wait for owned work before propagating caller cancellation. |
| Function | threaded |
Opt a synchronous handler into bounded thread execution. |
| Async Function | wait |
Await completion without cancelling work or copying its exception. |
| Constant | _CALLBACK |
Callback workers used by concurrency. |
Cancel an abandoned future or raise its already completed failure.
| Parameters | |
future:asyncio.Future[object] | Abandoned future accessed on its owning loop. |
| Returns | |
None | No return value. |
| Raises | |
BaseException | Original failure if completion occurred before cancellation. |
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:object | Result produced after its owner has stopped awaiting it. |
oncollections.abc.Callable[[Exception], object] | Observer for failures deferred to another future's owning loop. |
| Returns | |
None | No return value. |
| Raises | |
Exception | If closing the awaitable or scheduling cancellation fails for a reason other than the owning loop already being closed. |
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. |
oncollections.abc.Callable[[], object] | None | Optional request to stop work that has not started yet. |
| Returns | |
T | Operation result unless the caller was cancelled. |
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. |
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 | |
T | The operation's result, preserving its original exception on failure. |