A curated list of awesome things related to dependency inversion / dependency injection in Python.
- Python Dependency Injection (PDF) (Alex Martelli, 2008).
- Fang: Pythonic dependency injection (video) (Nathan Craike, 2015).
- Enforcing Single Responsibility Principle in Python (Nikita Sobolev / Никита Соболев, 2019)
- Pythonic Dependency Injection: A Practical Guide (Sune Andreas Dybro Debel, 2018)
- Elegant Flask API Development Part 1 (mostly covers Flask-Injector).
- "(pytest) Fixtures: a prime example of dependency injection"
- Tests and comparison of Python dependency injection libraries ★3
- Typed Functional Dependency Injection in Python
- Pythonic Application Architecture Patterns for Managing Complexity ★2959, see specially this chapter: Dependency Injection (And Mocks)
- returns ★2740: "Make your functions return something meaningful, typed, and safe!". Part of the dry-python ecosystem.
- python-dependency-injector ★2894: "Dependency injection microframework for Python"
- Injector ★947: "Python dependency injection framework, inspired by Guice".
- Inject ★556: Python dependency injection
- Dependencies ★335: "Constructor injection designed with OOP in mind."
- Punq ★227: "An IoC container for Python 3.6+."
- di ★189: Pythonic dependency injection. Used by (and developped for) the Xpresso Web framework.
- injectable ★94: "Injectable: Dependency Injection for Humans™"
- Antidote ★84: "Dependency injection for Python"
- Rodi ★80: Dependency injection for Python 3 (used by, and developped for, the BlackSheep web framework).
- Lagom ★30: Type based auto-wiring dependency injection with support for async and threading.
- Bevy ★22: "Bevy makes using Dependency Injection in Python a breeze so that you can focus on creating amazing code."
Several modern Python web frameworks include DI components, including:
- FastAPI -> Dependencies - First Steps.
- Litestar -> Dependency Injection.
- Sanic -> https://sanic.dev/en/plugins/sanic-ext/injection.html.
- Xpresso -> di (see above)
- Blacksheep -> Rodi (see above)
- Aiodine (dead, see below) was the DI framework for the Bocadillo project (also dead)
- Serum ★84: "Dependency injection framework for Python 3.6" (unmaintained)
- Aiodine ★54: "Async-first Python dependency injection library" (unmaintained)
- Wiring ★27: Architectural foundation for Python applications. (Unmaintained).
- Flask-Injector ★246: Adds Injector support to Flask.
- Pyramid-Wiring ★0: integration of Wiring and Pyramid (unmaintained).
See also above.