python-dependency-injector
python-dependency-injector copied to clipboard
Dependency injection framework for Python
I am trying to re-create an onion-layer architecture with the dependency injector library. Here is a snippet: ```py from dependency_injector import containers, providers class DbAdapter: def get_all(self): return [] class...
Hi! We've started to use dependency-injector in production recently and we're happy so far, but we've faced issue with async resources initialization order. The problem is that according to the...
Hi, i've been using this greate freamework in my project these days. In the docs of [wiring](https://python-dependency-injector.ets-labs.org/wiring.html#making-injections-into-modules-and-class-attributes), i see it's possible to wire a depedndency into a class directly,but in...
Hello, I am trying to provide a long-lived `aiohttp.ClientSession` for integrating with an external HTTP API. I have an async generator for the resource defined as: ```python async def http_session_factory(*args,...
Hi, first off, I'd like to say thank you for this amazing library. So easy to use and so efficient. Now, the problem I have is that my project runs...
For example, developer make typo in `Provide[...]`: container.py ```python class ApplicationContainer(containers.DeclarativeContainer): some_service = providers.Singleton(object) ``` app.py ```python # FastAPI @app.get("/") @inject async def some_handler(service = Depends(Provide["sOme_service"])): # suppose there is...
Hi, I am trying to import python-dependency-injector package within lambda function. All other packages gets imported fine, but with this package I keep getting the below error :\ `{"errorMessage": "Unable...
Hey, I'm trying to wire a class property that will be used as a decorator for caching. Created [this example](https://github.com/noamby/fastapi-todo-di-example) that reproduces the issue The error message in length is...
Hi I have the following scenario, and I am a bit blocked.... I have a container that I use to load all configurations `Configuration`, and to ensure that, when changes...
I looked at a [related](https://github.com/ets-labs/python-dependency-injector/issues/421) issue but found that the solution there was not working well for me. What I understand is that singletons need to be reset. Here is...