Dependency Injector 3.16 has been released - New List provider
I have released Dependency Injector 3.16.
Main feature of this release is a new List provider. Release also contains documentation fixes and adding support of six 1.15.0.
Release is available for downloads on PyPI.
List provider
List provider is needed for injecting a list of dependencies. Now it is as simple as this:
dispatcher_factory = providers.Factory(
Dispatcher,
modules=providers.List(
providers.Factory(Module, name='m1'),
providers.Factory(Module, name='m2'),
),
)
The call to dispatcher_factory is equivalent to:
dispatcher = Dispatcher(
modules=[
Module(name='m1'),
Module(name='m2'),
],
)
Visit docs for Full Example.
Changelog
- Add List provider issue #243, PR #251.
- Fix a few typos in docs (thanks to Bruno P. Kinoshita, issue #249, PR #250).
- Add support of six 1.15.0.
- Regenerate C sources using Cython 0.29.20.
More
- https://github.com/ets-labs/python-dependency-injector
- http://python-dependency-injector.ets-labs.org
Enjoy Python and Dependency Injection.