Skip to content

[Feature Request] No per-project SuperLink config support after migration from legacy pyproject.toml federations #6824

@CatherineHSU39

Description

@CatherineHSU39

Type

Feature

Description

Framework: flwr Python framework
Component: cli, config
Discovered in: flwr Python package (framework/py/flwr/)
Related files:

  • framework/py/flwr/cli/flower_config.py
  • framework/py/flwr/cli/config_migration.py
  • framework/py/flwr/cli/constant.py

Summary

Since [tool.flwr.federations] in pyproject.toml was deprecated in favour of the global
~/.flwr/config.toml, there is no longer a way to configure per-project SuperLink / simulation
settings (e.g. num-supernodes, client-resources) without directly editing the shared
global config file. The legacy system implicitly supported per-project configuration; the new
system does not provide an equivalent.


Current Behavior

  1. On the first flwr run, if ~/.flwr/config.toml does not exist, it is created with
    hardcoded defaults:

    [superlink]
    default = "local"
    
    [superlink.supergrid]
    address = "<supergrid-address>"
    
    [superlink.local]
    options.num-supernodes = 10
    options.backend.client-resources.num-cpus = 1
    options.backend.client-resources.num-gpus = 0
  2. If pyproject.toml contains a legacy [tool.flwr.federations] section, the settings are
    migrated once to ~/.flwr/config.toml and the original section is commented out in
    pyproject.toml with a migration notice.

  3. After migration, any further edits to the (now commented-out) pyproject.toml section are
    silently ignored — config.toml is never re-read from pyproject.toml.

  4. All Flower projects on the same machine share the same ~/.flwr/config.toml, so changing
    simulation settings for one project silently affects all others.


Steps to Reproduce

  1. Create two Flower apps that require different simulation settings, e.g.:
    • App A needs num-supernodes = 5, num-cpus = 2
    • App B needs num-supernodes = 50, num-cpus = 0.5
  2. Run flwr run for App A — ~/.flwr/config.toml is created/used with whatever the current
    global [superlink.local] settings are.
  3. To run App B with different settings, the user must manually edit ~/.flwr/config.toml,
    remember to revert it before switching back to App A, and repeat every time.
  4. There is no project-local override mechanism to avoid this.

Planned Implementation

One or more of the following improvements would resolve the friction:

  1. Per-project config override — Support a project-local config.toml (e.g. in the
    project root) that is merged over the global
    ~/.flwr/config.toml, similar to how many tools support local + global config layering.
  2. Named connection per project — Allow pyproject.toml to declare a preferred
    SuperLink connection name (not the full connection config) so that different projects can
    point to different named entries in the shared ~/.flwr/config.toml.
  3. CLI flag — Provide a --config / --connection-config flag on flwr run to point to
    an alternative config file for that invocation.
  4. Documentation — At a minimum, clearly document the recommended workflow for developers
    who work on multiple projects with different simulation resource requirements.

Additional Context

  • The commenting-out of pyproject.toml after migration is misleading: it looks like the
    settings were "saved", but any future edits to that section have no effect.
  • The one-time migration path in config_migration.py (_comment_out_legacy_toml_config)
    effectively removes the user's only familiar touchpoint for per-project config without
    providing a direct replacement.
  • Relevant code paths:
    • init_flwr_config() (flower_config.py:153)
      — only writes defaults when config.toml is absent; never syncs from pyproject.toml.
    • migrate() (config_migration.py:171)
      — one-shot migration, called on every flwr run but no-ops once the legacy section is
      gone.
    • DEFAULT_FLOWER_CONFIG_TOML (constant.py:103)
      — hardcoded defaults written on first initialisation.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions