python-dependency-injector/examples/miniapps/decoupled-packages/example/user/containers.py

19 lines
409 B
Python
Raw Permalink Normal View History

"""User containers module."""
from dependency_injector import containers, providers
from . import entities, repositories
class UserContainer(containers.DeclarativeContainer):
database = providers.Dependency()
user = providers.Factory(entities.User)
user_repository = providers.Singleton(
repositories.UserRepository,
entity_factory=user.provider,
db=database,
)