Synopsis
Description
Thebootstrap command converts an existing Flower project into a syft-flwr project by:
- Validating the Flower project structure
- Adding syft-flwr configuration to
pyproject.toml - Creating a
main.pyfile for running the federated learning workflow - Configuring datasites (data owners) and aggregator (data scientist)
- Setting up the communication transport (SyftBox or P2P)
Arguments
Path to a Flower project directory. Must contain a valid
pyproject.toml file.The directory is validated to ensure:- The directory exists
pyproject.tomlexists in the directorymain.pydoes not already exist (to prevent overwriting)
Options
Datasite email of the Flower Server (aggregator/data scientist).Aliases:
-a, --server, -sFormat: Valid email address (e.g., [email protected])If not provided via flag, you’ll be prompted interactively:Comma-separated list of datasite emails for Flower Clients (data owners).Aliases:
-dFormat: Comma-separated email addresses (e.g., [email protected],[email protected])If not provided via flag, you’ll be prompted interactively:Display help information for the bootstrap command.Aliases:
-hExamples
Bootstrap with All Flags
Bootstrap with Interactive Prompts
Bootstrap with Short Flags
Bootstrap with Absolute Path
What Gets Modified
pyproject.toml Changes
The bootstrap command modifies yourpyproject.toml file:
-
Adds syft-flwr dependency:
-
Adds syft-flwr configuration:
-
Sets Flower partition config:
main.py Creation
A newmain.py file is created from a template to orchestrate the federated learning workflow. This file handles:
- Loading project configuration
- Managing client/server communication
- Coordinating the FL training process
Transport Types
The transport type is automatically detected:syftbox(default): Local SyftBox with RPC and encryption- Used on standard environments
- Requires SyftBox client installation
p2p: Peer-to-peer sync via Google Drive/OneDrive- Automatically selected in Google Colab
- Suitable for distributed environments without SyftBox
Validation
The command validates:- Project directory exists
- pyproject.toml exists in the directory
- main.py does not exist (prevents overwriting)
- Aggregator email is valid (format validation)
- All datasite emails are valid (format validation)
Error Handling
Directory Not Found
Missing pyproject.toml
main.py Already Exists
Invalid Email Format
Exit Codes
0: Bootstrap succeeded1: Bootstrap failed (validation error, file system error, etc.)
Next Steps
After bootstrapping:- Review the configuration in
pyproject.toml - Install dependencies:
- Run a simulation to test:
See Also
- run command - Run the bootstrapped project in simulation mode
- CLI Overview - Complete CLI reference