Migrate to Reflex plugins and remove deprecated rx.Model usage#322
Conversation
… add RadixThemesPlugin
…_open setter, move theme to RadixThemesPlugin The remaining rx.Model DeprecationWarning originates from reflex_local_auth.LocalUser, which is external to this repo.
…s, add RadixThemesPlugin
…theme to RadixThemesPlugin
…move theme to RadixThemesPlugin
…heme to RadixThemesPlugin
…x Themes deprecation
Munge requirements.txt in-place so that the existing 'reflex' (or 'reflex[db]') pin is rewritten to use REFLEX_DEP as a direct reference. This preserves extras such as [db] that the app needs to function, instead of installing a stock reflex alongside the requirements file.
This app uses rx.session, which depends on the optional [db] extra and the (previously default) sqlite db_url.
This app uses rx.session, which depends on the optional [db] extra and the (previously default) sqlite db_url.
This app uses rx.session, which depends on the optional [db] extra. db_url is already configured via DATABASE_URL env (or sqlite default).
This app uses rx.session, which depends on the optional [db] extra. db_url is already configured.
This app uses rx.session, which depends on the optional [db] extra and the (previously default) sqlite db_url.
The previous approach only pinned the top-level reflex package to the git URL, so pip still resolved the monorepo's subpackages (reflex-base, reflex-components-*, etc.) from PyPI. Check out the reflex repo to a sibling directory and rewrite the requirements pin to a file:// URL of that checkout so pip can pull the subpackages from the same source. The workflow_dispatch input is renamed to reflex_ref since we now drive the install from a git ref rather than a pip spec.
reflex uses dynamic versioning derived from git tags, so a shallow checkout without tags would fail to compute the package version.
uv understands workspace source declarations in reflex's pyproject.toml, which pip ignores. This should resolve reflex's subpackages from the local checkout instead of pulling them from PyPI.
…al_auth reflex_local_auth.LocalUser still subclasses the deprecated rx.Model, which emits a console.deprecate() warning at import time. Until the upstream package migrates to SQLModel, monkey-patch console.deprecate to silence that specific feature name.
…flex_local_auth" This reverts commit e48df0a.
0.5.0 drops rx.Model in favor of SQLModel, removing the lingering DeprecationWarning that previously came from the upstream LocalUser.
Switches to the shared Microsoft consumers tenant (9188040d-6c67-4c5b-b112-36a304b66dad) and a public example client id so the app's OIDC discovery succeeds without a private tenant.
The auto-generated set_* setter no longer exists in current Reflex; provide an explicit @rx.event handler.
rx.Model.select was removed alongside rx.Model itself; switch to the standard sqlmodel.select(Model).where(...) form.
RadixThemesPlugin was introduced in 0.9.2; apps whose rxconfig.py references it need the matching minimum version.
AppHarness no longer exposes get_state(); the frontend already asserts the same count values via poll_for_content, so the backend-state checks were redundant.
Polling for the session-storage token confirms the frontend has connected to the backend before the test exercises the UI.
rx.Model.select was removed alongside rx.Model itself; switch the Form and Response queries to the standard sqlmodel.select(Model).where(...) form to match the tests.
uv pip install understands workspace declarations in a git-fetched reflex source dist, so we no longer need a sibling checkout of reflex-dev/reflex to pull in the monorepo subpackages.
Replaces the hand-rolled SQLModel.metadata.create_all(get_engine()) with the public helper. Also sets alembic's path_separator=os to silence the unrelated alembic DeprecationWarning that the helper surfaces.
This reverts commit e24fa3f.
Greptile SummaryThis PR modernizes 20+ Reflex example apps for compatibility with Reflex 0.9 by migrating
Confidence Score: 3/5Safe to merge for the broad theme/model/event-handler changes, but the form-designer startup path has an unverified call that could silently fail to create tables on the hosting service. Nearly all changes are straightforward mechanical substitutions with low risk. The one outlier is rx.model.migrate() at the end of form-designer/form_designer/form_designer.py: the PR description says this should be sqlmodel.SQLModel.metadata.create_all(), but the code calls a module-level attribute that may or may not exist in reflex 0.9. If it does not exist, the form-designer app will fail to auto-create its tables on any hosting environment that does not run alembic migrations. form-designer/form_designer/form_designer.py — specifically the rx.model.migrate() call at the bottom that may not be a valid API in reflex 0.9 Important Files Changed
Reviews (1): Last reviewed commit: "Revert "check_export: drop local reflex ..." | Re-trigger Greptile |
Summary
This PR modernizes the Reflex example applications by migrating theme configuration to the new plugin system and replacing deprecated
rx.Modelwithsqlmodel.SQLModel. It also adds explicit event handlers for state mutations and removes unused dependencies.Key Changes
Theme Configuration Migration
rxconfig.pyusingrx.plugins.RadixThemesPlugin()theme=parameters fromrx.App()constructors across all example appsrxconfig.pyfiles to use the new plugin-based theme system with appropriate accent colors per appModel System Updates
rx.Modelbase classes withsqlmodel.SQLModelin database modelsid: int | None = Field(default=None, primary_key=True)fields to all model classessqlmodeldirectly instead of throughreflexform_designermigration code to usesqlmodel.SQLModel.metadata.create_all()instead of deprecatedrx.Model.migrate()Event Handler Additions
@rx.eventdecorated setter methods for state mutations in:clock:set_zone()translator:set_text(),set_lang()twitter/auth:set_username(),set_password(),set_confirm_password()twitter/home:set_tweet(),set_friend()basic_crud:set_url_query(),set_body()form_designer:set_options_editor_open()github_stats:set_username()local_component:set_who()traversal:set_option()Component Updates
reflex_chakracircular progress components with native Reflex components inlorem_streamandquiztranslatorto userx.PropsBaseinstead ofrx.Basereflex_chakraimports and dependencies fromrequirements.txtCode Cleanup
from reflex.components.radix.themes import theme)tailwind=Noneconfiguration in favor of plugin-based setupdata_visualisationto use generictypeinstead ofrx.Modelhttps://claude.ai/code/session_01Y1Tf2L28wnta7Tu9ZeKKgB