Skip to content

Latest commit

 

History

History
66 lines (44 loc) · 2.04 KB

README.md

File metadata and controls

66 lines (44 loc) · 2.04 KB

logo

azure-pipeline codecov docs gitter pypi black


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

>>> from examples import Robot, Servo, Amplifier, Controller, Settings

>>> robot = Robot(
...     servo=Servo(amplifier=Amplifier()),
...     controller=Controller(),
...     settings=Settings(environment="production"),
... )

>>> robot.work()

Dependency injection with dependencies

>>> from dependencies import Injector

>>> class Container(Injector):
...     robot = Robot
...     servo = Servo
...     amplifier = Amplifier
...     controller = Controller
...     settings = Settings
...     environment = "production"

>>> Container.robot.work()

License

Dependencies library is offered under the two clause BSD license.