Skip to content

Releases: reflex-dev/reflex

v0.6.0

24 Sep 22:13
2b17a32
Compare
Choose a tag to compare

Overview of Changes from 0.5.0 to 0.6.0

Breaking Changes

Drop support for python 3.8

  • bump python>=3.10 for 0.6.0 (#3956)
  • Bring back py3.9 support with a deprecation warning. (#3976)

Remove Deprecated Features

  • rx.input.root (0.5.0)
  • rx.Component._apply_theme (0.5.0)
  • _type, _min, _max prop rewriting (0.4.0)
  • Passing props to rx.foreach (0.5.0)
  • rx.el aliases for defs, lineargradient, stop, path (use rx.el.svg namespace)
  • Lucide icons that were removed upstream (0.4.6)
  • passing children to rx.color_mode.button (0.5.0)
  • rx.cached_var (0.5.6)
  • Specifying REDIS_URL without a url scheme (0.3.6)

PRs

New Var System

A Var is a placeholder for a value which is sent to the frontend or rendered as Javascript code in the app. Most users of Reflex do not interact with the var system directly, but it becomes relevant for advanced users that are wrapping components or handling custom types.

  • rx.Var.create(...) now returns a LiteralVar subclass wrapping the provided value.
    • _var_is_string is deprecated, passing a string will always create a StringVar
  • rx.Var(...) returns an ImmutableVar representing a raw javascript expression.
    • Replaces the deprecated _var_is_local param
  • Vars are not automatically cast as bool, when passing a non-bool var to a prop that expects a boolean, add .bool() after the var -- error message will include this hint.

The new Var system brings a much more accurate translation of literal python values into javascript, especially of object and array types.

rx.chakra removed from main repo

First, pip install reflex-chakra. Then import reflex_chakra as rc. rx.chakra will still work until 0.7.0, but it is recommended to move now to avoid deprecation warning.

Var Shadowing Detection

When a dynamic route arg name conflicts with the name of an existing state Var, the framework will raise DynamicRouteArgShadowsStateVar. This is intended to avoid unexpected behavior wherein the dynamic var takes precedence over the state var, even in a substate. A fix for the underlying cause is forthcoming.

In the meantime, define any pages that use dynamic route arguments early, so the dynamic var is available for use in the page functions.


When a computed var name conflicts with the name of an existing state Var, the framework will raise ComputedVarShadowsStateVar.

rx.progress is now Radix Themes Progress

The previous Radis Primitives progress is available as rx.radix.primitives.progress

Watchfiles dependency removed

If you are upgrading reflex in an existing environment run pip uninstall watchfiles first to ensure the hot reload mechanism is properly ignoring the .web directory.

New Features

DiskStateManager - preserve state across hot reloads in dev mode

/_health endpoint

http://localhost:8000/_health
{"status":true,"db":true,"redis":false}

Improvements

Var System

  • fully migrate vars into new system by @adhami3310 in #3743
  • guess_type: if the type is optional, treat it like it's "not None" by @masenf in #3839
  • Fix double-quoting of defaultColorMode by @masenf in #3840
  • ImmutableVar perf optimizations by @masenf in #3814
  • Get attribute access type fix by @benedikt-bartscher in #3803
  • fix var in bare by @adhami3310 in #3873
  • add var_operation and move some operations to the new style by @adhami3310 in #3841
  • Adding array to array pluck operation. by @abulvenz in #3868
  • simplify ImmutableComputedVar.get by @benedikt-bartscher in #3902
  • Use old serializer system in LiteralVar by @adhami3310 in #3875
  • Fix type propagation in ToStringOperation by @abulvenz in #3895
  • [ENG-3833] handle object in is bool (#3974)
  • suggest bool() for wrong values (#3975)
  • use is true for bool var (#3973)
  • Add shim for format_event_chain (#3958)
  • use serializer before serializing base yourself (#3960)
  • [ENG-3817] deprecate _var_name_unwrapped (instead of removing it) (#3951)
  • move the filterwarning to appropriate file (#3952)
  • fix unionize recursion (#3948)
  • add special handling for infinity and nan (#3943)
  • use is true (#3946)
  • use serializer for state update and rework serializers (#3934)
  • replace old var system with immutable one (#3916)
  • Remove Pydantic from some classes (#3907)

Documentation / Error Messages

  • Add comments to DataList components by @elviskahoro in #3827
  • [REF-3589] raise EventHandlerArgMismatch when event handler args don't match spec by @masenf in #3853
  • better errors in state.py (#3929)

Other Changes

Bug Fixes

New Contributors

Full Changelog: v0.5.10...v0.6.0

v0.5.10

28 Aug 16:41
ecf222d
Compare
Choose a tag to compare

Improvements

  • add message when installing requirements.txt is needed for chosen template during init by @Lendemor in #3750
  • use different registry when in china, fixes #3700 by @adhami3310 in #3702
  • [REF-3536][REF-3537][REF-3541]Move chakra components into its repo(reflex-chakra) by @ElijahAhianyo in #3798
    • Preparing for the eventual removal of chakra from the core reflex package
  • Recognize SSL_NO_VERIFY=1 to disable certificate verification when downloading tools like bun and fnm #3846

Bug Fixes

Other Changes

New Contributors

Full Changelog: v0.5.9...v0.5.10

v0.5.9

06 Aug 23:25
72465a7
Compare
Choose a tag to compare

Bug Fixes

Doc Updates

Var Refactor

This release includes some new experimental features being developed incrementally in reflex._x.vars.

Full Changelog: v0.5.8...v0.5.9

v0.5.8

29 Jul 19:59
e80315d
Compare
Choose a tag to compare

New Features

  • update init prompt to use new templates from reflex-dev/templates by @Lendemor in #3677

Improvements

Bug Fixes

  • debounce: pass through key and special_props by @masenf in #3655
  • [REF-3135]Radix Primitive components should not ignore provided class_name prop by @ElijahAhianyo in #3676
  • [REF-3101] rx.list Dont set/hardcode list_style_position css prop by @ElijahAhianyo in #3695
  • [REF-3184] [REF-3339] Background task locking improvements by @masenf in #3696
  • [REF-3375] useMemo on generateUUID props to maintain consistent value by @masenf in #3708
  • Define BaseVar fields on ComputedVar by @paoloemilioserra in #3659

Var Refactor

This release includes some new experimental features being developed incrementally in reflex._x.vars.

Other Changes

New Contributors

Full Changelog: v0.5.7...reflex-0.5.8

v0.5.7

16 Jul 20:47
9a7e5a0
Compare
Choose a tag to compare

New Features

  • Catch unhandled errors on both frontend and backend by @maximvlah in #3572
    • rx.App now supports frontend_exception_handler and backend_exception_handler which are called when unhandled exceptions occur.
    • Fix the error boundary by @maximvlah in #3637
  • Bare SQLAlchemy mutation tracking by @benedikt-bartscher in #3628
  • feat: Adding an event to go back just as the user would. by @abulvenz in #3636
    • return rx.event.back()

Improvements

Bug Fixes

Documentation

Var Refactor

This release includes some new experimental features being developed incrementally in reflex._x.vars.

Other Changes

  • pyproject.toml: bump to 0.5.6 by @masenf in #3635
  • benchmarks.yml: use node 18.x with reflex-web@main by @masenf in #3657

New Contributors

Full Changelog: v0.5.6...v0.5.7

v0.5.6

09 Jul 00:32
a115b3f
Compare
Choose a tag to compare

New Features

rx.clipboard

Handle global and component-scoped on_paste with multi-type data

  • Add Clipboard component for handling global on_paste event by @masenf in #3513

rx.breakpoints - Set breakpoints by name

Computed Backend Vars

Improvements

  • [REF-3056]Config knob for redis StateManager expiration times by @ElijahAhianyo in #3523
  • [Perf] Ensure rx.match gets memoized to avoid excessive re-rendering by @masenf in #3552
  • bare sqlalchemy session + tests by @benedikt-bartscher in #3522
  • Remove chakra from codeblock by @abulvenz in #3570
  • add compilation timestamp in log by @Lendemor in #3563
  • [REF-3148] add props for tabs by @Lendemor in #3560
  • show the value causing problem in deprecation warning by @Lendemor in #3558
  • Better support for Github Codespaces
    • Add a link to backend in connection error by @masenf in #3044
  • Better hot reload times on Windows with python 3.12 and uvicorn > 0.20
    • [REF-3164] Hack to fix Windows hot reload + Uvicorn upgrade by @masenf in #3584
  • rx.theme appearance is reset in dev mode

Bug Fixes

Other Changes

New Contributors

Welcome Khaleel to the Core Team

Full Changelog: v0.5.5...v0.5.6

v0.5.5

25 Jun 01:37
7d91e44
Compare
Choose a tag to compare

New Features

Improvements

Bug Fixes

Other Changes

New Contributors

Full Changelog: v0.5.4...v0.5.5

v0.5.4

13 Jun 17:45
19ef2e6
Compare
Choose a tag to compare

Improvements

Bug Fixes

  • [REF-2602]Do not suppress import errors in rxconfig by @ElijahAhianyo in #3434
  • [REF-3006] Inline code rendered in rx.markdown has extra trailing space by @masenf in #3426
  • Address an issue with pydantic v2 models as Vars by @kroo in #3396
  • state.js: set event_processing = false when websocket connects by @masenf in #3443
  • [REF-2879] Make client_state work without global refs (local only) by @masenf in #3379

Other Changes

New Contributors

Full Changelog: v0.5.3...v0.5.4

v0.5.3

05 Jun 20:27
1f3fee5
Compare
Choose a tag to compare

New Features

Improvements

Each component import is now independently lazy

Save time by avoiding imports for components which are not used in the app.

Bug Fixes

Other Changes

New Contributors

Full Changelog: v0.5.2...v0.5.3

v0.5.2

30 May 23:59
f9c008a
Compare
Choose a tag to compare

New Features

Lifespan Tasks

A lifespan task is either a coroutine which runs while the backend server is running and is cancelled when the server stops, or it can be an asynccontextmanager in which case it will run at server startup until yield is called, then it will resume as the server is shutting down. In either case, the task is started and stopped during hot reload.

Any keyword arguments passed to app.register_lifespan_task will be passed to the coroutine/contextmanager. If the coroutine takes a parameter called app, this will be an instance of the underlying FastAPI object.

Sample Code
import asyncio
from contextlib import asynccontextmanager


def fake_answer_to_everything_ml_model(x: float):
    return x * 42


ml_models = {}


@asynccontextmanager
async def setup_model(app: FastAPI):
    # Load the ML model
    ml_models["answer_to_everything"] = fake_answer_to_everything_ml_model
    yield
    # Clean up the ML models and release the resources
    ml_models.clear()


async def long_running_task(foo, bar):
    print(f"Starting {foo} {bar} task")
    some_api = SomeApi(foo)
    try:
        while True:
            updates = some_api.poll_for_updates()
            other_api.push_changes(updates, bar)
            await asyncio.sleep(5)  # add some polling delay to avoid running too often
    except asyncio.CancelledError:
        some_api.close()  # clean up the API if needed
        print("Task was stopped")


app = rx.App()
app.register_lifespan_task(setup_model)
app.register_lifespan_task(long_running_task, foo=42, bar=os.environ["BAR_PARAM"])

Improvements

Bug Fixes

Readme Updates

Other Changes

New Contributors

Full Changelog: https://github.com/reflex-dev/reflex/compare/v0.5.1..v0.5.2