$ pipenv install simple-ioc
or
$ pip install simple-ioc
In order to have the IoC (Inversion of Control) working in your application, you must register your services in the IoC container:
from simple_ioc import Container
class AService:
# Your service implementation comes here
Container().register('an_identifier', lambda: AService())
Then, from any point in your application, you can retrieve the service by calling get
:
a_service = Container().get('an_identifier')