Skip to content

feat(framework): Add runtime dependency installation option#6741

Open
psfoley wants to merge 12 commits intomainfrom
runtime-dependency-installation
Open

feat(framework): Add runtime dependency installation option#6741
psfoley wants to merge 12 commits intomainfrom
runtime-dependency-installation

Conversation

@psfoley
Copy link
Member

@psfoley psfoley commented Mar 11, 2026

No description provided.

psfoley added 3 commits March 10, 2026 16:54
…t, and ability to limit to a local pypi repo with --index-url argument. Creates an ephemeral virtual environment for each run, and cleans it up after execution

Signed-off-by: Patrick Foley <patrick@flower.ai>
Signed-off-by: Patrick Foley <patrick@flower.ai>
Signed-off-by: Patrick Foley <patrick@flower.ai>
Copilot AI review requested due to automatic review settings March 11, 2026 00:04
@psfoley psfoley requested a review from jafermarq as a code owner March 11, 2026 00:04
@psfoley psfoley marked this pull request as draft March 11, 2026 00:05
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds an opt-in mechanism for installing application dependencies at runtime (via uv sync) and threads the corresponding CLI/config options through SuperNode/SuperExec and the various flwr-* app processes.

Changes:

  • Introduces --allow-runtime-dependency-installation and propagates it through SuperLink/SuperNode/SuperExec process launching.
  • Adds a new dependency_installer utility to create/activate a per-run/per-launch runtime environment and install dependencies via uv.
  • Updates ClientApp/ServerApp/Simulation processes to optionally install dependencies and clean up the runtime environment on exit.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 7 comments.

Show a summary per file
File Description
framework/py/flwr/supernode/start_client_internal.py Forwards runtime dependency install flags to the flower-superexec subprocess.
framework/py/flwr/supernode/runtime/run_clientapp.py Optionally installs app dependencies before loading/running the ClientApp and cleans up on exit.
framework/py/flwr/supernode/cli/flwr_clientapp.py Passes new runtime dependency install parameters into run_clientapp/superexec wrapper.
framework/py/flwr/supernode/cli/flower_supernode.py Adds parsing/forwarding of runtime dependency installation CLI args for SuperNode.
framework/py/flwr/supercore/superexec/run_superexec.py Plumbs index_url/runtime_dependency_install into plugin construction and deprecation log output.
framework/py/flwr/supercore/superexec/plugin/exec_plugin.py Extends ExecPlugin to store index_url and runtime install toggle.
framework/py/flwr/supercore/superexec/plugin/base_exec_plugin.py Adds forwarding of runtime install flags when launching app subprocesses.
framework/py/flwr/supercore/superexec/dependency_installer.py New module implementing uv installation, dependency sync, env activation, and cleanup.
framework/py/flwr/supercore/cli/flower_superexec.py Adds runtime dependency installation CLI args to flower-superexec.
framework/py/flwr/simulation/app.py Optionally installs simulation app dependencies and cleans up runtime env on exit.
framework/py/flwr/server/serverapp/app.py Optionally installs server app dependencies and cleans up runtime env on exit.
framework/py/flwr/server/app.py Forwards runtime dependency install flags when spawning flower-superexec in subprocess isolation mode.
framework/py/flwr/common/constant.py Adds RUNTIME_DEPENDENCY_INSTALL default toggle constant.
framework/py/flwr/common/args.py Introduces shared CLI arg helper add_args_runtime_dependency_install and includes it in common app args.
framework/py/flwr/cli/log.py Changes log streaming loop behavior (notably error handling wrapper removal).

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.

@github-actions github-actions bot added the Maintainer Used to determine what PRs (mainly) come from Flower maintainers. label Mar 11, 2026
@psfoley psfoley marked this pull request as ready for review March 12, 2026 22:17
@psfoley psfoley changed the title feat(framework): runtime dependency installation option feat(framework): Add runtime dependency installation option Mar 12, 2026
Signed-off-by: Patrick Foley <patrick@flower.ai>
INFO,
"`uv` is not available in the current environment, installing it now.",
)
pip_install_uv_cmd: list[str] = [
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: uv is installed in the case that it is not available already in the user's virtual environment. This is done here because uv is not needed in unless --allow-runtime-dependency-installation is set to true. There may be other context that necessitates making this global dependency now, but my preference would be to keep it here because users will already be operating under the expectation that additional packages will be installed if they've enabled this flag

Signed-off-by: Patrick Foley <patrick@flower.ai>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Maintainer Used to determine what PRs (mainly) come from Flower maintainers.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants