Flower CLI reference#

flwr CLI#

flwr#

flwr is the Flower command line interface.

flwr [OPTIONS] COMMAND [ARGS]...

Options

--install-completion#

Install completion for the current shell.

--show-completion#

Show completion for the current shell, to copy it or customize the installation.

build#

Build a Flower project into a Flower App Bundle (FAB).

You can run flwr build without any arguments to bundle the current directory, or you can use --directory to build a specific directory: flwr build --directory ./projects/flower-hello-world.

flwr build [OPTIONS]

Options

--directory <directory>#

Path of the Flower project to bundle into a FAB

example#

Clone a Flower example.

All examples available in the Flower repository are available through this command.

flwr example [OPTIONS]

install#

Install a Flower App Bundle.

It can be ran with a single FAB file argument:

flwr install ./target_project.fab

The target install directory can be specified with --flwr-dir:

flwr install ./target_project.fab --flwr-dir ./docs/flwr

This will install target_project to ./docs/flwr/. By default, flwr-dir is equal to:

  • $FLWR_HOME/ if $FLWR_HOME is defined

  • $XDG_DATA_HOME/.flwr/ if $XDG_DATA_HOME is defined

  • $HOME/.flwr/ in all other cases

flwr install [OPTIONS] source

Options

--flwr-dir <flwr_dir>#

The desired install path.

Arguments

source#

Optional argument

new#

Create new Flower project.

flwr new [OPTIONS] project_name

Options

--framework <framework>#

The ML framework to use

Options:

NumPy | PyTorch | TensorFlow | JAX | HuggingFace | MLX | sklearn | FlowerTune

--username <username>#

The Flower username of the author

Arguments

project_name#

Optional argument

run#

Run Flower project.

flwr run [OPTIONS] [APP_DIR] [FEDERATION]

Options

-c, --run-config <config_overrides>#

Override configuration key-value pairs, should be of the format:

–run-config key1=value1,key2=value2 –run-config key3=value3

Note that key1, key2, and key3 in this example need to exist inside the pyproject.toml in order to be properly overriden.

Arguments

APP_DIR#

Optional argument

FEDERATION#

Optional argument

flower-simulation#

Start a Flower simulation

usage: flower-simulation [-h] [--server-app SERVER_APP]
                         [--client-app CLIENT_APP] --num-supernodes
                         NUM_SUPERNODES [--app APP] [--run-config RUN_CONFIG]
                         [--backend BACKEND] [--backend-config BACKEND_CONFIG]
                         [--enable-tf-gpu-growth] [--verbose]
                         [--app-dir APP_DIR] [--flwr-dir FLWR_DIR]
                         [--run-id RUN_ID]

Named Arguments#

--server-app

For example: server:app or project.package.module:wrapper.app

--client-app

For example: client:app or project.package.module:wrapper.app

--num-supernodes

Number of simulated SuperNodes.

--app

Path to a directory containing a FAB-like structure with a pyproject.toml.

--run-config

Override configuration key-value pairs.

--backend

Simulation backend that executes the ClientApp.

Default: “ray”

--backend-config

A JSON formatted stream, e.g ‘{“<keyA>”:<value>, “<keyB>”:<value>}’ to configure a backend. Values supported in <value> are those included by flwr.common.typing.ConfigsRecordValues.

Default: “{}”

--enable-tf-gpu-growth

Enables GPU growth on the main thread. This is desirable if you make use of a TensorFlow model on your ServerApp while having your ClientApp running on the same GPU. Without enabling this, you might encounter an out-of-memory error because TensorFlow by default allocates all GPU memory.Read more about how tf.config.experimental.set_memory_growth() works in the TensorFlow documentation: https://www.tensorflow.org/api/stable.

Default: False

--verbose

When unset, only INFO, WARNING and ERROR log messages will be shown. If set, DEBUG-level logs will be displayed.

Default: False

--app-dir

Add specified directory to the PYTHONPATH and loadClientApp and ServerApp from there. Default: current working directory.

Default: “”

--flwr-dir
The path containing installed Flower Apps.

