Skip to content

fix: reload async functions in debug mode - #443

Open
Shubham-Padkonde wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
Shubham-Padkonde:fix/async-debug-reload
Open

Shubham-Padkonde wants to merge 1 commit into
GoogleCloudPlatform:mainfrom
Shubham-Padkonde:fix/async-debug-reload

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown

Fixes #397.

When --debug serves an async function, start Uvicorn with an importable ASGI factory and reload enabled. Forward the resolved source, target, and signature through the environment so the reloader's child processes reconstruct the same function, including explicit non-default source files. Watch the source directory. Production serving and synchronous Flask debug behavior are unchanged.

Validation on Windows / Python 3.13:

  • New CLI tests: the two debug cases fail before the change; both production controls pass. All four pass afterward, covering automatic detection, explicit --asgi, custom source paths, and decorator-selected signatures.
  • Full suite: 279 passed, 7 skipped. Aggregate coverage 96%, with Windows-incompatible Gunicorn/timeout paths unexecuted.
  • Real local server checks in both modes: request returns the original body, edit the custom source file, then request returns the new body after reload. Temporary server processes stopped afterward. The Windows harness needed a hidden console with normal console handles for Uvicorn's CTRL_C-based child restart; a detached/redirection harness detected edits but could stall on restart.
  • Repository-wide Black/isort, mypy typing test, and git diff --check pass.

Prepared with Codex assistance. No deployed Cloud Run or Docker conformance testing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Live reload for aio.http with --debug

1 participant