injector
injector copied to clipboard
Python dependency injection framework, inspired by Guice
Hi, let me start from thanking for the awesome project 🎉 Recently I was implementing a custom scope and I noticed a need for explicitly demarking beginning and ending of...
Am aware this is more a question, rather than a bug, but perhaps an indication that an example scope implementation (other that an example of seemingly re-implementing NoScope would be...
Hi, Thanks for this great project, it adds really nice separation to my code. But now I want to unittest everything and there are two cases: 1) In documentation you...
Using Injector to bind a concrete class to an abstract interface, and then getting an instance of that interface causes a mypy error: ``` class MyABC(ABC): pass class MyClass(MyABC): pass...
Hey there, giving injector a go with a project and seeing a bit of an issue when trying to inject types which are defined as a forward reference using the...
How would one use this library with pytest without actually doing ```python def test_something(injector): dependency = injector.get(Class) ``` It'd be nice if I could use the injector with pytest. ```python...
The README suggests a nice patter with `@dataclass`: ```python @injector.inject @dataclass class Website: settings: WebsiteSettings ``` But is seems that does not work or I am missing something. ```python Traceback...
There doesn't seem to be a way to bind eager singletons. The only reference is in the Module's provides method, but this is unreferenced. ``` def provides(interface, scope=None, eager=False): ```
I played around with `injector` and `Flask-Injector` the last few days, mostly because I came to realize that bigger `Flask` applications can easily become a nightmare when writing tests. I...
Using `NewType` (or `Key`) is a great way to inject configuration into classes, but there are cases where there is a sane default that is rarely overridden. In these cases...