github reflex-dev/reflex v0.7.0

one day ago

Breaking Changes

Python 3.9 support is no longer supported.

Computed Vars are now cache=True by default

Explicitly set cache=False on Computed Vars that should be updated after every
event, which was the previous default behavior.

The dependency tracking analysis for Computed Vars has been improved to support
async Computed Vars, so there is a possibility for unanticipated behavior change
around tracking dependencies. Please report any bugs encountered in this area.

Previously "CallableVar" shims need to be explicitly called

  • rx.upload_file -> rx.upload_file()
  • rx.selected_files -> rx.selected_files()
  • rx.clear_selected_files -> rx.clear_selected_files()
  • rx.set_color_mode -> rx.set_color_mode()

Deprecation Removals

Usage of these features prior to 0.7.0 printed a deprecation warning, now they will result in an error.

  • rx.chakra is removed, use import reflex_chakra as rc instead.

  • rx.background is removed, use rx.event(background=True) instead.

  • rx.Component._create_event_chain is removed, use rx.EventChain.create instead.

  • external prop for rx.redirect is removed.

  • Unannotated event handler arguments will now raise MissingAnnotationError.

  • Many internal exceptions were renamed to add a trailing Error suffix if that was missing.

  • rx._x.asset is removed, use rx.asset instead.

  • Passing a str argument to rx.utils.console.set_log_level will now raise TypeError.

  • Removals from rx.utils.exec:

    • is_frontend_only -> rx.config.environment.REFLEX_FRONTEND_ONLY.get()
    • is_backend_only -> rx.config.environment.REFLEX_BACKEND_ONLY.get()
    • should_skip_compile -> rx.config.environment.REFLEX_SKIP_COMPILE.get()
  • rx.utils.format.format_event_chain is removed, use str(rx.Var.create(chain)) instead.

  • _var_is_local and _var_is_string removed from rx.Var.create.

  • Computed Vars without a return type annotation will raise UntypedComputedVarError.

  • removing deprecated features for 0.7.0 and removing py3.9 support by @Lendemor in #4586

rx.App fields for internal use now have a _ prefix

  • rename private fields with leading underscore in App by @Lendemor in #4642

New Features

reflex rename

A new command to rename an app.

rx.var now supports async functions

An rx.var computed var can now wrap an async function, which can access
arbitrary state via get_state and var values via get_var_value.

Dependency tracking across states is supported, but there may be edge cases in
the new implementation that prevent depedencies from being automatically
identified. You can pass explicit dependencies to the deps argument, and can
add dependencies at runtime via cls.computed_vars[var_name].add_dependency.
For best results, pass a globally imported state class to get_state and assign
the return value to a local variable in the function.

"Built with Reflex" badge

To raise awareness of Reflex, a sticky "Built with Reflex" badge is added to the
lower right corner of each page.

For subscribers of Reflex Cloud, this badge can be disabled by setting
show_built_with_reflex=False in rxconfig.py or SHOW_BUILT_WITH_REFLEX=0 in
the environment.

For more information see: https://reflex.dev/docs/hosting/reflex-branding/

Improvements

Support For Dynamic Icon name

Previously the recommendation was to use rx.match to map icons, because the
icon name itself could not be a Var.

With rx.dynamic_icon, the name can now be a Var, but performance may be
affected by dynamic loading.

Support for Specifying Custom App Module

A new config knob is added to rxconfig.py, to load the app from a module other than the default.

config = rx.Config(
    app_name="my_app",
    app_module_import="some_package.my_actual_app_module",
)

The app module should be importable by name with the current PYTHONPATH / sys.path, and contain an app attribute.

Display Warning for Frontend/Backend Version Mismatch

When the frontend and backend versions do not match, a warning is displayed in the console.

Typing

Recharts

Avoid Leaked Websocket connections

Miscellaneous

Bug Fixes

Version Bumps

Linting / Code Quality

Other Changes

New Contributors

Full Changelog: v0.6.8...v0.7.0

Don't miss a new reflex release

NewReleases is sending notifications on new releases.