class ClientApp(client_fn: Callable[[str], Client], mods: List[Callable[[Message, Context, Callable[[Message, Context], Message]], Message]] | None = None)[source]#

Bases: object

Flower ClientApp.


Assuming a typical Client implementation named FlowerClient, you can wrap it in a ClientApp as follows:

>>> class FlowerClient(NumPyClient):
>>>     # ...
>>> def client_fn(cid):
>>>    return FlowerClient().to_client()
>>> app = ClientApp(client_fn)

If the above code is in a Python module called client, it can be started as follows:

>>> flower-client-app client:app --insecure

In this client:app example, client refers to the Python module in which the previous code lives in and app refers to the global attribute app that points to an object of type ClientApp.