-
-
Notifications
You must be signed in to change notification settings - Fork 337
Closed
Labels
Description
Hi,
I'm trying to create a Dependency provider for some python interface I have in the form of abstract-base-class (ABC).
Trying creating the provider raises an error.
What is the correct way for achieving this?
# file testc.py
from abc import ABC
from dependency_injector import providers
class Base(ABC):
pass
class Impl(Base):
pass
p = providers.Dependency(Base) # this line raises
p.provided_by(providers.Object(Impl()))
I get the following error:
Traceback (most recent call last):
File "testc.py", line 13, in <module>
p = providers.Dependency(Base)
TypeError: Argument 'instance_of' has incorrect type (expected type, got ABCMeta)
Thanks