# ets-labs/python-dependency-injector

Dependency injection framework for Python

Repository: https://github.com/ets-labs/python-dependency-injector
Canonical: https://ross.abutalabs.com/products/python-dependency-injector
Homepage: https://python-dependency-injector.ets-labs.org/
Language: Python
License: BSD-3-Clause
License Family: permissive
Topics: python, dependency-injection, ioc, ioc-container, factory, singleton, design-patterns, dependency-injection-container, dependency-injection-framework, flask, aiohttp, asyncio, python3, python-3, python-2, flask-application, flask-restful, threadlocal
Last push: 2026-08-11T12:25:27+00:00

## Health v2 (maintenance only)
Score: 95/100 (v2, computed 2026-09-03T02:20:16.233290+00:00)
- activity 97, release rhythm 89, longevity 100
- inputs: {"age_days": 4259, "days_push": 22, "days_rel": 76, "gap_med": 9.0, "n_releases_24m": 13}
- flags: none
- formula: round(0.45*activity + 0.35*rhythm + 0.20*longevity); archived -> min(score, 10)

## Adoption (not part of the score)
Stars 4908, forks 351 (observed 2026-08-28T04:09:02.257864+00:00)

## What it is
Dependency Injector is a dependency injection (IoC) framework for Python, offering providers such as Factory, Singleton, Configuration, and Resource, plus declarative and dynamic containers. It is written in Cython for performance, supports asynchronous injections, wiring into frameworks like Flask, Django, FastAPI, and Aiohttp, and is mypy-friendly with typing stubs.

## Use cases
- manage dependency injection in a python application
- replace api clients with stubs in tests via provider overriding
- load configuration from yaml json or environment variables
- wire dependencies into flask or fastapi functions
- implement singleton and factory patterns with an ioc container
- inject dependencies into async python code

## When to choose
- you want explicit, testable object assembly with provider overriding
- you need fast, production-ready DI with Cython performance
- you use Flask, Django, FastAPI, Aiohttp, or Sanic and want framework integration
- you need mypy-friendly typing stubs and async injection support

## When to avoid
- your project is small and manual constructor injection is sufficient
- you prefer implicit or decorator-driven DI frameworks
- you need a DI framework for a language other than Python

## Facets
- artifact type: library
- maturity: stable
- function: middleware, configuration-management, testing, developer-tools
- domain: developer-tools, backend, web-development
- platform: python, cross-platform, windows
- tags: dependency-injection, ioc-container, design-patterns, cython, asyncio, wiring, flask, fastapi, aiohttp, mypy-friendly, automation, linux, macos

## Member repositories
- ets-labs/python-dependency-injector (main) score 95

## Provenance
- Observed fields: from GitHub, fetched 2026-08-28T04:09:02.257864+00:00.
- Health v2: computed from the inputs above; adoption is never an input.
- Inferred fields (summary, facets, guidance): AI-extracted, prompt v1, taxonomy v1, on 2026-08-29T18:18:05.479609+00:00, confidence not recorded.
  - readme: https://github.com/ets-labs/python-dependency-injector (fetched 2026-08-28T04:09:02.257864+00:00, sha 6658b9102e38)
  - homepage: https://python-dependency-injector.ets-labs.org/ (fetched 2026-08-29T09:00:15.500693+00:00, sha 9f9dbbd07ffa)
  - site_page: https://python-dependency-injector.ets-labs.org/introduction/key_features.html (fetched 2026-08-29T09:00:15.503342+00:00, sha db19cda79d6c)
  - site_page: https://python-dependency-injector.ets-labs.org/introduction/installation.html (fetched 2026-08-29T09:00:15.505195+00:00, sha d835d95a1c2d)
  - site_page: https://python-dependency-injector.ets-labs.org/api/index.html (fetched 2026-08-29T09:00:15.507086+00:00, sha d58f049b2506)
  - site_page: https://python-dependency-injector.ets-labs.org/main/changelog.html (fetched 2026-08-29T09:00:15.508858+00:00, sha e5a213cbac60)
- Data as of 2026-08-30T08:39:29.467469+00:00.
