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

Load route declarations from configured application modules.

Method __getCachePersistence Build the cache persistence handle for compiled routes.
Method __importFluentRoutes Import a route file by kind so its fluent registrations run.
Method __init__ Initialise the RouteLoader with its required collaborators.
Method __loadRoutes Load compiled routes, using the persistent cache when available.
Method load Return all compiled routes, loading them first if necessary.
Constant _KINDS Keep a deterministic import order so route registration is stable.
Instance Variable __app Application instance used to resolve paths and settings.
Instance Variable __app_middleware App middleware produced by app.getMiddleware.
Instance Variable __cache Serialiser/deserialiser for the compiled route cache.
Instance Variable __compiler Compiler that converts raw routes to CompiledRoute objects.
Instance Variable __fallback Handler or route selected when no ordinary route matches.
Instance Variable __loaded Loaded flag used by RouteLoader.
Instance Variable __persistence Persistence produced by self.__getCachePersistence.
Instance Variable __router Router that holds the raw registered routes.
Instance Variable __routes Route definitions registered in this routing context.
Instance Variable __use_cache Use cache flag used by RouteLoader.
Property fallback Return the registered fallback handler, if any.
def __getCachePersistence(self) -> IFileBasedCache | None: (source)

Build the cache persistence handle for compiled routes.

Returns
orionis.cache.contracts.IFileBasedCache | NoneA FileBasedCache instance when the application has a compiled cache directory configured, None otherwise.
def __importFluentRoutes(self, kind: str): (source)

Import a route file by kind so its fluent registrations run.

Parameters
kind:strRoute group kind, e.g. 'web' or 'api'.
Returns
NoneImports the module as a side-effect; no value is returned.
def __init__(self, app: IApplication, router: IRouter, compiler: RouteCompiler, cache: RouteCache): (source)

Initialise the RouteLoader with its required collaborators.

Parameters
app:orionis.IApplicationApplication instance used to resolve paths and settings.
router:orionis.http.routes.contracts.router.IRouterRouter that holds the raw registered routes.
compiler:orionis.http.routes.route_compiler.RouteCompilerCompiler that converts raw routes to CompiledRoute objects.
cache:orionis.http.routes.route_cache.RouteCacheSerialiser/deserialiser for the compiled route cache.
Returns
NoneThe instance is initialised; no value is returned.
def __loadRoutes(self): (source)

Load compiled routes, using the persistent cache when available.

On a cache hit the routes and fallback are deserialised directly. On a cache miss all route files are imported (which registers routes in the router), the compiler builds CompiledRoute objects, and the result is persisted for subsequent requests. An absent fallback is normalized to None before persistence, matching the representation restored from cache.

Returns
NonePopulates self.__routes and self.__fallback in place; no value is returned.
def load(self) -> dict[str, dict]: (source)

Return all compiled routes, loading them first if necessary.

Returns
dict[str, dict]Mapping of HTTP method to a dict with keys 'static' ({path: CompiledRoute}) and 'dynamic' ([CompiledRoute, ...]).
_KINDS: tuple[str, ...] = (source)

Keep a deterministic import order so route registration is stable.

Value
('web', 'api')

Application instance used to resolve paths and settings.

App middleware produced by app.getMiddleware.

Serialiser/deserialiser for the compiled route cache.

__compiler = (source)

Compiler that converts raw routes to CompiledRoute objects.

__fallback: tuple | None = (source)

Handler or route selected when no ordinary route matches.

__loaded: bool = (source)

Loaded flag used by RouteLoader.

__persistence: IFileBasedCache | None = (source)

Persistence produced by self.__getCachePersistence.

__router = (source)

Router that holds the raw registered routes.

Route definitions registered in this routing context.

__use_cache: bool = (source)

Use cache flag used by RouteLoader.

Return the registered fallback handler, if any.

The fallback is used when no route matches the incoming request. Accessing this property triggers route loading if it has not already occurred.

Returns
tuple | None(class, method_name) for controller-based fallbacks, (None, callable) for callable-based fallbacks, or None if no fallback has been registered, whether routes are compiled on demand or restored from cache.