ets-labs/python-dependency-injector is tracked by TopGit as a backend project, with 4.9k stars on GitHub, written primarily in Python. Dependency injection framework for Python
Snapshot summary built from the project's own GitHub metadata — there's no written TopGit review yet. The page will update automatically when a full review is published.
WHY NO REVIEW YET
TopGit writes full reviews for the most-starred, most-requested repositories. This page is a snapshot until then — see the READ ME tab for the original README in full.
.. image:: https://img.shields.io/github/actions/workflow/status/ets-labs/python-dependency-injector/tests-and-linters.yml?branch=master
:target: https://github.com/ets-labs/python-dependency-injector/actions
:alt: Build Status
.. image:: https://coveralls.io/repos/github/ets-labs/python-dependency-injector/badge.svg?branch=master
:target: https://coveralls.io/github/ets-labs/python-dependency-injector?branch=master
:alt: Coverage Status
What is Dependency Injector?
Dependency Injector is a dependency injection framework for Python.
It helps implement the dependency injection principle.
Key features of the Dependency Injector:
Providers. Provides Factory, Singleton, Callable, Coroutine, Object,
List, Dict, Configuration, Resource, Dependency, and Selector providers
that help assemble your objects.
See Providers <https://python-dependency-injector.ets-labs.org/providers/index.html>_.
Overriding. Can override any provider by another provider on the fly. This helps in testing
and configuring dev/stage environment to replace API clients with stubs etc. See
Provider overriding <https://python-dependency-injector.ets-labs.org/providers/overriding.html>_.
Configuration. Reads configuration from yaml, ini, and json files, pydantic settings,
environment variables, and dictionaries.
See Configuration provider <https://python-dependency-injector.ets-labs.org/providers/configuration.html>_.
Resources. Helps with initialization and configuring of logging, event loop, thread
or process pool, etc. Can be used for per-function execution scope in tandem with wiring.
See Resource provider <https://python-dependency-injector.ets-labs.org/providers/resource.html>_.
Containers. Provides declarative and dynamic containers.
See Containers <https://python-dependency-injector.ets-labs.org/containers/index.html>_.
Wiring. Injects dependencies into functions and methods. Helps integrate with
other frameworks: Django, Flask, Aiohttp, Sanic, FastAPI, etc.
See Wiring <https://python-dependency-injector.ets-labs.org/wiring.html>_.
Asynchronous. Supports asynchronous injections.
See Asynchronous injections <https://python-dependency-injector.ets-labs.org/providers/async.html>_.
Typing. Provides typing stubs, mypy-friendly.
See Typing and mypy <https://python-dependency-injector.ets-labs.org/providers/typing_mypy.html>_.
Performance. Fast. Written in Cython.
Maturity. Mature and production-ready. Well-tested, documented, and supported.
.. code-block:: python
from dependency_injector import containers, providers
from dependency_injector.wiring import Provide, inject
@inject
def main(service: Service = Provide[Container.service]) -> None:
...
if name == "main":
container = Container()
container.config.api_key.from_env("API_KEY", required=True)
container.config.timeout.from_env("TIMEOUT", as_=int, default=5)
container.wire(modules=[name])
main() # <-- dependency is injected automatically
with container.api_client.override(mock.Mock()):
main() # <-- overridden dependency is injected automatically
When you call the main() function the Service dependency is assembled and injected automatically.
When you do testing, you call the container.api_client.override() method to replace the real API
client with a mock. When you call main(), the mock is injected.
You can override any provider with another provider.
It also helps you in a re-configuring project for different environments: replace an API client
with a stub on the dev or stage.
With the Dependency Injector, object assembling is consolidated in a container. Dependency injections are defined explicitly.
This makes it easier to understand and change how an application works.
Visit the docs to know more about the
Dependency injection and inversion of control in Python <https://python-dependency-injector.ets-labs.org/introduction/di_in_python.html>_.
Installation
The package is available on the PyPi_::
pip install dependency-injector
Documentation
The documentation is available here <https://python-dependency-injector.ets-labs.org/>_.
Examples
Choose one of the following:
Application example (single container) <https://python-dependency-injector.ets-labs.org/examples/application-single-container.html>_
Application example (multiple containers) <https://python-dependency-injector.ets-labs.org/examples/application-multiple-containers.html>_
Decoupled packages example (multiple containers) <https://python-dependency-injector.ets-labs.org/examples/decoupled-packages.html>_
Boto3 example <https://python-dependency-injector.ets-labs.org/examples/boto3.html>_
Django example <https://python-dependency-injector.ets-labs.org/examples/django.html>_
Flask example <https://python-dependency-injector.ets-labs.org/examples/flask.html>_
Aiohttp example <https://python-dependency-injector.ets-labs.org/examples/aiohttp.html>_
Sanic example <https://python-dependency-injector.ets-labs.org/examples/sanic.html>_
FastAPI example <https://python-dependency-injector.ets-labs.org/examples/fastapi.html>_
FastAPI + Redis example <https://python-dependency-injector.ets-labs.org/examples/fastapi-redis.html>_
FastAPI + SQLAlchemy example <https://python-dependency-injector.ets-labs.org/examples/fastapi-sqlalchemy.html>_
Tutorials
Choose one of the following:
Flask web application tutorial <https://python-dependency-injector.ets-labs.org/tutorials/flask.html>_
Aiohttp REST API tutorial <https://python-dependency-injector.ets-labs.org/tutorials/aiohttp.html>_
How active is development on ets-labs/python-dependency-injector?
The most recent commit recorded on ets-labs/python-dependency-injector was 5 months ago, based on the GitHub push timestamp. The repository has 356 forks — one of the better signals of community interest.
How many stars does ets-labs/python-dependency-injector have?
ets-labs/python-dependency-injector has 4.9k GitHub stars — refresh the page for the live number, or check github.com/ets-labs/python-dependency-injector. TopGit mirrors GitHub's count but does not claim minute-by-minute accuracy.
Is ets-labs/python-dependency-injector open source?
Yes — ets-labs/python-dependency-injector ships under the BSD-3-Clause license, which makes its source code freely readable (and, depending on license terms, forkable and reusable). Source: github.com/ets-labs/python-dependency-injector.
What else is in the Backend space?
ets-labs/python-dependency-injector is tracked by TopGit under the Backend category, alongside 18 GitHub-tagged topics. Trending and Topics pages list peer repositories of comparable stars and language.
What is ets-labs/python-dependency-injector?
ets-labs/python-dependency-injector (ets-labs/python-dependency-injector) is a Python project on GitHub. From the project's own README: Dependency injection framework for Python
What language is ets-labs/python-dependency-injector written in?
ets-labs/python-dependency-injector is written primarily in Python. GitHub's language field is based on the largest share of bytes in the default branch.
What license does ets-labs/python-dependency-injector use?
ets-labs/python-dependency-injector is released under the BSD-3-Clause license. Always verify the LICENSE file directly on GitHub for the authoritative terms — license strings can be edited out of sync with a project's actual stance.
Where do I read more about ets-labs/python-dependency-injector?
This TopGit page is a snapshot — the READ ME tab shows the project's own README content (links stripped, images preserved). The GitHub repository at github.com/ets-labs/python-dependency-injector is the definitive source.
Read full README in the tab above.
Curious whether python-dependency-injector is right for you?
Let ChatGPT, Claude, or Perplexity look into it — click below and see what AI actually says about python-dependency-injector.