By default, this value is equal to:

  • $FLWR_HOME/ if $FLWR_HOME is defined

  • $XDG_DATA_HOME/.flwr/ if $XDG_DATA_HOME is defined

  • $HOME/.flwr/ in all other cases

--run-id

Sets the ID of the run started by the Simulation Engine.

flower-client-app#

Start a Flower client app

usage: flower-client-app [-h] [--insecure]
                         [--grpc-rere | --grpc-adapter | --rest]
                         [--root-certificates ROOT_CERT] [--server SERVER]
                         [--superlink SUPERLINK] [--max-retries MAX_RETRIES]
                         [--max-wait-time MAX_WAIT_TIME] [--dir DIR]
                         [--auth-supernode-private-key AUTH_SUPERNODE_PRIVATE_KEY]
                         [--auth-supernode-public-key AUTH_SUPERNODE_PUBLIC_KEY]
                         [--node-config NODE_CONFIG]
                         client-app

Positional Arguments#

client-app

For example: client:app or project.package.module:wrapper.app

Named Arguments#

--insecure

Run the client without HTTPS. By default, the client runs with HTTPS enabled. Use this flag only if you understand the risks.

Default: False

--grpc-rere

Use grpc-rere as a transport layer for the client.

Default: “grpc-rere”

--grpc-adapter

Use grpc-adapter as a transport layer for the client.

--rest

Use REST as a transport layer for the client.

--root-certificates

Specifies the path to the PEM-encoded root certificate file for establishing secure HTTPS connections.

--server

Server address

Default: “0.0.0.0:9092”

--superlink

SuperLink Fleet API (gRPC-rere) address (IPv4, IPv6, or a domain name)

Default: “0.0.0.0:9092”

--max-retries

The maximum number of times the client will try to reconnect to theSuperLink before giving up in case of a connection error. By default,it is set to None, meaning there is no limit to the number of tries.

--max-wait-time

The maximum duration before the client stops trying toconnect to the SuperLink in case of connection error. By default, itis set to None, meaning there is no limit to the total time.

--dir

Add specified directory to the PYTHONPATH and load Flower app from there. Default: current working directory.

Default: “”

--auth-supernode-private-key

The SuperNode’s private key (as a path str) to enable authentication.

--auth-supernode-public-key

The SuperNode’s public key (as a path str) to enable authentication.

--node-config

A comma separated list of key/value pairs (separated by =) to configure the SuperNode. E.g. –node-config ‘key1=”value1”,partition-id=0,num-partitions=100’

flower-server-app#

Start a Flower server app

usage: flower-server-app [-h] [--insecure] [--verbose]
                         [--root-certificates ROOT_CERT] [--server SERVER]
                         [--superlink SUPERLINK] [--dir DIR] [--fab-id FAB_ID]
                         [--fab-version FAB_VERSION] [--run-id RUN_ID]
                         [--flwr-dir FLWR_DIR]
                         [server-app]

Positional Arguments#

server-app

For example: server:app or project.package.module:wrapper.app

Named Arguments#

--insecure

Run the server app without HTTPS. By default, the app runs with HTTPS enabled. Use this flag only if you understand the risks.

Default: False

--verbose

Set the logging to DEBUG.

Default: False

--root-certificates

Specifies the path to the PEM-encoded root certificate file for establishing secure HTTPS connections.

--server

Server address

Default: “0.0.0.0:9091”

--superlink

SuperLink Driver API (gRPC-rere) address (IPv4, IPv6, or a domain name)

Default: “0.0.0.0:9091”

--dir

Add specified directory to the PYTHONPATH and load Flower app from there. Default: current working directory.

Default: “”

--fab-id

The identifier of the FAB used in the run.

--fab-version

The version of the FAB used in the run.

--run-id

The identifier of the run.

--flwr-dir
The path containing installed Flower Apps.

By default, this value is equal to:

  • $FLWR_HOME/ if $FLWR_HOME is defined

  • $XDG_DATA_HOME/.flwr/ if $XDG_DATA_HOME is defined

  • $HOME/.flwr/ in all other cases