/awesome-dependency-injection-in-python

A curated list of awesome things related to dependency inversion / dependency injection in Python. (Contributions welcomed).

Awesome Dependency Injection in Python

A curated list of awesome things related to dependency inversion / dependency injection in Python.

Awesome

Talks / slides

  • Python Dependency Injection (PDF) (Alex Martelli, 2008).
  • Fang: Pythonic dependency injection (video) (Nathan Craike, 2015).

Videos

Articles / blog posts

Books

Software

DI Frameworks / Containers

  • python-dependency-injector ★3910 - Dependency injection framework for Python. [🐍, BSD 3-Clause "New" or "Revised" License].
  • returns ★3547 - Make your functions return something meaningful, typed, and safe!. [🐍, BSD 2-Clause "Simplified" License].
  • Injector ★1305 - Python dependency injection framework, inspired by Guice. [🐍, BSD 3-Clause "New" or "Revised" License].
  • Inject ★697 - Python dependency injection. [🐍, Apache License 2.0].
  • Kink ★405 - Dependency injection container made for Python. [🐍, MIT License].
  • Dependencies ★362 - Constructor injection designed with OOP in mind. [🐍, BSD 2-Clause "Simplified" License].
  • Dishka ★391 - Cute DI framework with agreeable API and everything you need. [🐍, Apache License 2.0].
  • Punq ★302 - An IoC container for Python 3.6+. [🐍, MIT License].
  • di ★300 - Pythonic dependency injection. [🐍, MIT License].
  • svcs ★293 - A Flexible Service Locator for Python. [🐍, MIT License].
  • FastDepends ★300 - FastAPI Dependency Injection system extracted from FastAPI and cleared of all HTTP logic. [🐍, MIT License].
  • Lagom ★246: Type based auto-wiring dependency injection with support for async and threading. [🐍, MIT License].
  • Rodi ★178 - Implementation of dependency injection for Python 3. [🐍, MIT License].
  • That Depends ★151 - simple DI-framework, inspired by python-dependency-injector, but without wiring [🐍, MIT License].
  • injectable ★112 - Python Dependency Injection for Humans™. [🐍, MIT License].
  • Wireup ★95 - Concise, Powerful, and Type-Safe Python Dependency Injection Library. [🐍, MIT License].
  • Opyoid ★65 - Dependency injection library for Python. [🐍, MIT License].
  • Fresh Bakery ★21 - Bake dependency injections asynchronously and stupidly simple. [🐍, MIT License].
  • andi ★21 - Library for annotation-based dependency injection. [🐍, BSD 3-Clause "New" or "Revised" License].
  • Picodi ★22 - A DI library inspired by FastAPI. It integrates well with FastAPI but can also be used independently. [🐍, MIT License].
  • Clean IoC ★9 - A simple unintrusive dependency injection library for python with strong support for generics [🐍, MIT License].
  • injection ★6 - replacement for python-dependency-injector that works with Python 3.8-3.12 and works with FastAPI, DRF, Flask and Litestar [🐍, MIT License].

DI components of Web frameworks

Several modern Python web frameworks include DI components, including:

Archived or unmaintained DI frameworks

  • Antidote ★90 - Dependency injection for Python. [🐍, MIT License].
  • Serum ★85 - Dependency injection framework for Python 3.6. [🐍, MIT License].
  • Aiodine ★53 - 🧪 Async-first Python dependency injection library. [🐍, MIT License].
  • Wiring ★26 - Architectural foundation for Python applications. [🐍, Apache License 2.0].

Integration with web frameworks

  • Flask-Injector ★276 - Adds Injector support to Flask. [🐍, BSD 3-Clause "New" or "Revised" License].

See also above.