python-dependency-injector
python-dependency-injector copied to clipboard
Dependency injection framework for Python
Hi! I would like to manage a scope-managed resource with a possible fastapi request. If I write something like: ```py class MyService: def __init__(self, session: Callable[[], Awaitable[int]]) -> None: self._session...
```python # main.py from collections.abc import Iterator from contextlib import contextmanager from typing import reveal_type from dependency_injector import containers, providers @contextmanager def _get_my_int() -> Iterator[int]: print("Enter context") yield 1 class...
Hi. I am struggling to use the library on python3.12 in a RHEL8 environment (Red Hat Linux). dependency-injector version is 4.48.1. The code to reproduce is: ```py from dependency_injector import...
Hello, one of our software uses dependency injector library in its core. I have noticed an unexpected side effect on Win11. The script that uses dependency injector is in a...
Hi there, I have the Common container and there is a config. I create New container by copying of the Common container. How can I get access to the config...
Hi, I basically picked up this library today and while trying ot set up a working example I ran into this: Basically if I try to run a entry point...
I have the following container which describes some User. It has both factories and singletons specific for this user. It depends on a `ClientSession` object which can be injected from...
https://github.com/ets-labs/python-dependency-injector/blob/master/src/dependency_injector/containers.pyi#L59 Having ``` Container: def __getattr__(self, name: str) -> Provider: ... ``` in stubs silences cases, when container does not have particular attribute at-all. In my current codebase, I add...
When using a method with an `inject` decorator, and we inject a resource that is wrapped up with the `Closing` marker, if that method throws an exception then I would...
For Dependency Injector versions 4.48.0 and above, the `app` variable is initialized as an instance of `_asyncio.Task`: ```python from faststream import FastStream from faststream.rabbit import RabbitBroker from dependency_injector import containers,...