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

Coordinate terminal signals, development reloads, and worker shutdown.

Keep the CLI alive while the active worker finishes its HTTP lifespan.

Async Function _drain Ask a child to finish its lifecycle and reap it before the launcher returns.
Async Function _run_child Run one generation until it exits, receives an interrupt, or needs reloading.
Async Function _watch Notify the launcher whenever a watched application source changes.
Function shutdown_signals Route terminal interrupts to the running server and restore the caller's handlers.
Async Function supervise Serve successive worker generations within the lifetime of the CLI application.
async def _drain(process: asyncio.subprocess.Process, force: asyncio.Event) -> int: (source)

Ask a child to finish its lifecycle and reap it before the launcher returns.

Parameters
process:asyncio.subprocess.ProcessIsolated Granian supervisor on POSIX or single HTTP worker on Windows.
force:asyncio.EventStop waiting for graceful shutdown after a repeated terminal interrupt.
Returns
intChild exit status, or 130 when the launcher forced it to stop.
async def _run_child(argv: list[str], env: dict[str, str], stop: asyncio.Event, force: asyncio.Event, changed: asyncio.Event) -> int: (source)

Run one generation until it exits, receives an interrupt, or needs reloading.

Parameters
argv:list of strNative executable and arguments.
env:dict of strChild process environment.
stop:asyncio.EventGraceful shutdown, forced shutdown, and source-change notifications.
force:asyncio.EventGraceful shutdown, forced shutdown, and source-change notifications.
changed:asyncio.EventGraceful shutdown, forced shutdown, and source-change notifications.
Returns
intExit status after collecting the child.
async def _watch(paths: tuple[Path, ...], ignored: tuple[Path, ...], changed: asyncio.Event): (source)

Notify the launcher whenever a watched application source changes.

Parameters
paths:tuple of PathExisting application files and directories to monitor.
ignored:tuple of PathFramework output directories excluded from reload.
changed:asyncio.EventWake the active worker generation when a batch of changes arrives.
Returns
NoneSignal each batch of changes until the file watcher closes.
def shutdown_signals(stop: asyncio.Event, force: asyncio.Event) -> Generator[None]: (source)

Route terminal interrupts to the running server and restore the caller's handlers.

Parameters
stop:asyncio.EventRequest graceful shutdown on the first signal.
force:asyncio.EventRelease a stuck child on a repeated signal.
Yields
NoneRun the server while its terminal signal handlers are active on the main thread.
async def supervise(app: IApplication, options: ServeOptions, *, reload: bool, stop: asyncio.Event, force: asyncio.Event) -> int: (source)

Serve successive worker generations within the lifetime of the CLI application.

Parameters
app:IApplicationCreated application supplying paths, lifecycle metadata and import target.
options:ServeOptionsEffective server configuration for this invocation.
reload:boolWhether source changes should replace the active worker.
stop:asyncio.EventTerminal requests to drain or forcibly stop the active child.
force:asyncio.EventTerminal requests to drain or forcibly stop the active child.
Returns
intShell exit status for the CLI kernel to report after shutdown.