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.
Plan surgical Python edits and publish them without clobbering changes.
The editor deliberately does not execute user code. Unsupported or ambiguous construction flows fail before any file is changed.
| Static Method | _is |
Identify an application constructor beneath chained builder calls. |
| Static Method | _root |
Resolve the named receiver beneath a fluent method-call chain. |
| Static Method | _routing |
Find a context argument in a supported routing call. |
| Static Method | _scope |
Walk a lexical scope without entering unrelated nested definitions. |
| Method | __init__ |
Initialize a source-preserving application bootstrap edit session. |
| Method | _after |
Plan an insertion after a standalone statement. |
| Method | _append |
Extend a routing argument list while retaining its source layout. |
| Method | _application |
Collect supported application constructor and module aliases. |
| Method | _argument |
Find grouping parentheses beyond a positional argument AST node. |
| Method | _before |
Plan an insertion before a statement and its leading comments. |
| Method | _callback |
Extend the visible import block without adding an empty import group. |
| Method | _calls |
Collect editable calls to an application builder method. |
| Method | _check |
Reject application reassignments that obscure the selected receiver. |
| Method | _check |
Reject later helpers that can replace the selected routing setup. |
| Method | _check |
Reject routing configuration placed after application initialization. |
| Method | _edited |
Apply planned source edits and validate the resulting Python module. |
| Method | _end |
Locate the source character immediately after a syntax node. |
| Method | _find |
Locate the unique named application construction assignment. |
| Method | _fresh |
Choose an unused callback import name in the application scope. |
| Method | _has |
Detect existing callback registration for the selected application. |
| Method | _helper |
Identify helper names that can reference the selected application. |
| Method | _helper |
Detect routing mutations through helper parameters or closures. |
| Method | _import |
Resolve an import node to its absolute application module path. |
| Method | _initializer |
Collect fluent calls that construct the named application. |
| Method | _lifespan |
Recognize visible direct and module imports for lifespan callbacks. |
| Method | _path |
Encode a route path as a project-relative Python string literal. |
| Method | _position |
Translate an AST byte position into a source character offset. |
| Method | _registration |
Plan registration before application initialization or factory return. |
| Method | _routing |
Find the final directly editable application routing call. |
| Method | _start |
Locate the first source character belonging to a syntax node. |
| Method | _statement |
Find the enclosing statement in the application construction scope. |
| Method | commit |
Publish validated source atomically while preserving concurrent edits. |
| Method | encode |
Encode planned source using the original coding cookie and BOM. |
| Method | lifespan |
Import and register application callbacks before initialization. |
| Method | route |
Read literal route paths from the effective routing configuration. |
| Method | routing |
Register a missing route context while preserving other arguments. |
| Instance Variable | _lines |
Lines produced by self.source.splitlines. |
| Instance Variable | _nodes |
Nodes produced by list. |
| Instance Variable | _offsets |
Character offsets used to translate source positions into edit ranges. |
| Instance Variable | _original |
Original produced by self.path.read_bytes. |
| Instance Variable | _parents |
Parent node associated with each node in the parsed syntax tree. |
| Instance Variable | app |
Assignment produced by self._findApplication. |
| Instance Variable | assignment |
Assignment produced by self._findApplication. |
| Instance Variable | base |
Application root used for relative route and import paths. |
| Instance Variable | body |
HTTP response body or encoded payload returned to the client. |
| Instance Variable | encoding |
Encoding produced by tokenize.detect_encoding. |
| Instance Variable | newline |
Newline sequence preserved when rewriting the source file. |
| Instance Variable | path |
Bootstrap Python module to inspect. |
| Instance Variable | scope |
Dependency-injection scope associated with the current operation. |
| Instance Variable | source |
Source produced by self._original.decode. |
| Instance Variable | tree |
Tree produced by ast.parse. |
| Property | has |
Report whether the application exposes a directly editable routing call. |
Identify an application constructor beneath chained builder calls.
| Parameters | |
node:ast.AST | Expression to inspect. |
constructors:set[str] | Recognized direct application constructor names. |
modules:set[str] | Recognized imported application module names. |
| Returns | |
bool | Return whether the expression constructs the application. |
Resolve the named receiver beneath a fluent method-call chain.
| Parameters | |
node:ast.AST | None | Expression to inspect, or None when no expression exists. |
| Returns | |
str | None | Return the receiver name, or None for an unnamed expression. |
Find a context argument in a supported routing call.
| Parameters | |
call:ast.Call | Routing call to inspect. |
context:str | Runtime context whose route argument is needed. |
| Returns | |
ast.AST | None | Return the argument expression, or None when it is absent. |
Walk a lexical scope without entering unrelated nested definitions.
| Parameters | |
scope:ast.AST | Lexical scope or descendant node to traverse. |
| Returns | |
None | Finish traversal without returning a value. |
| Yields | |
ast.AST | Emit nodes from the selected lexical scope. |
Initialize a source-preserving application bootstrap edit session.
| Parameters | |
path:pathlib.Path | Bootstrap Python module to inspect. |
basepathlib.Path | Application root used for relative route and import paths. |
| Returns | |
None | Store the original source, syntax tree, and application binding. |
ast.stmt, lines: list[ str], *, separate: bool = True) -> tuple[ int, int, str]:
(source)
¶
Plan an insertion after a standalone statement.
| Parameters | |
statement:ast.stmt | Standalone statement that precedes the inserted lines. |
lines:list[str] | Unindented source lines to insert. |
separate:bool | Whether to separate the insertion with a leading blank line. |
| Returns | |
tuple[int, int, str] | Return the insertion offsets and correctly indented source text. |
Extend a routing argument list while retaining its source layout.
| Parameters | |
call:ast.Call | Routing call whose argument list must be extended. |
context:str | Runtime context to add as a keyword argument. |
literal:str | Validated Python literal representing the route paths. |
| Returns | |
str | Return updated source with the additional routing keyword. |
Reject application reassignments that obscure the selected receiver.
| Returns | |
None | Complete validation without changing the application source. |
Reject later helpers that can replace the selected routing setup.
| Parameters | |
routing:ast.Call | None | Selected routing call, or None when registration is absent. |
| Returns | |
None | Complete validation without changing the application source. |
Reject routing configuration placed after application initialization.
| Parameters | |
call:ast.Call | Routing call whose initialization order must be validated. |
| Returns | |
None | Complete validation without changing the application source. |
Locate the source character immediately after a syntax node.
| Parameters | |
node:ast.AST | Syntax node with complete source location information. |
| Returns | |
int | Return the exclusive end offset in the original source. |
Choose an unused callback import name in the application scope.
| Returns | |
str | Return the standard callback name or a collision-free generated alias. |
set[ str], modules: set[ str], custom_names: set[ str]) -> bool:
(source)
¶
Detect existing callback registration for the selected application.
| Parameters | |
names:set[str] | Directly imported names for the requested callback function. |
modules:set[str] | Imported modules that expose the callback function. |
customset[str] | Custom callback names whose registrations are preserved. |
| Returns | |
bool | Return whether an unambiguous callback registration already exists. |
ast.FunctionDef | ast.AsyncFunctionDef, call: ast.Call) -> set[ str]:
(source)
¶
Identify helper names that can reference the selected application.
| Parameters | |
helper:ast.FunctionDef | ast.AsyncFunctionDef | Helper definition whose argument bindings are inspected. |
call:ast.Call | Invocation that can pass the selected application. |
| Returns | |
set[str] | Return parameter and closure names that can reference the application. |
ast.FunctionDef | ast.AsyncFunctionDef, parameters: set[ str]) -> bool:
(source)
¶
Detect routing mutations through helper parameters or closures.
| Parameters | |
helper:ast.FunctionDef | ast.AsyncFunctionDef | Helper definition to inspect within its lexical scope. |
parameters:set[str] | Names that can still reference the application instance. |
| Returns | |
bool | Return whether the helper can replace application routing. |
Resolve an import node to its absolute application module path.
| Parameters | |
node:ast.ImportFrom | Import-from node whose module path must be resolved. |
| Returns | |
str | None | Return the dotted module path, or None for an invalid relative import. |
Collect fluent calls that construct the named application.
| Returns | |
set[ast.Call] | Return the calls in the application assignment value chain. |
Encode a route path as a project-relative Python string literal.
| Parameters | |
path:pathlib.Path | Effective route file path to represent. |
| Returns | |
str | Return a quoted relative path, or an absolute path outside the root. |
Find the final directly editable application routing call.
| Returns | |
ast.Call | None | Return the effective routing call, or None when it is absent. |
Locate the first source character belonging to a syntax node.
| Parameters | |
node:ast.AST | Syntax node with source location information. |
| Returns | |
int | Return the absolute start offset in the original source. |
Find the enclosing statement in the application construction scope.
| Parameters | |
node:ast.AST | Descendant syntax node whose enclosing statement is needed. |
| Returns | |
ast.stmt | Return the statement that belongs directly to the selected scope. |
Publish validated source atomically while preserving concurrent edits.
Retry Windows access and sharing failures with bounded backoff, checking for concurrent source changes before each replacement attempt.
| Parameters | |
source:str | None | Planned source, or None when no update is required. |
| Returns | |
bool | Return whether updated source was written to the bootstrap module. |
Import and register application callbacks before initialization.
| Parameters | |
lifespanpathlib.Path | Effective Python module containing lifespan callbacks. |
| Returns | |
str | None | Return updated source, or None when callbacks are already registered. |
str, route_path: Path | list[ Path], *, registered: bool = False) -> str | None:
(source)
¶
Register a missing route context while preserving other arguments.
| Parameters | |
context:str | Runtime context to register. |
routepathlib.Path | list[pathlib.Path] | Effective route file path or paths to register. |
registered:bool | Whether runtime paths confirm a dynamic registration. |
| Returns | |
str | None | Return updated source, or None when the context is already enabled. |