python-dependency-injector
python-dependency-injector copied to clipboard
Dependency injection framework for Python
It would be useful to be able to cast env variables to a specific type, for example: ```python def setup_config(config: Configuration): config.foo.from_env("VAR_FOO", cast=int, default=1) config.bar.from_env("VAR_BAR", cast=bool, default=True) ``` Inspired by...
This PR addresses https://github.com/ets-labs/python-dependency-injector/issues/509
Add providers log on error.
Hi, is there a way to inject config parts directly? e.g. ```python @inject def do_somthing(some_value = Provide[Container.config.foo.bar.some_value]) print(some_value) ``` or even with `Container.config.foo.bar.some_value._as_int()` ?
Can we implement something like [that](https://proofit404.github.io/dependencies/package/)? In `dependency_injector` i see it like that: ```python from dependency_injector import containers, providers class Container(containers.DeclarativeContainer): persist_user = providers.Factory("app.repositories.create_user") ```
Hi, Would be cool if there would be a provider method that would be provided with the target information the provided element is injected to (...sorry for that funny sentence.....
:eyes: Some source code analysis tools can help to find opportunities for improving software components. :thought_balloon: I propose to [increase the usage of augmented assignment statements](https://docs.python.org/3/reference/simple_stmts.html#augmented-assignment-statements "Augmented assignment statements") accordingly....
hi. Sorry for the confusing question. I want to register only the interface in the Container without having an implementation. Specifically, it is as follows: ```python import abc from dependency_injector...
Dear all, I've been struggling to inherit from Configuration. I'd like to adapt the __setitem__ method to always execute a method when a configuration is changed. Has anyone ever done...
Currently if the callable provider fails due to missing arguments or other errors, it may be hard to find out which guy is missing arguments if one provider is being...