python-dependency-injector icon indicating copy to clipboard operation
python-dependency-injector copied to clipboard

Dependency injection framework for Python

Results 239 python-dependency-injector issues
Sort by recently updated
recently updated
newest added

How can I create a Singleton object based on a generator? For example ``` def session_factory(connection): with connection() as conn: session = Session(bind=conn) yield session try: session.commit() except: session.rollback() finally:...

question

Python 3.9 on Windows 10 system. ``` Traceback (most recent call last): File "C:\proj\grandstream-spectralink\src\__main__.py", line 17, in asyncio.run(run()) File "C:\Python39\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Python39\lib\asyncio\base_events.py", line 642,...

bug
research

There seems to be a strange issue when using a Singleton provider that runs in async mode and needs access to the event loop: Every second test fails. I was...

Hey there, I see you have a threadlocal scope provider. However do you have a co-routine local scope provider that would use ContextVars rather than thread locals? Would that be...

feature

Good afternoon, First off - great job with this library. I'm really excited to be using it. I'm trying to use it to support dependency injection for Clean Architecture. I...

Suppose one have a `dataclass` with default values specified inside it. What is the best way to use this defaults in `providers.Configuration`? And another question: how do you pass config...

I have not found a good explanation in the docs on how to achieve the following: There is an application that is organised in bounded contexts which have no overlap,...

![image](https://user-images.githubusercontent.com/40897360/154210381-adb6fab1-a952-4b98-bf41-2a0e50c58800.png)

### Steps to reproduce Consider the following example: ```python from typing import Any from dependency_injector import providers, containers, resources from fastapi import FastAPI class SampleResource(resources.AsyncResource[None]): async def init(self, *args: Any,...

bug
research

hello. The following code tries to use SubContainer to perform dependency injection into a Service, but this code cannot be executed with the exception "exception: no description". ```python from dependency_injector...