RuntimeRegistry — Aquilia Documentation
Comprehensive guide and documentation for RuntimeRegistry in the Aquilia framework. View API reference, examples, and implementation patterns.
AQUILARY / RUNTIME REGISTRY Runtime Registry & Discovery The RuntimeRegistry class compiles the static module graph metadata into a live application server state, performing package discovery, lazily importing controllers, and building DI containers. Auto-Discovery Phases When calling perform_autodiscovery(), the registry scans modules. "} recursively up to a depth of 5, identifying and importing classes matching predicate rules: 1. Controller Scanning Discovers classes whose names end with "Controller" or that directly inherit from Controller . 2. Service Scanning Discovers dependency injection services whose names end with "Service" or declare the __di_scope__ attribute. 3. Socket Controllers Scans for classes decorated with @Socket or whose names end with "SocketController". 4. Tasks and Models Imports tasks.py to trigger background task registrations, and scans database models to catalog schemas. Discovery Failure Diagnostics v1.3.4 All 6 discovery steps now emit a logger.warning(..., exc_info=True) instead of silently swallowing errors. This makes it much easier to debug faulty modules. Before (v1.3.3): No output when a controller has a bad import. After (v1.3.4): Warning log with full traceback and module name. When you see this warning, check the file mentioned in the traceback and ensure all its imports are valid and installed. Workspace Module Discovery v1.3.4 The new exec-based discovery has replaced regex parsing, allowing for more complex, dynamic module resolutions in your workspace. Old behavior: Regex missed dynamic module lists. New behavior: Executes workspace.py and calls workspace.to_dict(). Fallbacks to exec failure when invalid. Example of a workspace.py that old regex would have missed: # This would have been MISSED by regex in v1.3.3 ENVIRONMENT_MODULES = ["users", "billing"] if os.getenv("ENABLE_BILLING") else ["users"] workspace = Workspace( modules=[Module(name) for name in ENVIRONMENT_MODULES] ) Bootstrapping from aquilia.aquilary import RuntimeRegistry # 1. Instantiate runtime registry from compiled metadata runtime = RuntimeRegistry.from_metadata(registry_meta, config) # 2. Perform autodiscovery package scan (depth=5) runtime.perform_autodiscovery() # 3. Import controllers and build the ASGI route tables runtime.compile_routes() Manifest System Fingerprinting )
Go to Homepage