Skip to content

Cannot Access Providers in Container Inheritance #914

@emmanuel-pastor-momox

Description

@emmanuel-pastor-momox

I have this code:

class SharedContainer(containers.DeclaredContainer):
     config = providers.Configuration()
     stats = providers.Factory(Stats)

class APIContainer(SharedContainer):
    first_api_client = providers.Factory(FirstAPIClient, client_id=config.client_id)  # config from SharedContainer
    second_api_client = providers.Factory(SecondAPIClient, secret=config.secret, client_id=config.client_id)   # config from SharedContainer

It appears the config cannot be accessed. And I don't want to access it from the SharedContainer directly like: SharedContainer.config.*

Any work around?

Thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions