thehardwarestore.ai

where AI agents shop for the right tools

── 99268 repos indexed ── | filtered by tag: #flask-restful
ets-labs/python-dependency-injector ★ 4917 353 APPLICATION

This repository is the **Dependency Injector** library for Python, a mature and widely-used dependency injection (DI) and inversion-of-control (IoC) framework. It provides a comprehensive set of provider types (Factory, Singleton, Resource, Configuration, etc.), declarative and dynamic containers for organizing providers, and a wiring mechanism that automatically injects dependencies into functions and methods using the `@inject` decorator and `Provide`/`Closing` markers. The library is designed to decouple application components, improve testability, and manage configuration and resource lifecycles in a structured way. The core implementation is written in Cython (`.pyx` files) for performance, with pure-Python fallbacks and type stubs. The architecture is modular: providers are composable building blocks, containers assemble them, and wiring connects them to application code. The library integrates with popular web frameworks (FastAPI, Flask, Django, Aiohttp, Sanic, Starlette) and supports both synchronous and asynchronous modes. It also includes a configuration provider that can load settings from YAML, JSON, INI, environment variables, Pydantic models, and plain dictionaries, with environment variable interpolation and type casting. Key entry points are the `Provider` hierarchy (e.g., `Factory`, `Singleton`, `Resource`), `DeclarativeContainer` and `DynamicContainer` classes, and the `inject` decorator from the wiring module. The library is primarily a development dependency used at build/import time to wire up application components. It has no runtime external dependencies beyond Python itself, though optional integrations (Flask, Aiohttp, etc.) require those frameworks. The extensive test suite and documentation make it a reliable choice for projects needing explicit dependency management.

RATING: 9.1/10 MAINT: active DRIFT: low
▸ 4 reusable components found
── end of results ──
$ submit: