Overview
The configuration module provides utilities for reading and writing TOML configuration files, particularly for managing Flower and Syft-Flwr project metadata.Functions
load_flwr_pyproject
Load and validate a Flower project’spyproject.toml file.
Parameters
Path to the project directory or
pyproject.toml file. If a directory is provided, it will automatically look for pyproject.toml inside.Whether to validate that the module references in the configuration exist. Set to
False to skip module validation (useful during testing or parallel execution).Returns
Parsed and validated pyproject.toml configuration as a dictionary.
Usage Example
Fromrun.py:22-25:
Exceptions
Exception
Raised if the configuration is invalid or module references cannot be found (when
check_module=True).load_toml
Load any TOML file into a dictionary.Parameters
Path to the TOML file to load.
Returns
Parsed TOML file as a dictionary.
Usage Example
write_toml
Write a dictionary to a TOML file.Parameters
Path to the TOML file to write.
Dictionary to serialize and write to the TOML file.
Returns
None - The function writes to the file in place.
Usage Example
Frombootstrap.py:83:
Configuration Structure
After bootstrapping, yourpyproject.toml will contain both Flower and Syft-Flwr configurations:
Flower Configuration
Syft-Flwr Configuration
Project Dependencies
Transport Types
Default for local/server environmentsUses local SyftBox file synchronization with RPC and end-to-end encryption. Best for:
- Local development and testing
- Server deployments with SyftBox installed
- Maximum security with E2E encryption
Default for Google ColabUses peer-to-peer synchronization via cloud storage (Google Drive/OneDrive). Best for:
- Google Colab environments
- Remote collaboration without SyftBox
- Cloud-based deployments
Validation
Theload_flwr_pyproject function validates:
- File existence -
pyproject.tomlmust exist - Required sections - Must have
[tool.flwr.app]configuration - Component references -
serverappandclientappmust be valid Python module paths - Module availability - Referenced modules must be importable (when
check_module=True)
Notes
- Configuration files are written in binary mode for proper TOML encoding
- Validation warnings are logged but don’t prevent loading
- Module checking can be disabled for faster loading during testing