A dependency injection framework for Python
Dependency Injector
Dependency Injector is a dependency injection framework for Python.
It helps implementing the dependency injection principle.
Key features of the Dependency Injector
:
-
Providers. Provides
Factory
,Singleton
,Callable
,Coroutine
,Object
,List
,Dict
,Configuration
,Resource
,Dependency
andSelector
providers that help assembling your objects. See Providers. -
Overriding. Can override any provider by another provider on the fly. This helps in testing and configuring dev / stage environment to replace API clients with stubs etc. See Provider overriding.
-
Configuration. Reads configuration from
yaml
&ini
files,pydantic
settings, environment variables, and dictionaries. See Configuration provider. -
Containers. Provides declarative and dynamic containers. See Containers.
-
Resources. Helps with initialization and