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.
Undocumented
| Static Method | __is |
Detect whether a Python debugger is currently attached. |
| Method | __append |
Resolve and append host and port arguments to the command. |
| Method | __append |
Append the selected interface type to the command. |
| Method | __append |
Append the logging-level flags to the command. |
| Method | __append |
Append the event-loop backend to the command. |
| Method | __append |
Append the process name to the command. |
| Method | __append |
Append hot-reload flags and watched directories to the command. |
| Method | __append |
Append the static-file mount path and URL route to the command. |
| Method | __append |
Append the worker-process count to the command. |
| Method | __configure |
Configure bytecode-writing flags based on the current environment. |
| Async Method | __embedded |
Start the server in-process using Granian's embedded backend. |
| Method | __init__ |
Initialize command arguments and server launch state. |
| Method | __init |
Build a fresh environment dictionary with Orionis metadata. |
| Method | __set |
Assign the application shutdown coroutine for later invocation. |
| Method | __unix |
Replace the current process with the Granian server via execvpe. |
| Async Method | __windows |
Launch Granian as a managed subprocess on Windows. |
| Async Method | handle |
Build the Granian command and start the HTTP server. |
| Class Variable | arguments |
Undocumented |
| Class Variable | description |
Undocumented |
| Class Variable | signature |
Undocumented |
| Class Variable | timestamps |
Undocumented |
| Instance Variable | __call |
Undocumented |
| Instance Variable | __cmd |
Undocumented |
| Instance Variable | __env |
Undocumented |
| Instance Variable | __lock |
Undocumented |
Detect whether a Python debugger is currently attached.
Notes
Covers legacy trace-based debuggers (sys.gettrace) and debugpy >= 1.8 on Python >= 3.12, which uses sys.monitoring and no longer sets a global trace function but always imports pydevd during its bootstrap.
| Returns | |
bool | True if a debugger is attached, False otherwise. |
Resolve and append host and port arguments to the command.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Append the logging-level flags to the command.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Append hot-reload flags and watched directories to the command.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Append the static-file mount path and URL route to the command.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Append the worker-process count to the command.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Configure bytecode-writing flags based on the current environment.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Start the server in-process using Granian's embedded backend.
Notes
Used on Windows when a debugger is attached. Workers run as asyncio tasks so debugpy breakpoints work without subprocess interception issues.
Lifecycle is managed explicitly because Application.__rsgi_init__ calls loop.run_until_complete(), which raises RuntimeError when the loop is already running, and asyncio.ensure_future(loop=) was removed in Python 3.12+.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Initialize command arguments and server launch state.
| Returns | |
None | This method does not return a value. |
Assign the application shutdown coroutine for later invocation.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Replace the current process with the Granian server via execvpe.
| Returns | |
None | This method never returns; the process is replaced by execvpe. |
Launch Granian as a managed subprocess on Windows.
Notes
Passes the copied environment to the subprocess without changing environment variables in the parent process.
Uses asyncio.create_subprocess_exec so that await proc.wait() is directly cancellable by the event loop. On CancelledError (Ctrl+C), taskkill /F /T terminates the entire process tree (main Granian process and all worker children) before the shutdown handler is called.
| Returns | |
None | This method does not return a value. |
Build the Granian command and start the HTTP server.
Notes
Dispatches to the appropriate server strategy:
- Unix: replaces the process via execvpe.
- Windows + debugger: uses the Granian embedded server (in-process asyncio tasks) for full breakpoint support.
- Windows: launches Granian as a managed subprocess.
| Parameters | |
app:IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |