NewYour coding agent can read the release notes before it upgrades.Set up the MCP server →
PyPI · #1301 most downloaded on PyPI
Dependency injection framework for Python
Last release 3 months ago
18 Jun 2026
Ships fairly regularly
a new release about every 2 months
Nearly every release is documented
notes for 60 of the last 60 stable releases
Nothing withdrawn
no release was ever pulled
10 years old
262 releases · first in 2016
Add FastStream example to docs by @birthdaysgift in #958
Full Changelog: 4.49.0...4.49.1
One column per quarter.
Fix sync resource shutdown with async deps.
Add support for wiring of Cython-compiled modules. Thanks to @keyz182 for `#965 <https://github.com/ets-labs/python-dependency-injector/pull/965`_.
Allow Configuration provider to accept Pydantic settings classes. Thanks to @warmagedon007 for `#963 <https://github.com/ets-labs/python-dependency-injector/pull/963`_.
Add FastStream example to docs. Thanks to @birthdaysgift for `#958 <https://github.com/ets-labs/python-dependency-injector/pull/958`_.
Fix Pydantic v2 deprecation warning triggering on settings class import (fixes #942 )
actions/checkout@v6, actions/setup-python@v6, actions/download-artifact@v8, actions/upload-artifact@v7 and pypa/cibuildwheel@v3.4.0.Full Changelog: 4.48.3...4.49.0
Python 3.14 support
Fix Pydantic v2 deprecation warning triggering on settings class import
Add missing warn_unresolved parameter to WiringConfiguration in containers.pyi. Thanks to @jonathandannenberg for #951.
Add keep_cache argument to Container.wire typings. Thanks to @romantolkachyov for #952.
Use assert_type for type-stub checks. Thanks to @leonarduschen for #934, #953.
Add provided()<func>.call *args, **kwargs arguments. Thanks to @pavalso for #946.
Add context local resource. Thanks to @elina-israyelyan for #931.
Update CI/CD to actions/checkout@v6, actions/setup-python@v6, actions/download-artifact@v8, actions/upload-artifact@v7 and pypa/cibuildwheel@v3.4.0.
Add dependabot config for GitHub Actions
Fix providers.Resource missing overloads for AbstractContextManager and AbstractAsyncContextManager by @leonarduschen in #927
Annotated marker to be anywhere in the annotation list. by @BrianPugh in #939Full Changelog: 4.48.1...4.48.3
Allow annotated marker to be anywhere in the annotation list. Thanks to @BrianPugh for #939.
Fix FastDepends v3 compatibility. Thanks to @AndrianEquestrian for #933.
Various type annotation improvements for providers. Thanks to @leonarduschen for #927, #932 and #935.
Fix grammar in Declarative Container documentation by @okotdaniel in #916
Full Changelog: 4.48.1...4.48.2
Add warn_unresolved=True to WiringConfiguration and container.wire() to produce warnings on unresolved string identifiers.
ABI3 wheels are now built only for CPython version >=3.10 (see issue #919).
Improve performance of dependency_injector._cwiring.DependencyResolver by @ZipFile in eb74b1e
dependency_injector._cwiring.DependencyResolver by @ZipFile in eb74b1etyping-extensions as a dependency for older Python versions (<3.11) by @ZipFile in be7d255@injects without Provide[...] marks by @ZipFile in 04b5907resource_type in Lifespans by @ZipFile in e6cc127Full Changelog: 4.48.0...4.48.1
Improve performance of dependency_injector._cwiring.DependencyResolver
Add typing-extensions as a dependency for older Python versions (<3.11)
Produce warning on @inject``s without ``Provide[...] marks
Add support for resource_type in ``Lifespan``s
Use cache in _fetch_reference_injections() by @ZipFile in #897
Full Changelog: 4.47.1...4.48.0
Improve performance of wiring (#897)
Add Context Manager support to Resource provider (#899)
Add support for async generator injections (#900)
Fix unintended dependency on typing_extensions (#902)
Add support for Fast Depends (#898)
Add resource_type parameter to init and shutdown resources using specialized providers (#858)
Fix wiring marker typing by @ZipFile in #896
Full Changelog: 4.47.0...4.47.1
Fix infinite loop with Closing+ConfigurationOption by @ZipFile in #871
root property from ConfigurationOption by @ZipFile in #875wire() that could violate MRO in some classes by @ZipFile in #886Annotated type for module and class attribute injection in wiring, with updated documentation and examples by @rmk135 in #889Full Changelog: 4.46.0...4.47.0
Add support for Annotated type for module and class attribute injection in wiring, with updated documentation and examples. See discussion: https://github.com/ets-labs/python-dependency-injector/pull/721#issuecomment-2025263718
Fix root property shadowing in ConfigurationOption (#875)
Fix incorrect monkeypatching during wire() that could violate MRO in some classes (#886)
ABI3 wheels are now published for CPython.
Drop support of Python 3.7.
Nothing published for this version
Migrate CI pipeline to actions/upload-artifact@v4 by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/847
actions/upload-artifact@v4 by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/847typing.Annotated by @maintain0404 in https://github.com/ets-labs/python-dependency-injector/pull/721inspect.iscoroutinefunction() for Coroutine provider by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/830Annotated[..., Depends(Provide[...])] by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/853Closing dependency resolution by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/852Full Changelog: https://github.com/ets-labs/python-dependency-injector/compare/4.45.0...4.46.0
Add option to disable env var interpolation in configs (#861)
Fix Closing dependency resolution (#852)
Add support for inspect.iscoroutinefunction() in Coroutine provider (#830)
Fix broken wiring of sync inject-decorated methods (#673)
Documentation updates for movie-lister example (#747)
Fix type propagation in Provider.provider (#744)
Many thanks for the contributions to: - ZipFile - Yegor Statkevich - Federico Tomasi - Martin Lafrance - Philip Bjorge - Ilya Kazakov
Upgrade testing deps by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/837
six by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/840deepcopy errors by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/839Full Changelog: https://github.com/ets-labs/python-dependency-injector/compare/4.44.0...4.45.0
Add Starlette lifespan handler implementation (#683).
Raise exception in ThreadLocalSingleton instead of hiding it in finally (#845).
Improve debuggability of deepcopy errors (#839).
Update examples (#838).
Upgrade testing dependencies (#837).
Add minor fixes to the documentation (#709).
Remove six from the dependencies (3ba4704).
Many thanks for the contributions to: - ZipFile - František Trebuňa - JC (Jonathan Chen)
PEP-517 by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/829
Full Changelog: https://github.com/ets-labs/python-dependency-injector/compare/4.43.0...4.44.0
Migrate to Cython3 by @ZipFile in https://github.com/ets-labs/python-dependency-injector/pull/813
Full Changelog: https://github.com/ets-labs/python-dependency-injector/compare/4.42.0...4.43.0
Add a link to my Github Sponsors profile by @rmk135 in https://github.com/ets-labs/python-dependency-injector/pull/806
Full Changelog: https://github.com/ets-labs/python-dependency-injector/compare/4.41.0...4.42.0
Promote release 4.42.0b1 to a production release.
Fix the Disqus comment widget.
Drop support of Python 2.7, 3.5, and 3.6.
Add support of Python 3.12.
Drop support of Python 2.7, 3.5, and 3.6.
Regenerate C sources using Cython 0.29.37.
Update cibuildwheel to version 2.20.0.
Allow Closing to detect dependent resources #633 _, #636 _. Thanks Jamie Stumme @StummeJ _ for the contribution.
Add support of Python 3.11.
Allow Closing to detect dependent resources #633, #636. Thanks Jamie Stumme @StummeJ for the contribution.
Update CI/CD to use Ubuntu 22.04.
Update CI/CD to actions/checkout@v3, actions/setup-python@v4, actions/upload-artifact@v3, pypa/cibuildwheel@v2.11.3, and actions/download-artifact@v3.
Fix install crash on non-utf8 systems #644.
Fix a bug in Windows build with default charset #635.
Update FastAPI Redis example to use aioredis version 2 #613.
Update documentation on creating custom providers #598.
Regenerate C sources using Cython 0.29.32.
Fix builds badge.
Add Configuration.from_json() method to load configuration from a json file.
Add Configuration.from_json() method to load configuration from a json file.
Fix bug with wiring not working properly with functions double wrapped by @functools.wraps decorator. See issue: #454. Many thanks to: @platipo, @MatthieuMoreau0, @fabiocerqueira, @Jitesh-Khuttan.
Refactor wiring module to store all patched callable data in the PatchedRegistry.
Improve wording on the "Dependency injection and inversion of control in Python" docs page.
Add documentation on the @inject decorator.
Update typing in the main example and cohesion/coupling correlation definition in "Dependency injection and inversion of control in Python". Thanks to @illia-v (Illia Volochii) for the PR (#580).
Update copyright year.
Enable skipped test test_schema_with_boto3_session().
Update pytest configuration.
Regenerate C sources using Cython 0.29.30.
Fix bug #574 _: "@inject breaks inspect.iscoroutinefunction". Thanks to @burritoatspoton (Rafał Burczyński) _ for reporting the issue.
Fix bug #574: "@inject breaks inspect.iscoroutinefunction". Thanks to @burritoatspoton (Rafał Burczyński) for reporting the issue.
Optimize injections and wiring from x1.5 to x7 times depending on the use case.
Optimize injections and wiring from x1.5 to x7 times depending on the use case.
Fix bug #569: "numpy.typing.NDArray breaks wiring". Thanks to @VKFisher (Vlad Fisher) for reporting the issue and providing a fix.
Add new provider Aggregate. It is a generalized version of FactoryAggregate that can contain providers of any type, not only Factory. See issue #530 _
Add new provider Aggregate. It is a generalized version of FactoryAggregate that can contain providers of any type, not only Factory. See issue #530. Thanks to @zerlok (Danil Troshnev) for suggesting the feature.
Add argument as_ to the config.from_env() method for the explicit type casting of an environment variable value, e.g.: config.timeout.from_env("TIMEOUT", as_=int). See issue #533. Thanks to @gtors (Andrey Torsunov) for suggesting the feature.
Add .providers attribute to the FactoryAggregate provider. It is an alias for FactoryAggregate.factories attribute.
Add .set_providers() method to the FactoryAggregate provider. It is an alias for FactoryAggregate.set_factories() method.
Add string imports for Factory, Singleton, Callable, Resource, and Coroutine providers, e.g. Factory("module.Class"). See issue #531. Thanks to @al-stefanitsky-mozdor for suggesting the feature.
Fix Dependency provider to don't raise "Dependency is not defined" error when the default is a falsy value of proper type. See issue #550. Thanks to @approxit for reporting the issue.
Refactor FactoryAggregate provider internals.
Update logo on Github and in docs to support dark themes and remove some imperfections.
Drop support of Python 3.4. There are no immediate breaking changes, but Dependency Injector will no longer be tested on Python 3.4 and any bugs will…
Add support of Python 3.10.
Improve wiring with adding importing modules and packages from a string container.wire(modules=["yourapp.module1"]).
Add container wiring configuration wiring_config = containers.WiringConfiguration().
Add support of with statement for container.override_providers() method.
Add Configuration(yaml_files=[...]) argument.
Add Configuration(ini_files=[...]) argument.
Add Configuration(pydantic_settings=[...]) argument.
Drop support of Python 3.4. There are no immediate breaking changes, but Dependency Injector will no longer be tested on Python 3.4 and any bugs will not be fixed.
Announce the date of dropping Python 3.5 support (Jan 1st 2022).
Fix Dependency.is_defined attribute to always return boolean value.
Fix envs_required=False behavior in Configuration.from_*() methods to give a priority to the explicitly provided value.
Update documentation and fix typos.
Regenerate C sources using Cython 0.29.24.
Migrate tests to pytest.
- Update docs.
Update docs.
Add support of non-string keys for FactoryAggregate provider.
Add support of non-string keys for FactoryAggregate provider.
Improve FactoryAggregate typing stub.
Improve resource subclasses typing and make shutdown definition optional PR #492. Thanks to @EdwardBlair for suggesting the improvement.
Fix type annotations for .provides. Thanks to Thiago Hiromi @thiromi for the fix PR #491.
Fix environment variables interpolation examples in configuration provider docs {$ENV} -> ${ENV}. Thanks to Felipe Rubio @krouw for reporting the issue and fixing yaml example PR #494.
Fix @containers.copy() decorator to respect dependencies on parent providers. See issue #477. Thanks to Andrey Torsunov @gtors for reporting the issue.
Fix typing stub for container.override_providers() to accept other types besides Provider.
Fix runtime issue with generic typing in resource initializer classes resources.Resource and resources.AsyncResource. See issue #488. Thanks to @EdwardBlair for reporting the issue.
Update wiring to support modules provided as packages. See issue #481 _. Thanks to @Sadbot _ for demonstrating the issue.
Fix a container issue with supporting custom string types. See issue #479 _. Thanks to @ilsurih _ for reporting the issue.
- Add support of six 1.16.0.
Add support of six 1.16.0.
Fix a bug with reverse shutdown order in container.shutdown_resources(). See issue #432 _. Thanks to Saulius Beinorius _ for bringing up the issue.
Fix a bug with reverse shutdown order in container.shutdown_resources(). See issue #432. Thanks to Saulius Beinorius for bringing up the issue.
Update container.shutdown_resources() to respect dependencies order while shutdown. See issue #432 _. Thanks to Saulius Beinorius _ for bringing up th
Update container.shutdown_resources() to respect dependencies order while shutdown. See issue #432. Thanks to Saulius Beinorius for bringing up the issue.
Add option envs_required for configuration provider .from_yaml() and .from_ini() methods. With envs_required=True methods .from_yaml() and .from_ini()
Add option envs_required for configuration provider .from_yaml() and .from_ini() methods. With envs_required=True methods .from_yaml() and .from_ini() raise an exception when encounter an undefined environment variable in the configuration file. By default this option is set to false for preserving previous behavior envs_required=False.
Add raising of an exception in configuration provider strict mode when provider encounters an undefined environment variable in the configuration file.
Update configuration provider environment variables interpolation to replace undefined environment variables with an empty value.
Update configuration provider to perform environment variables interpolation before passing configuration file content to the parser.
Add support of default value for environment variable in INI and YAML configuration files with ${ENV_NAME:default} format. See issue #459 _. Thanks to
Add support of default value for environment variable in INI and YAML configuration files with ${ENV_NAME:default} format. See issue #459. Thanks to Maksym Shemet @hbmshemet for suggesting the feature.
Add method Configuration.from_value(). See issue #462. Thanks to Mr. Slack Clone for bringing it up in the comments for configuration provider docs.
This fix a typo in di_in_python.rst doc. Thanks to @loingo95 _ for the fix.
This fix a typo in di_in_python.rst doc. Thanks to @loingo95 for the fix.
Improve wiring fault tolerance. See issue #441 _. Thanks to @ssheng _ for reporting the issue.
Fix a bug with List provider not working in async mode. See issue: #450 _. Thanks to @mxab _ for reporting the issue.
Add ContextLocalSingleton provider. See PR: #443 _. Thanks to @sonthonaxrk _ for the contribution.
Add ContextLocalSingleton provider. See PR: #443. Thanks to @sonthonaxrk for the contribution.
Regenerate C sources using Cython 0.29.22.
Fix an issue with Dict provider non-string keys. See issue: #435 _. Thanks to @daniel55411 _ for reporting the issue.
Fix an issue with Dict provider non-string keys. See issue: #435. Thanks to @daniel55411 for reporting the issue.
Fix Flask scoped contexts example. See issue: #440. Thanks to @sonthonaxrk for the contribution.
Fix ThreadSafeSingleton synchronization issue. See issue: #433 _. Thanks to @garlandhu _ for reporting the issue.
Fix ThreadSafeSingleton synchronization issue. See issue: #433. Thanks to @garlandhu for reporting the issue.
Implement providers' lazy initialization.
Implement providers' lazy initialization.
Improve providers' copying.
Improve typing in wiring module.
Fix wiring module loader uninstallation issue.
Fix provided instance providers error handing in asynchronous mode.
Fix overridden configuration option cache resetting. See issue: #428. Thanks to @dcendents for reporting the issue.
Remove restriction to wire a dynamic container.
Remove restriction to wire a dynamic container.
Fix wiring to not crash on missing signatures. See issue: #420 _. Thanks to @Balthus1989 _ for reporting the issue.
Fix wiring to not crash on missing signatures. See issue: #420. Thanks to @Balthus1989 for reporting the issue.
Fix recursive copying issue in Delegate provider. See issue: #245 _. Thanks to @GitterRemote _ for reporting the issue.
Fix recursive copying issue in Delegate provider. See issue: #245. Thanks to @GitterRemote for reporting the issue.
Add docs and example for Factory.add_attributes() method.
Remove legacy css file.
Remove unittest2 test dependency.
Implement context manager interface for resetting a singleton provider. See issue: #413 _. Thanks to @Arrowana _ for suggesting the improvement.
Implement context manager interface for resetting a singleton provider. See issue: #413. Thanks to @Arrowana for suggesting the improvement.
Implement overriding interface to container provider. See issue: #415. Thanks to @wackazong for bringing up the use case.
Fix async mode mode exception handling issue in Dependency provider. See issue: #409 _. Thanks to @wackazong _ for reporting the issue.
Fix async mode mode exception handling issue in Dependency provider. See issue: #409. Thanks to @wackazong for reporting the issue.
Fix links to boto3 example.
Add wiring injections into modules and class attributes. See issue: #411 _. Many thanks to @brunopereira27 _ for submitting the use case.
Add wiring injections into modules and class attributes. See issue: #411. Many thanks to @brunopereira27 for submitting the use case.
Introduce wiring inspect filter to filter out flask.request and other local proxy objects from the inspection. See issue: #408 _. Many thanks to @bvan
Introduce wiring inspect filter to filter out flask.request and other local proxy objects from the inspection. See issue: #408. Many thanks to @bvanfleet for reporting the issue and help in finding the root cause.
Add boto3 example.
Add tests for .as_float() modifier usage with wiring.
Make refactoring of wiring module and tests. See PR # #406. Thanks to @withshubh for the contribution: - Remove unused imports in tests. - Use literal syntax to create data structure in tests.
Add integration with a static analysis tool DeepSource.
Improve error message for Dependency provider missing attribute.
Add wiring by string id.
Improve error message for Dependency provider missing attribute.
Amend docs and add another example for @containers.copy() decorator.
Amend docs and add another example for @containers.copy() decorator.
Add application-multiple-containers-runtime-overriding example. This example demonstrates how to build application from multiple containers and overri
Add application-multiple-containers-runtime-overriding example. This example demonstrates how to build application from multiple containers and override one container config from another one in the runtime. See issue: #207.
Add attributes forwarding for the Dependency provider.
Add docs on @containers.copy() decorator.
Add docs on @containers.copy() decorator.
Refactor @containers.copy() decorator.
Refactor async mode support in containers module.
- Fix docs publishing.
Fix docs publishing.
- Fix a typo.
Fix a typo.
Fix mistakenly processed awaitable objects in async mode. This bug has corrupted fastapi-redis example causing pool exhaustion. Thanks to @iliamir _ a
Fix mistakenly processed awaitable objects in async mode. This bug has corrupted fastapi-redis example causing pool exhaustion. Thanks to @iliamir and Valery Komarov for finding and reporting the issue.
Refactor async mode.
Improve async mode exceptions handling.
Improve async mode exceptions handling.
Fix double printing of exception when async resource initialization causes an error.
Hotfix a bug with importing FastAPI Request. See issue: #398 _. Thanks to @tapm _ for reporting the bug.
Add support of aliases for Configuration provider. See issue: #394 _. Thanks to @gtors _ for suggesting the feature.
Pin sphinx version to hotfix docs build.
Pin sphinx version to hotfix docs build.
Fix a typo in docs.
Add method container.check_dependencies() to check if all container dependencies are defined. See issue: #383 _. Thanks to @shaunc _ for suggesting th
Add method container.check_dependencies() to check if all container dependencies are defined. See issue: #383. Thanks to @shaunc for suggesting the feature.
Add container name to the representation of the Dependency provider.
Add docs cross-links between Singleton provider and "Reset container singletons" pages.
Improve Dependency provider error message: when dependency is undefined, error message contains its name.
Improve Dependency provider error message: when dependency is undefined, error message contains its name.
Move docs on container "self" injections to "Providers" section.
Move docs on container "self" injections to "Providers" section.
- Refactor containers module.
Refactor containers module.
Add container "self" injections. See issue: #364 _. Thanks to @shaunc _ for suggesting the feature.
Your coding agent can read these notes before it upgrades. Set up the MCP server →