For a dependency injection container for Python, the strongest matches are ets-labs/python-dependency-injector (ets-labs/python-dependency-injector is a full-featured dependency injection framework and IoC), samber/do (This is a Go dependency injection framework, but your) and microsoft/tsyringe (tsyringe is a dependency injection container and IoC framework). Each is ranked by relevance to your query, popularity and recent activity.
Libraries and frameworks that implement dependency injection patterns to manage object lifecycles in Python applications.
This is a dependency injection framework and inversion of control container for Python. It decouples object creation from business logic by managing how services and their dependencies are assembled, delivered, and linked within an application. The framework is distinguished by its ability to perform automated component wiring, using import hooks and decorators to inject dependencies into functions and classes across different modules. It supports non-blocking flows through an asynchronous dependency resolver and manages the initialization and shutdown sequences of shared external resources a
ets-labs/python-dependency-injector is a full-featured dependency injection framework and IoC container for Python that supports automatic wiring, lifecycle management, type hints, framework integrations (Flask, aiohttp), and lazy initialization—exactly the kind of comprehensive, production-ready DI library this search is after.
This project is a type-safe dependency injection framework for Go that manages application lifecycles and injects dependencies into structures using reflection and metadata tags. It functions as a service lifecycle manager and an interface binding library to decouple service consumption from concrete implementations. The framework utilizes a hierarchical service container, organizing services into a tree of nested scopes where child containers inherit dependencies from their ancestors. It includes a dependency graph visualizer for inspecting relationships and invocation chains, as well as a s
This is a Go dependency injection framework, but your search explicitly asks for a Python library — the language mismatch means it is not the tool you are looking for.
tsyringe is a TypeScript dependency injection container and inversion of control framework. It decouples class implementations from object creation by managing dependencies and object lifecycles using decorators and metadata. The framework features a hierarchical container system where child containers can maintain independent registration scopes and fall back to parent containers for dependency resolution. It provides a provider system that controls object longevity through singleton and transient instantiation rules. The system supports recursive constructor injection and handles circular
tsyringe is a dependency injection container and IoC framework, but it is implemented in TypeScript, not Python, so it does not meet the visitor's requirement for a Python library.