Skip to content

Some more featured DI python libraries

FastDepend is a very small toolkit to achieve one point: provide you with opportunity to use FastAPI Depends and typecasting everywhere.

Sometimes, more complex tools are required. In these cases I can recommend you to take a look at the following projects

DI

di is a modern dependency injection toolkit, modeled around the simplicity of FastAPI's dependency injection.

Key features:

  • Intuitive: simple API, inspired by FastAPI
  • Auto-wiring: di also supports auto-wiring using type annotations
  • Scopes: inspired by pytest scopes, but defined by users
  • Composable: decoupled internal APIs give you the flixibility to customize wiring, execution and binding.
  • Performance: di can execute dependencies in parallel and cache results ins scopes.

Dependency Injector

Dependency Injector is a dependency injection framework for Python.

It helps implementing the dependency injection principle.

Key features:

  • Providers
  • Overriding on the fly
  • Configuration (yaml, ini, json, pydantic, .env, etc)
  • Resources
  • Containers
  • Wiring
  • Asynchronous
  • Typing
  • Performance
  • Maturity