Metadata-Version: 2.1
Name: junkie
Version: 3.0.0.dev2
Summary: A dependency injection library for beginners
Home-page: https://github.com/sealor/junkie
Author: Stefan Richter
License: UNKNOWN
Platform: UNKNOWN
Classifier: Programming Language :: Python :: 3
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Requires-Python: >=3.6
Description-Content-Type: text/markdown

# junkie

Junkie is a dependency injection library for beginners. It is easy to use and has no magic hidden state.

Core features:

- injects instances via parameter name and if not available via type annotation
- handles context managers when creating objects
- provides simple configuration with dictionaries
- can be easily combined with any other object instantiation approach
- supports a flexible way to define scopes

Example:

```python
from junkie import Junkie


class App:
    def __init__(self, text: str):
        self.text = text

    def greets(self) -> str:
        return self.text


context = Junkie({
    "greeting": "Hello",
    "name": "Joe",
    "text": lambda greeting, name: f"{greeting} {name}!"
})

with context.inject(App) as app:
    assert app.greets() == "Hello Joe!"
```


