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 updates the warning shown when Reflex selects Uvicorn.

  • Removes the stale 0.8.0 reference.
  • Documents REFLEX_USE_GRANIAN=1 as the current opt-in.
  • Adds a focused warning-text test and a bugfix news fragment.

Confidence Score: 5/5

This looks safe to merge.

  • The documented environment value parses as true and selects Granian.
  • The test uses an API supported by the project’s Python versions and compatible with the @once wrapper.
  • No blocking issues found in the changed code.

Important Files Changed

Filename Overview
reflex/utils/exec.py Replaces the obsolete version-specific Uvicorn warning with version-neutral Granian opt-in guidance.
tests/units/utils/test_exec.py Adds a focused test that unwraps the cached warning function and checks the revised message.
news/6720.bugfix.md Adds the configured bugfix fragment describing the warning correction.

Reviews (1): 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 (32cc257)

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.

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.

1 participant