rodi
rodi copied to clipboard
Implementation of dependency injection for Python 3
Given the following, factory methods fail to produce the expected outcome, and instead raise the `NotImplementedError` exception. ```py class Dep: def __init__(_, value: str): ... TypeA = Annotated[Dep, "type_a"] TypeB...
This fixes issue #53
Y'all may have a reason for not defining the return type of `ContainerProtocol.register`, but if so, I didn't pick up on it. Here I propose making `ContainerProtocol.register` return `Self`. This...
## Problem Given you are in a scope and you need to open a new scope, when resolving a dependency in the original scope the `get` method will not find...
I am trying to integrate rodi with FastAPI but I am not sure how should I approach to the problem. Is there any example? Flask or any other web framework...
Hi! I was working on a project using rodi and I noticed that when a dependency that depends on another dependency has an `__init__`, it fails to resolve. Ok, I'm...
Hi, How to apply the Decorator design pattern with rodi, on single instance registrations and/or collection registrations? Example how I used to do it with a DI container from C#...
This way you can actually override some things from module's namespace with `inject()` function. It is very useful for tests.
Using `Union[Type[T], str]` is problematic, because when `str` is passed, mypy infers `T` to be `Never`. Instead, you should use an `overload` with two cases, so inference would be correct:...
I've improved the `self` annotations for the `Container` type. So, here's how it works: 1. There's a dedicated `Self` type in `typing` and `typing_extensions` that we cannot use here, because...