Skip to content

Enable VSCode Debugging with Breakpoints for flwr Apps #5321

@hetparekh16

Description

@hetparekh16

Type

Feature

Description

Currently, flwr apps are executed using the Flower CLI (flwr run), and due to the architecture, it is not possible to set breakpoints inside user-defined files (e.g., server_app.py or client_app.py) using the VSCode debugger. This makes it difficult to step through the code, inspect function calls, and understand the data flow without manually inserting pdb.set_trace() statements or relying on print/debug logs.

As a developer exploring and building on top of Flower, it would be extremely helpful to set breakpoints and debug using VSCode’s built-in tools. This would allow stepping through execution from initialization to training and aggregation phases, greatly enhancing understanding of the framework's inner workings.

Being able to inspect how strategy methods are called and how data is passed and transformed would improve development efficiency and help new contributors get up to speed quickly.

Planned Implementation

  • Introduce a --debug flag to the flwr run CLI command.
  • When this flag is provided, the Flower app should start in a way that enables Python debuggers (such as those in VSCode) to hit breakpoints set in user-defined files like server_app.py or client_app.py.
  • The debug mode should remove the need to manually insert pdb.set_trace() and support smooth integration with IDE debuggers.
  • Update the Flower documentation to include instructions for running flwr run --debug and attaching an IDE debugger like VSCode to step through the code.

Additional Context

No response

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions