Metadata-Version: 2.1
Name: dependencies
Version: 2.0.1
Summary: Dependency Injection for Humans
Home-page: https://pypi.org/project/dependencies/
License: BSD-2-Clause
Author: Artem Malyshev
Author-email: proofit404@gmail.com
Requires-Python: >=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, !=3.4.*
Classifier: Development Status :: 5 - Production/Stable
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: BSD License
Classifier: Programming Language :: Python :: 2
Classifier: Programming Language :: Python :: 2.7
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.5
Classifier: Programming Language :: Python :: 3.6
Classifier: Programming Language :: Python :: 3.7
Classifier: Programming Language :: Python :: 3.8
Classifier: Topic :: Software Development
Project-URL: Documentation, https://proofit404.github.io/dependencies/
Project-URL: Repository, https://github.com/proofit404/dependencies/
Description-Content-Type: text/markdown

# Dependencies

[![azure-devops-builds](https://img.shields.io/azure-devops/build/proofit404/dependencies/2?style=flat-square)](https://dev.azure.com/proofit404/dependencies/_build/latest?definitionId=2&branchName=master)
[![azure-devops-coverage](https://img.shields.io/azure-devops/coverage/proofit404/dependencies/2?style=flat-square)](https://dev.azure.com/proofit404/dependencies/_build/latest?definitionId=2&branchName=master)
[![pypi](https://img.shields.io/pypi/v/dependencies?style=flat-square)](https://pypi.python.org/pypi/dependencies/)
[![conda](https://img.shields.io/conda/vn/conda-forge/dependencies?style=flat-square)](https://anaconda.org/conda-forge/dependencies)

Dependency Injection for Humans.

**[Documentation](https://proofit404.github.io/dependencies/) |
[Source Code](https://github.com/proofit404/dependencies) |
[Task Tracker](https://github.com/proofit404/dependencies/issues)**

Dependency Injection (or simply DI) is a great technique. By using it you can
organize responsibilities in you codebase. Define high level policies and system
behavior in one part. Delegate control to low level mechanisms in another part.
Simple and powerful.

With help of DI you can use different parts of your system independently and
combine their behavior really easy.

If you split logic and implementation into different classes, you will see how
pleasant it becomes to change your system.

This tiny library helps you to connect parts of your system, in particular - to
inject low level implementation into high level behavior.

## Pros

- Provide composition instead of inheritance.
- Solves top-down architecture problems.
- Boilerplate-free object hierarchies.
- API entrypoints, admin panels, CLI commands are oneliners.

## Example

Dependency injection without `dependencies`

```pycon

>>> from app.robot import Robot, Servo, Amplifier, Controller, Settings

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

>>> robot.work()

```

Dependency injection with `dependencies`

```pycon

>>> from dependencies import Injector

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

>>> Container.robot.work()

```

## Questions

If you have any questions, feel free to create an issue in our
[Task Tracker](https://github.com/proofit404/dependencies/issues). We have the
[question label](https://github.com/proofit404/dependencies/issues?q=is%3Aopen+is%3Aissue+label%3Aquestion)
exactly for this purpose.

## License

Dependencies library is offered under the two clause BSD license.

<p align="center">&mdash; ⭐️ &mdash;</p>
<p align="center"><i>The dependencies library is part of the SOLID python family.</i></p>

