Using third-party containers
DI has a lot to offer to improve our application, but it still depends on the framework we use to get the full potential of this design pattern. FastAPI’s container is very acceptable to some when the concerns are simply on object management and project organization. However, when it comes to configuring the container to add more advanced features, it is not feasible for short-term projects, and it will be impossible for huge applications due to constraints. So, the practical way is to rely on third-party modules for the set of utilities needed to support all these advancements. So, let us explore these popular external modules that integrate seamlessly with FastAPI, the Dependency Injector and Lagom, which we can use to set up a complete and manageable container.
Using configurable containers – Dependency Injector
When it comes to configurable containers, the Dependency Injector has several module APIs that can be used to build variations...