Python dependency injection framework, inspired by Guice

Edit Package python-injector
https://github.com/alecthomas/injector

Dependency injection as a formal pattern is less useful in Python than
in other languages, primarily due to its support for keyword
arguments, the ease with which objects can be mocked, and its dynamic
nature.

That said, a framework for assisting in this process can remove a lot
of boiler-plate from larger applications. That's where Injector can
help. It automatically and transitively provides keyword arguments
with their values. As an added benefit, Injector encourages nicely
compartmentalised code through the use of Module s.

While being inspired by Guice, it does not slavishly replicate its
API. Providing a Pythonic API trumps faithfulness.

Refresh
Refresh
Source Files
Filename Size Changed
0.17.0.tar.gz 0000182459 178 KB
python-injector.changes 0000002148 2.1 KB
python-injector.spec 0000002321 2.27 KB
Revision 7 (latest revision is 20)
Tomáš Chvátal's avatar Tomáš Chvátal (scarabeus_iv) accepted request 718267 from Petr Gajdos's avatar Petr Gajdos (pgajdos) (revision 7)
- version update to 0.17.0
  * Added support for using `typing.Dict` and `typing.List` in multibindings. See :meth:`multibind <injector.Binder.multibind>`.
  * Added multibinding-specific :func:`provider <injector.provider>` variant: :func:`multiprovider <injector.multiprovider>`
  * Deprecated using :func:`provider <injector.provider>` for multibindings
  * Fixed failure to provide a default value to a `NewType`-aliased type with auto_bind enabled
  * Deprecated :func:`Key <injector.Key>`, :func:`SequenceKey <injector.SequenceKey>` and
    :func:`MappingKey <injector.MappingKey>` – use real types or type aliases instead
  * Deprecated using single-item lists and dictionaries for multibindings - use real types or type aliases instead
  Technically backwards incompatible:
  * typing.List and typing.Dict specializations are now explicitly disallowed as :meth:`bind <injector.Binder.bind>`
    interfaces and types returned by :func:`provider <injector.provider>`-decorated methods
Comments 0
openSUSE Build Service is sponsored by