Skip to content

[delete] Core container as singletone for entire app #556

@VasyaGaikin

Description

@VasyaGaikin

App Package (Container) Diagramm

The CoreContainer container contains:

class CoreContainer( containers.DeclarativeContainer ): arguments = providers.Resource( parse_arguments ) config = providers.Resource( parse_config, arguments=arguments ) _logging = providers.Resource( init_logging, arguments=arguments, config=config ) logger_factory = providers.Factory( logging.getLogger ).provider

The main question is about CoreContainer. Is there a way to make it
share for the entire application? The only way I found is when
importing top-level containers (CleanContainer, DatabaseInitContainer,
ParseContainer, ...) specify the CoreContainer container as a
dependency and pass it into the chuld containers.

If I do this:

class DatabaseContainer( containers.DeclarativeContainer ): core: CoreContainer = providers.Container( CoreContainer ) ... class DownloadContainer( containers.DeclarativeContainer ): core: CoreContainer = providers.Container( CoreContainer ) ... class ParseContainer( containers.DeclarativeContainer ): core: CoreContainer = providers.Container( CoreContainer )

then all elements in CoreContainer are initialized multiple times.
It was it would be convenient if the container itself was like a
Singletone for the entire application.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions