Open
Description
Hi I want to create a resource using config value that pass from argparse. But somehow it return as config
main.py
container = Container(config={"alimit":100})
container.init_resources()
container.wire(modules=[sys.modules[__name__]])
container.py
def init_semaphore(limit):
return asyncio.BoundedSemaphore(limit)
class Container(containers.DeclarativeContainer):
config = providers.Configuration()
semaphore = providers.Resource(init_semaphore(limit=config.alimit))
I got error from init_semaphore due to limit is a config object instead of the value
How to do this correctly ?
It's not async but should be similar to example in https://python-dependency-injector.ets-labs.org/providers/resource.html
Metadata
Metadata
Assignees
Labels
No labels