feat(proxy): add --reload flag for uvicorn hot reload (dev only) - #25901
Conversation
Opt-in CLI flag, off by default, no env var. Only affects the uvicorn run path; gunicorn/hypercorn paths and prod (which doesn't pass the flag) are unaffected.
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Greptile SummaryThis PR adds an opt-in Confidence Score: 5/5Safe to merge — the change is off by default and correctly scoped to the uvicorn path only, with no risk to production deployments. All remaining findings are P2 (the num_workers guard suggestion, already raised in a prior review). The core implementation is minimal, correct, and non-breaking. No files require special attention.
|
| Filename | Overview |
|---|---|
| litellm/proxy/proxy_cli.py | Adds --reload click option and corresponding reload: bool parameter; conditionally sets uvicorn_args["reload"] = True within the uvicorn-only code path. Change is minimal and correctly scoped. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["litellm --reload"] --> B{"run_gunicorn or run_hypercorn?"}
B -- Yes --> C["gunicorn / hypercorn path — reload ignored"]
B -- No --> D{"reload flag set?"}
D -- Yes --> E["uvicorn_args reload = True"]
D -- No --> F["uvicorn_args unchanged"]
E --> G{"num_workers > 1?"}
G -- Yes --> I["uvicorn raises ValueError"]
G -- No --> J["StatReload watcher starts — hot reload active"]
F --> H["uvicorn.run — normal startup"]
Reviews (3): Last reviewed commit: "Merge remote-tracking branch 'origin/lit..." | Re-trigger Greptile
…itellm_feat-add-reload-flag-proxy
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
ea12bae
into
litellm_internal_staging
…-flag-proxy feat(proxy): add --reload flag for uvicorn hot reload (dev only)
Summary
--reloadCLI flag tolitellmproxy that enables uvicorn's file-watching hot reload for local development.--run_gunicornand--run_hypercornpaths are untouched. Production deployments that don't pass the flag are unaffected.Implementation
Three changes in
litellm/proxy/proxy_cli.py(10 lines added, 0 removed):@click.option("--reload", is_flag=True, default=False, ...)decorator onrun_server.reload: boolparameter inrun_serversignature.if reload: uvicorn_args["reload"] = Truebefore theuvicorn.run(...)call.Test plan
litellm --helpshows the new--reloadflag with help text.--reload: uvicorn loggedStarted reloader process [55701] using StatReload.litellm/proxy/proxy_server.py: reloader loggedStatReload detected changes ... Reloading..., old worker shut down, new worker came up with a different PID and reachedApplication startup complete.uvicorn_argsonly getsreload=Truewhen the user explicitly opts in.