feat(framework): Enable FastAPI to manage SuperLinkLifespan#7453
Draft
danieljanes wants to merge 49 commits into
Draft
feat(framework): Enable FastAPI to manage SuperLinkLifespan#7453danieljanes wants to merge 49 commits into
danieljanes wants to merge 49 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds an initial FastAPI-based HTTP API scaffold for SuperLink/SuperNode within framework/py/flwr, along with dependency updates to support running these apps via uvicorn.
Changes:
- Add FastAPI app entrypoints for SuperLink and SuperNode, wiring in new router modules (health/control/runtime).
- Update
restoptional dependencies to include FastAPI (and bump Starlette/Uvicorn versions), and refreshuv.lock. - Add a short
FASTAPI.mdwith install/run instructions.
Critical issues
- Stub endpoints currently return HTTP 200 with a
"not_implemented"body; they should return an HTTP error status (e.g., 501) so clients/tooling don’t treat these as successful responses. (PR comments: IDs 003–005) FastAPI(..., version="1.32.0")is hard-coded in both apps and can drift fromflwr.__version__. (PR comments: IDs 001–002)
Simplicity/readability suggestions
restnow depends onfastapi[standard], which pulls in significant transitive tooling not used by the scaffold in this PR; consider depending on plainfastapi(or splitting into a separate extra) to keep the optional dependency footprint smaller. (PR comment: ID 006)
Consistency concerns
framework/FASTAPI.mdusesuv sync --all-extras; other framework docs recommenduv sync --locked ...for reproducible installs. (PR comment: ID 007)
Whether the PR should be split
No—these changes are all in service of introducing the FastAPI scaffold and its dependency/docs wiring.
Overall verdict
Changes are needed before approval.
Reviewed changes
Copilot reviewed 15 out of 16 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| framework/uv.lock | Locks new REST/FastAPI dependency set (FastAPI, updated Starlette/Uvicorn, transitive deps). |
| framework/pyproject.toml | Updates rest optional dependencies to include FastAPI and newer Starlette/Uvicorn pins. |
| framework/py/flwr/supercore/routers/__init__.py | Introduces core router package for shared endpoints. |
| framework/py/flwr/supercore/routers/health/__init__.py | Exposes the health router. |
| framework/py/flwr/supercore/routers/health/router.py | Adds /health endpoint router. |
| framework/py/flwr/superlink/main.py | Adds SuperLink FastAPI app and includes routers. |
| framework/py/flwr/superlink/routers/__init__.py | Introduces SuperLink router package. |
| framework/py/flwr/superlink/routers/control/__init__.py | Exposes the control router. |
| framework/py/flwr/superlink/routers/control/router.py | Adds stub control route(s). |
| framework/py/flwr/superlink/routers/runtime/__init__.py | Exposes the runtime router. |
| framework/py/flwr/superlink/routers/runtime/router.py | Adds stub runtime route(s). |
| framework/py/flwr/supernode/main.py | Adds SuperNode FastAPI app and includes routers. |
| framework/py/flwr/supernode/routers/__init__.py | Introduces SuperNode router package. |
| framework/py/flwr/supernode/routers/runtime/__init__.py | Exposes the runtime router. |
| framework/py/flwr/supernode/routers/runtime/router.py | Adds stub runtime route(s). |
| framework/FASTAPI.md | Adds install/run instructions for the new FastAPI apps. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Comment on lines
+71
to
+75
| rest = [ | ||
| "starlette>=1.3.1,<1.4.0", | ||
| "uvicorn[standard]>=0.49.0,<0.50.0", | ||
| "fastapi[standard]>=0.138.0,<0.139.0", | ||
| ] |
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Merge after #7499