"""The Code, that uses IoC container."""

from dependency_injector import catalogs
from dependency_injector import providers

from ioc_example import Service
from ioc_example import Client


class Components(catalogs.DeclarativeCatalog):
    """Components catalog."""

    service = providers.Factory(Service)

    client = providers.Factory(Client, service=service)


if __name__ == '__main__':
    client = Components.client()  # Application creates Client's instance

"""The Code, that uses IoC container."""

from dependency_injector import catalogs
from dependency_injector import providers

from ioc_example import Service
from ioc_example import Client


class Components(catalogs.DeclarativeCatalog):
    """Component providers catalog."""

    service = providers.Factory(Service)

    client = providers.Factory(Client, service=service)


if __name__ == '__main__':
    client = Components.client()  # Application creates Client's instance

Update ioc_container_example.py