# `emi_containers.py` ## Overview This file utilizes the `dependency-injector` library to manage the lifecycle, instantiation, and injection of dependencies across the application. It acts as the backbone of the application's Service-Oriented Architecture (SOA). ## Class: `EMIContainer` Inherits from `CoreContainer`. This container holds all the definitions and instructions on how to build and inject the `emi_checkout` components. ### 1. Wiring Configuration - `wiring_config = containers.WiringConfiguration(packages=["applications", "authentication"])` - This ensures that any module inside the `applications` (the controllers/routes) and `authentication` (the middlewares) folders can resolve objects from this container using the `@inject` decorator. ### 2. Providers (Factories) - **`emi_repository`**: Instantiates `EMIRepository`. Injects `query_results` (database connectivity engine) inherited from `CoreContainer`. - **`utilities`**: Instantiates the helper class `Utilities`. Injects the `emi_repository` so utilities can save files and logs directly into the database. - **`emi_service`**: Instantiates `EMIService`, which acts as the core brain. It receives instances of both the `emi_repository` (for DB tasks) and `utilities` (for helper tasks) upon initialization.