Dependency Injection for Humans
Project description
Dependency Injection for Humans.
Installation
All released versions are hosted on the Python Package Index. You can install this package with following command.
pip install dependencies
Usage
Dependency injection without dependencies
robot = Robot(
servo=Servo(amplifier=Amplifier()),
controller=Controller(),
settings=Settings(environment="production"))
Dependency injection with dependencies
class Container(Injector):
robot = Robot
servo = Servo
amplifier = Amplifier
controller = Controller
settings = Settings
environment = "production"
robot = Container.robot
License
Dependencies library is offered under LGPL license.
Changelog
0.9 (2016-06-08)
Dependency assignment and cancellation for Injector subclasses.
0.8 (2016-06-05)
Correct syntax error for Python 2.6
0.7 (2016-06-04)
Raise DependencyError for mutual recursion in constructor arguments and specified dependencies.
Show injected dependencies in the dir result.
Deny to instantiate Injector and its subclasses.
0.6 (2016-03-09)
Deprecate c alias. Use real classes.
Allow to use let directly on Injector.
Do not instantiate dependencies named with cls at the end.
0.5 (2016-03-03)
Avoid attribute search recursion. This occurs with inheritance chain length started at 3 and missing dependency on first level.
Add c alias for Injector subclass access.
Add let factory to temporarily overwrite specified dependencies.
0.4 (2016-03-03)
Detect object.__init__ and skip it in the argument injection.
0.3 (2016-03-02)
Deprecate injectable mechanism. Injector may inject any arguments to any classes. Injector now support multiple DI targets. All possible targets now specified in the Injector attributes. Only single base inheritance allowed for Injector subclasses.
0.2 (2016-02-13)
Allows to override dependencies specified with Injector by inheritance from this Injector subclass.
0.1 (2016-01-31)
Initial release.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distributions
Hashes for dependencies-0.9-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 57c67f9272f67711132b20d6d0bb223f954039fcac690cf8bfa48f0dd341880f |
|
MD5 | 90caaeb8efb8418c8077848b6ea0454e |
|
BLAKE2b-256 | 22ce6072fbf46cb5888f8447dede545c368135dbdaf672c3a489e3b018c84010 |
Hashes for dependencies-0.9-py2-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | ebcedae728a1365d8176681c2ecd4e5d6b2de9deb9ce58570073bde571612cee |
|
MD5 | 4f043fd3ecb10580f1fbac63a9703551 |
|
BLAKE2b-256 | 989254bac442a0a9192df6305a327f8c4551bf30cbda43bf53d88b7681b7b6e0 |