Closed felixgao closed 9 months ago
I think I figured it out, but it is not the most clean approach I think.
basically use the provided
to get the actual value.
class GenOSOCRContainer(containers.DeclarativeContainer): # pragma: no cover
config = providers.Dependency(instance_of=OCRSettings)
ocr_client = providers.Selector(
config.provided.engine,
paddle_ocr=providers.Factory(
PaddleOCRProvider,
parser=providers.Selector(
config.provided.parser,
paddle_wordbox_parser=providers.Factory(PaddleWordBoxParser),
),
url=config.provided.url,
timeout=config.provided.timeout,
),
)
I am trying to pass a config object that I have between containers to bind the correct factory for each object types that I have.
when I run my code it get an AttributeError
my container.py has the following
the
get_settings
function returns a pydantic setting object.my yaml file configuration that loads into settings looks like