IoC (Inversion of Control) Dependency InjectionΒΆ
Support for automatic resolution of dependencies from factories.
These methods are built around data annotations and the abc module.
Usage:
>>> from pyapp.injection import register_factory, inject, Arg
>>> register_factory(FooObject, foo_factory)
# Markup methods for injection
>>> @inject
>>> def my_function(foo=Arg(FooObject)):
... ...
When my_function is called foo_factory is used to instantiate a concrete instance of a FooObject.