项目
在 GitHub 查看
sfermigier/awesome-dependency-injection-in-python
关于
精选的 Python 依赖倒置与依赖注入相关资源列表。欢迎贡献。
开发工具实测星标增长
- 24小时
- 0
- 7天
- +1
- 15天
- +1
- 1个月
- 正在收集历史
各周期内的星标净变化,周期相互重叠,并非每日新增。缺失的测量保持空白。星标代表关注度,不代表软件质量。
README.md
原文Awesome Dependency Injection in Python
A curated list of awesome things related to dependency inversion / dependency injection in Python.
Talks / slides
- Python Dependency Injection (PDF) (Alex Martelli, 2008).
- Fang: Pythonic dependency injection (video) (Nathan Craike, 2015).
Videos
- Loose Coupling & Dependency Injection the EASY Way! (Hynek Schlawack, 2024)
- Dependency Inversion: Write BETTER PYTHON CODE Part 2 (ArjanCodes, 2021)
- Dependency INVERSION vs Dependency INJECTION in Python (ArjanCodes, 2021)
Articles / blog posts
- 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 - Tests and comparison of Python dependency injection libraries. [🐍, Unknown license].
- Typed Functional Dependency Injection in Python
- DI patterns (Abilian, 2024)
- DI anti-patterns (Abilian, 2024)
Books
- Pythonic Application Architecture Patterns for Managing Complexity ★3866 - A Book about Pythonic Application Architecture Patterns for Managing Complexity. Cosmos is the Opposite of Chaos you see. O'R. wouldn't actually let us call it "Cosmic Python" tho. [🐍, Other license].
Software
DI Frameworks / Containers
- python-dependency-injector ★4912 - Dependency injection framework for Python. [🐍, BSD 3-Clause "New" or "Revised" License].
- returns ★4372 - Make your functions return something meaningful, typed, and safe!. [🐍, BSD 2-Clause "Simplified" License].
- Injector ★1540 - Python dependency injection framework, inspired by Guice. [🐍, BSD 3-Clause "New" or "Revised" License].
- Dishka ★1290 - Cute DI framework with agreeable API and everything you need. [🐍, Apache License 2.0].
- Inject ★776 - Python dependency injection. [🐍, Apache License 2.0].
- FastDepends ★518 - FastAPI Dependency Injection system extracted from FastAPI and cleared of all HTTP logic. [🐍, MIT License].
- Kink ★445 - Dependency injection container made for Python. [🐍, MIT License].
- Wireup ★436 - Concise, Powerful, and Type-Safe Python Dependency Injection Library. [🐍, MIT License].
- Punq ★432 - An IoC container for Python 3.6+. [🐍, MIT License].
- svcs ★421 - A Flexible Service Locator for Python. [🐍, MIT License].
- di ★332 - Pythonic dependency injection. [🐍, MIT License].
- diwire ★253 - Type-safe dependency injection for Python with auto-wiring, scopes, async factories, and zero deps [🐍, MIT License].
- That Depends ★253 - simple DI-framework, inspired by python-dependency-injector, but without wiring [🐍, MIT License].
- Lagom ★246: Type based auto-wiring dependency injection with support for async and threading. [🐍, MIT License].
- Rodi ★240 - Implementation of dependency injection for Python 3. [🐍, MIT License].
- python-injection ★127 - Dead-simple dependency injection framework for Python. [🐍, MIT License].
- injectable ★119 - Python Dependency Injection for Humans™. [🐍, MIT License].
- Opyoid ★75 - Dependency injection library for Python. [🐍, MIT License].
- Modern DI ★66 - powerful DI-framework with scopes and IoC-container [🐍, MIT License].
- Picodi ★31 - A DI library inspired by FastAPI. It integrates well with FastAPI but can also be used independently. [🐍, MIT License].
- andi ★24 - Library for annotation-based dependency injection. [🐍, BSD 3-Clause "New" or "Revised" License].
- Fresh Bakery ★21 - Bake dependency injections asynchronously and stupidly simple. [🐍, MIT License].
- engin ★21 - a dependency injection powered application framework, inspired by Uber's fx framework. [🐍, MIT License].
- ididi ★20 - Genius simplicity, unmathced power, dependency injection in a single line of code. [🐍, MIT License]
- injection ★18 - replacement for python-dependency-injector that works with Python 3.8-3.12 and works with FastAPI, DRF, Flask and Litestar [🐍, MIT License].
- Injex ★21 - Tiny typed dependency injection container with constructor injection, singleton/transient/scoped lifetimes, test overrides, and graph validation before startup. Zero runtime dependencies. [🐍, MIT License].
- Clean IoC ★12 - A simple unintrusive dependency injection library for python with strong support for generics [🐍, MIT License].
- Overlay ★6 - A dependency injection framework with pytest-fixture syntax, plus a configuration language for declarative programming [🐍, MIT License].
- nuke-di ★5 - Type-hint based DI for async Python: a dependency is a class with
connect()/disconnect(), every client connects as soon as its own dependencies have, concurrently, and disconnects in reverse order. A mypy plugin reports an unbuildable tree,mock()/override()replace clients in tests,@job/@workerturn an async function into a process with command-line options and graceful shutdown, and FastAPI, Litestar, FastStream, aiogram, taskiq and MCP handlers take clients by type hint. Zero runtime dependencies. [🐍, MIT License]. - cdi-di ★0 - powerful python dependency injection, support generics, circular dep, lifetimes and more [🐍, MIT License].
DI components of Web frameworks
Several modern Python web frameworks include DI components, including:
- FastAPI -> Dependencies - First Steps.
- Litestar -> Dependency Injection.
- Sanic -> Dependency Injection.
- Xpresso -> di (see above)
- Blacksheep -> Rodi (see above)
Integration with web frameworks
- Flask-Injector ★282 - Adds Injector support to Flask. [🐍, BSD 3-Clause "New" or "Revised" License].
See also above.
探索相关项目
加载中…