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.
Start the application server using the selected runtime options.
| 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 |
Disable bytecode writes in this interpreter and all server processes. |
| 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 |
Command-line argument declarations accepted by this command. |
| Class Variable | description |
Initializes the Orionis server with Granian (The Rust HTTP server for Python).. |
| Class Variable | signature |
Command signature and description. |
| Class Variable | timestamps |
Timestamps flag used by ServerCommand. |
| Instance Variable | __call |
Callbacks invoked when the server shuts down. |
| Instance Variable | __cmd |
Argument vector used to launch the application server. |
| Instance Variable | __env |
Environment overrides passed to the application server process. |
| Instance Variable | __lock |
Lock protecting concurrent access to shared state. |
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:orionis.IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Append the selected interface type to the command.
| Returns | |
None | Append flags and record the selected interface. |
Append the logging-level flags to the command.
| Parameters | |
app:orionis.IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Append the event-loop backend to the command.
| Returns | |
None | Append the loop flag and record its selection. |
Append hot-reload flags and watched directories to the command.
| Parameters | |
app:orionis.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:orionis.IApplication | The running application instance. |
| Returns | |
None | This method does not return a value. |
Disable bytecode writes in this interpreter and all server processes.
| Returns | |
None | This method does not return a value. |
Start the server in-process using Granian's embedded backend.
Notes
Windows debugger sessions use asyncio tasks. Drive RSGI startup and shutdown explicitly because the application's synchronous RSGI hooks cannot run inside an active event loop.
| Parameters | |
app:orionis.IApplication | The running application instance. |
| Returns | |
None | Complete the embedded server lifecycle. |
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:orionis.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. Server-specific settings remain isolated; bytecode protection is also enforced 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
Replace the process on Unix. On Windows, use the embedded server for debugger sessions and a managed subprocess otherwise.
| Parameters | |
app:orionis.IApplication | The running application instance. |
| Returns | |
None | Launch the selected runtime or report an exported command. |