Manifest System — Aquilia Documentation
Comprehensive guide and documentation for Manifest System in the Aquilia framework. View API reference, examples, and implementation patterns.
AQUILARY / MANIFEST SYSTEM Manifest Loading & Validation The manifest system provides safe, import-free module discovery. By loading declarations lazily, Aquilia compiles dependency layouts without executing user module imports. ManifestLoader The ManifestLoader class parses manifest specifications from multiple sources. It accepts a list of sources—which can be direct Python manifest classes, absolute/relative paths to Python manifest files, or DSL (YAML/JSON) files: from aquilia.aquilary import ManifestLoader loader = ManifestLoader() # Load multiple modules from mixed sources (safe, no import side effects) manifests = loader.load_manifests( sources=[ "modules/auth/manifest.py", "modules/users/manifest.yaml", # DSL config support ], allow_fs_autodiscovery=True # Scan standard directories ) for m in manifests: print(f"Loaded: v [Origin: ]") Registry Validation Once loaded, the RegistryValidator inspects the manifest declarations. It compiles a validation report covering schema compatibility, route collisions, and duplicate app declarations: from aquilia.aquilary import RegistryValidator, RegistryMode validator = RegistryValidator(mode=RegistryMode.PROD) # Run validations on manifests report = validator.validate_manifests( manifests, config, workspace_modules=workspace_modules_config ) if report.has_errors(): raise Exception(report.to_exception()) Core Validation Rules Validation Code Focus Description DuplicateAppError Uniqueness Triggers if two modules declare the exact same name. RouteConflictError Routing Flags overlapping paths or colliding HTTP endpoint route templates. DependencyCycleError Topology Raised when circular dependencies exist between module imports. DeprecationWarning Legacy Emitted when using the deprecated depends_on argument instead of imports. Bidirectional Sync — imports ↔ depends_on v1.3.4 The AppManifest.__post_init__ hook now keeps imports and depends_on in sync automatically. Using imports=[...] is preferred, and auto-populates depends_on. Using depends_on=[...] auto-populates imports but emits a DeprecationWarning. from aquilia import AppManifest # Preferred manifest1 = AppManifest( name="users", imports=["auth"] # depends_on automatically set to ["auth"] ) # Deprecated (emits warning) manifest2 = AppManifest( name="billing", depends_on=["users"] # imports automatically set to ["users"] ) Two-Phase Manifest Loading v1.3.4 The ManifestLoader now uses a two-phase loading strategy: an AST-based primary path and an exec fallback. Phase 1: AST path — Handles simple manifests with zero side effects, fast and safe. Phase 2: exec fallback — Handles complex manifests (e.g., dynamic imports). Emits a logged warning. # Phase 1: Resolved via AST (Fast, safe) manifest = AppManifest( name="auth", version="1.0.0" ) # Phase 2: Falls back to exec (Logs warning about side effects) DYNAMIC_VERSION = os.getenv("VERSION", "1.0.0") manifest = AppManifest( name="billing", version=DYNAMIC_VERSION ) Overview Runtime Registry )
Go to Homepage