A clean, simple type-safe framework for using the Dependency Injection pattern in Python.
from autoinject import injector, auto
@injector.injectable
class MyService:
def __init__(self): ...
class MyClient:
service: MyService
@injector.construct
def __init__(self):
# self.service will be set before this function is called
...
@injector.inject
def my_client_function(service: MyService = auto()):
# service will be set before this function is called
...Read the full documentation for more details.