Skip to content

fix(exec): correct stale 0.8.0 reference in Uvicorn/Granian warning#6758

Open
anxkhn wants to merge 1 commit into
reflex-dev:mainfrom
anxkhn:patch-18
Open

fix(exec): correct stale 0.8.0 reference in Uvicorn/Granian warning#6758
anxkhn wants to merge 1 commit into
reflex-dev:mainfrom
anxkhn:patch-18

Conversation

@anxkhn

@anxkhn anxkhn commented Jul 14, 2026

Copy link
Copy Markdown
Contributor
## What / why

When the backend starts with Uvicorn (uvicorn and gunicorn installed,
`REFLEX_USE_GRANIAN` unset), Reflex warns:

> Using Uvicorn for backend as it is installed. This behavior will change in 0.8.0 to use Granian by default.

That message is stale in two ways:

- `0.8.0` shipped long ago (current release is 0.9.x), so it points users at a
  version that is already in the past.
- The switch never actually happened at 0.8.0. The very function that emits the
  warning, `should_use_granian()`, still returns `False` (Uvicorn) in this case,
  so the message contradicts the code that prints it.

The `0.8.0` string is a leftover from the Granian-as-default work that was moved
back to the sidelines and re-gated behind `REFLEX_USE_GRANIAN`; the target
version was never updated when the change was deferred.

## Change

Reword the single warning string to be version-agnostic and actionable, without
committing to a maintainer-owned target version:

> Using Uvicorn for backend as it is installed. Reflex will switch to Granian by default in a future release; set REFLEX_USE_GRANIAN=1 to opt in now.

`REFLEX_USE_GRANIAN=1` is a correct opt-in: `should_use_granian()` honors the env
var when it is set. No behavior change; only the string literal is different.

If you would rather name a concrete target version (e.g. the next major) instead
of "a future release", I am happy to adjust the wording.

## Tests

Added `test_warn_user_about_uvicorn_does_not_reference_past_version` in
`tests/units/utils/test_exec.py`. It unwraps the `@once` cache so the warning
fires, then asserts the message no longer contains `0.8.0` and still mentions
`Granian`. It fails against the old string and passes with the fix.

- `uv run pytest tests/units/utils/test_exec.py -q` -> 3 passed
- `uv run ruff check .` / `uv run ruff format .` -> clean
- `uv run pyright reflex tests` -> 0 errors

Added a `news/` bugfix fragment for the CHANGELOG check.

news fragment

news/6720.bugfix.md (placeholder PR number 6720). MUST be renamed to the real
PR number after the PR is opened, otherwise the CHANGELOG CI gate stays keyed to
the wrong number. Content:

Corrected the Uvicorn backend warning that claimed the switch to Granian as the default would happen in 0.8.0, a version that has already shipped; it now describes the change as coming in a future release and points to REFLEX_USE_GRANIAN=1 to opt in early.

The backend warning told users the default would switch to Granian in
0.8.0, but that release shipped long ago (current 0.9.6) and the switch
never happened: should_use_granian() still returns False for Uvicorn when
uvicorn and gunicorn are installed and REFLEX_USE_GRANIAN is unset.

Reword the warning to describe the change as coming in a future release
and point users to REFLEX_USE_GRANIAN=1 to opt in early. No behavior
change.

Signed-off-by: Anas Khan <83116240+anxkhn@users.noreply.github.com>
@anxkhn anxkhn requested a review from a team as a code owner July 14, 2026 06:49
@greptile-apps

greptile-apps Bot commented Jul 14, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

This PR corrects the stale Uvicorn backend warning. The main changes are:

  • Replaces the outdated 0.8.0 reference with version-neutral guidance.
  • Documents REFLEX_USE_GRANIAN=1 as the current opt-in.
  • Adds a focused test for the warning text.
  • Adds a bugfix news fragment.

Confidence Score: 5/5

This looks safe to merge.

  • The warning now matches the supported Granian opt-in behavior.
  • The updated code does not change backend selection.
  • No blocking issues were found in the changed code.

Important Files Changed

Filename Overview
reflex/utils/exec.py Updates the warning text without changing backend selection behavior.
tests/units/utils/test_exec.py Adds a test that verifies the stale version is absent and Granian remains mentioned.
news/6720.bugfix.md Documents the corrected Uvicorn and Granian warning.

Reviews (2): Last reviewed commit: "fix(exec): correct stale 0.8.0 reference..." | Re-trigger Greptile

@codspeed-hq

codspeed-hq Bot commented Jul 14, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 26 untouched benchmarks
⏩ 8 skipped benchmarks1


Comparing anxkhn:patch-18 (3edee85) with main (65a2889)2

Open in CodSpeed

Footnotes

  1. 8 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports.

  2. No successful run was found on main (127e4d8) during the generation of this report, so 65a2889 was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@Alek99 Alek99 closed this Jul 15, 2026
@Alek99 Alek99 reopened this Jul 15, 2026
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.

2 participants