A simple Python package that provides an easy way to use Dependency Injection in your projects.
- Easy to use
- Supports both function and class-based dependency injection
- Allows customizing the way dependencies are resolved
- Allows for the use of custom containers
To install the latest pypotage version, run the following command:
python -m pip install -U pypotage
To install the development version:
git clone https://github.com/pavalso/potage.git
cd potage
python -m pip install -U .
import pypotage
import logging
@pypotage.prepare
def logger():
logging.basicConfig(level=logging.DEBUG)
return logging.getLogger(__name__)
pypotage.cook(logging.Logger).take_out().info("Hello World!")
import pypotage
class A:
def __init__(self):
...
@pypotage.prepare
class B(A):
def __init__(self):
...
pypotage.cook(A).take_out() # returns an instance of B