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.

class documentation

Resolve compiled routes using static maps and ordered dynamic buckets.

Method __init__ Build lookup tables and the bounded FIFO result cache.
Method __raiseForUnmatchedPath Distinguish an unknown path from a path registered for another method.
Method __resolveDynamic Resolve dynamic candidates and cache a successful conversion.
Method __storeCache Cache a dynamic result, evicting the oldest entry at capacity.
Method allRoutes Return a fresh list of all unique compiled routes.
Method fallback Return the configured fallback handler metadata.
Method invalidateCache Clear all dynamic route results and their FIFO eviction order.
Method options Return the sorted HTTP methods whose routes match a path.
Method resolve Resolve a request method and path using prebuilt dispatch metadata.
Class Variable __slots__ Undocumented
Instance Variable _cache_max Undocumented
Instance Variable _cache_order Undocumented
Instance Variable _fallback Undocumented
Instance Variable _global_static Undocumented
Instance Variable _routes Undocumented
Instance Variable _tables Undocumented
def __init__(self, routes: dict[str, dict], hot_cache_size: int = 512, fallback: tuple | None = None): (source)

Build lookup tables and the bounded FIFO result cache.

Parameters
routes:dict[str, dict]Compiler output grouped by method and static/dynamic paths.
hot_cache_size:int, optionalMaximum dynamic results cached across all methods; zero disables caching. Defaults to 512.
fallback:tuple | None, optionalFallback handler metadata. None or (None, None) disables the fallback. Defaults to None.
Returns
NoneInitialize route tables, the route inventory, and the FIFO cache.
Raises
TypeErrorIf the cache capacity is a boolean or not an integer.
ValueErrorIf the cache capacity is negative.
def __raiseForUnmatchedPath(self, method: str, path: str, depth: int) -> Never: (source)

Distinguish an unknown path from a path registered for another method.

Parameters
method:strCanonical request method that did not match.
path:strNormalized request path.
depth:intNumber of path separators, or zero for the root path.
Returns
NeverAlways raise a routing exception; never return a value.
Raises
MethodNotAllowedIf another method has a static or regex match for the path.
RouteNotFoundIf no method has a static or regex match for the path.
def __resolveDynamic(self, path: str, depth: int, table: DepthTable, method: str, method_cache: dict[str, ResolvedRoute] | None) -> ResolvedRoute | None: (source)

Resolve dynamic candidates and cache a successful conversion.

Parameters
path:strNormalized request path.
depth:intNumber of path separators, or zero for the root path.
table:DepthTableDynamic route buckets for the request method.
method:strCanonical request method used as part of the cache key.
method_cache:dict[str, ResolvedRoute] | NonePer-method result cache, or None when caching is disabled.
Returns
ResolvedRoute | NoneFirst matching route with valid parameter conversions, or None if no candidate succeeds.
Raises
RouteNotFoundIf a combined match lacks its identifying route marker.
def __storeCache(self, cache: dict[str, ResolvedRoute], method: str, path: str, result: ResolvedRoute): (source)

Cache a dynamic result, evicting the oldest entry at capacity.

Parameters
cache:dict[str, ResolvedRoute]Cache belonging to the request method.
method:strCanonical request method.
path:strNormalized request path.
result:ResolvedRouteImmutable route resolution to retain.
Returns
NoneStore the result and append its method/path key to the FIFO queue.
def allRoutes(self) -> list[CompiledRoute]: (source)

Return a fresh list of all unique compiled routes.

Returns
list[CompiledRoute]Routes deduplicated by identity in their original table traversal order. The returned list shares the compiled route objects.
def fallback(self) -> tuple | None: (source)

Return the configured fallback handler metadata.

Returns
tuple | NoneRegistered handler tuple, or None when no fallback is configured.
def invalidateCache(self): (source)

Clear all dynamic route results and their FIFO eviction order.

Returns
NoneEmpty per-method caches and the shared queue, preserving route tables.
def options(self, path: str) -> list[str]: (source)

Return the sorted HTTP methods whose routes match a path.

Inspect path patterns without converting parameters.

Parameters
path:strRequest path to normalize before checking registered methods.
Returns
list[str]Matching methods, adding HEAD for GET and OPTIONS for any match. Return GET, HEAD, and OPTIONS for an unmatched path with a fallback, or an empty list when no fallback is configured.
def resolve(self, method: str, path: str) -> ResolvedRoute: (source)

Resolve a request method and path using prebuilt dispatch metadata.

Parameters
method:strHTTP method, matched case-insensitively; HEAD uses the GET table. WEBSOCKET selects the isolated connection route table.
path:strRequest path to normalize before lookup.
Returns
ResolvedRouteMatched route and immutable, converted parameters. Cached results may be reused.
Raises
RouteNotFoundIf no route can be resolved and no other method matches the path.
MethodNotAllowedIf no HTTP route is resolved and another HTTP method matches.
__slots__: tuple[str, ...] = (source)

Undocumented

_cache_max = (source)

Undocumented

_cache_order: deque[tuple[str, str]] = (source)

Undocumented

_fallback = (source)

Undocumented

_global_static = (source)

Undocumented

Undocumented

Undocumented