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 |
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 |
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. |
Ask a child to finish its lifecycle and reap it before the launcher returns.
| Parameters | |
process:asyncio.subprocess.Process | Isolated Granian supervisor on POSIX or single HTTP worker on Windows. |
force:asyncio.Event | Stop waiting for graceful shutdown after a repeated terminal interrupt. |
| Returns | |
int | Child 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 str | Native executable and arguments. |
env:dict of str | Child process environment. |
stop:asyncio.Event | Graceful shutdown, forced shutdown, and source-change notifications. |
force:asyncio.Event | Graceful shutdown, forced shutdown, and source-change notifications. |
changed:asyncio.Event | Graceful shutdown, forced shutdown, and source-change notifications. |
| Returns | |
int | Exit 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 Path | Existing application files and directories to monitor. |
ignored:tuple of Path | Framework output directories excluded from reload. |
changed:asyncio.Event | Wake the active worker generation when a batch of changes arrives. |
| Returns | |
None | Signal each batch of changes until the file watcher closes. |
Route terminal interrupts to the running server and restore the caller's handlers.
| Parameters | |
stop:asyncio.Event | Request graceful shutdown on the first signal. |
force:asyncio.Event | Release a stuck child on a repeated signal. |
| Yields | |
None | Run 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:IApplication | Created application supplying paths, lifecycle metadata and import target. |
options:ServeOptions | Effective server configuration for this invocation. |
reload:bool | Whether source changes should replace the active worker. |
stop:asyncio.Event | Terminal requests to drain or forcibly stop the active child. |
force:asyncio.Event | Terminal requests to drain or forcibly stop the active child. |
| Returns | |
int | Shell exit status for the CLI kernel to report after shutdown. |