Python dependency injection framework, inspired by Guice
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.
- Developed at devel:languages:python
-
2
derived packages
- Download package
-
Checkout Package
osc -A https://api.opensuse.org checkout openSUSE:Factory/python-injector && cd $_
- Create Badge
Refresh
Refresh
Source Files
Filename | Size | Changed |
---|---|---|
0.21.0.tar.gz | 0000046600 45.5 KB | |
python-injector.changes | 0000005126 5.01 KB | |
python-injector.spec | 0000002610 2.55 KB |
Latest Revision
Ana Guerrero (anag+factory)
accepted
request 1131714
from
Dirk Mueller (dirkmueller)
(revision 10)
- update to 0.21.0: * Improved the documentation, thanks to jonathanmach and Jakub Wilk * Fixed a thread-safety regression * Improved the type annotations, thanks to David Pärsson * Fixed singleton scope behavior with parent/child injectors, thanks to David Pärsson * Stopped using a deprecated test function, thanks to ljnsn - Added support for PEP 604 union types (Python 3.10+), thanks to David Pärsson - Dropped Python 3.6 support - BuildRequires on the dataclasses module if using python 3.6 * Added support for overriding injectable parameters with positional * Dropped Python 3.4 support * Removed previously deprecated constructs: with_injector, * Dependencies are no longer injected into Module.configure and * Removed unofficial support for injecting into parent class
Comments 0