Skip to content

Make Granian the default backend and Uvicorn/Gunicorn explicit opt-in #6820

Description

@FarhanAliRaza

Context

Reflex was intended to default to Granian in 0.9, but the current automatic selection still chooses the Uvicorn/Gunicorn backend when both packages are importable and REFLEX_USE_GRANIAN is unset. This is especially visible in upgraded environments that retain the old backend dependencies.

PR #6758 only updates the resulting warning. The underlying selection behavior should be fixed instead.

Proposed behavior

  1. Default REFLEX_USE_GRANIAN to True.
  2. Use Granian when REFLEX_USE_GRANIAN is unset or true, regardless of whether Uvicorn/Gunicorn happen to be installed.
  3. Use the Uvicorn/Gunicorn backend only when REFLEX_USE_GRANIAN=0 and its required packages are installed.
  4. Remove the Uvicorn fallback warning because that backend becomes fully opt-in.

Expected selection matrix

REFLEX_USE_GRANIAN Result
Unset Granian
1 / true Granian
0 / false, Uvicorn/Gunicorn available Uvicorn/Gunicorn
0 / false, required packages missing Define and test an actionable failure or fallback behavior

Acceptance criteria

  • Update backend-selection logic and the environment-variable default/documentation.
  • Remove the obsolete Uvicorn fallback warning.
  • Add unit coverage for every row in the selection matrix.
  • Update user-facing documentation and add the appropriate news fragment.
  • Confirm whether this ships in the next 0.9.x release or requires 0.10.0 before implementation.

Supersedes #6758.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions