v0.2.5
版本发布时间: 2023-08-22 06:10:50
reflex-dev/reflex最新发布版本:v0.3.3(2023-11-16 03:29:40)
💪 Thanks to our amazing users and contributors!! 🙌 🐍
Breaking Changes
Chained event handlers from return
/ yield
must always be referenced from the State class, NOT the instance
class State(rx.State):
def handlerA(self):
...
def handlerB(self):
return self.handlerA() # ❌ Will raise TypeError now!
def handlerC(self):
return State.handlerA() # ✅ Always reference chained handlers by class
The exception will look like TypeError: Your handler State.handlerB must only return/yield: None, Events or other EventHandlers referenced by their class (not using self)
and will occur when the handler is called, not at compile time.
Removal of Config
knobs
-
admin_dash
- configure the admin dashboard viarx.App
instead -
backend_transports
- all connections will use websocket -
cors_credentials
-
db_config
- usedb_url
instead -
env
- specify the run environment via CLI flags toreflex run --env dev|prod
-
env_path
- reading environment variables from a file is no longer supported (suggest use ofdocker-compose
or simplysource
the env file before runningreflex
) -
override_os_envs
- os environment variables will always take precedence -
polling_max_http_buffer_size
- all connections will use websocket
New Features
Support f-string formatting of State vars
Frontend rendering functions can now make use of f"built in {State.value}"
style formatting, instead of +
concatenation.
Node.js is automatically installed on Windows (non-WSL)
Using the cross-platform fnm
tool to facilitate automatic installation of node runtime on native windows platform, where previously a manual install was needed.
POSIX support for fnm
to replace nvm
is coming soon.
Display system and environment information with --loglevel debug
For easier bug reporting and investigations, all relevant platform info, config, and tools used by Reflex will be logged in debug mode.
rx.selected_files
Var exposes files selected by the rx.upload
component
This new Var can be rendered as a frontend component:
rx.foreach(
rx.selected_files,
rx.text,
)
Improvements
Frontend performance boost
Refactoring the main frontend event loop reduces event handling and rendering time by 3x.
Refactored Config
class
Simplify configuration knobs and recognize all configuration values set as environment variables.
rx.form
now works with more form components
Including rx.pin_input
, rx.number_input
, and rx.range_slider
More flexible container serialization inside State classes
-
set
is now supported as aVar
type - Recursive serialization now allows for
list
,tuple
, andset
of PIL image, plotly plots, and pandas dataframes.
Use “trailingSlash” mode to better support static site hosting
When exporting a site via reflex export
, an index.html
file will be created inside a directory for each static route, which makes hosting via s3, github pages, netlify, and others simpler by not requiring a “try_files” rule or rewrites.
docker-example
is simplified and extended
The main Dockerfile
is simpler and there is now a compose.yaml
and Caddy.Dockerfile
which can be used to deploy a reflex app with automatic TLS support.
Other Improvements
- Expose
debounce_timeout
prop onrx.input
andrx.text_area
for tuning fully-controlled input behavior on large sites. - Ignore
*.db
and files in default.gitignore
template -
NoSSRComponent
supports components using either named or default exports.
Bug Fixes
- Flex
wrap
anddirection
props accept list of values, for use at different responsive breakpoints. - Can specify
on_load
when defining a custom 404 page. - Raise useful exception when a user-defined State var shadows an internal name.
-
BUN_PATH
is respected again (regression from 0.2.3) - Var operations like
to_string
,and
, andor
return a new Var with the correcttype_
set. - Passing a
dict
as a prop where the values contain double quotes is no longer an error. (Fixrx.html
component where content contains double quotes)
Other Changes
- For show file on PyPI correctly, to use the full-path hyperlink to indicate the raw file by @milochen0418 in https://github.com/reflex-dev/reflex/pull/1559
- PR zh/zh_tw readme update by @milochen0418 in https://github.com/reflex-dev/reflex/pull/1557
- Add windows warning message. by @Alek99 in https://github.com/reflex-dev/reflex/pull/1570
- Change fixture scope to be run per session rather than per function by @mat-mil in https://github.com/reflex-dev/reflex/pull/1569
- App harness use new_process by @picklelo in https://github.com/reflex-dev/reflex/pull/1573
- Update urls to reflex.dev by @picklelo in https://github.com/reflex-dev/reflex/pull/1572
- Update CONTRIBUTING.md by @Alek99 in https://github.com/reflex-dev/reflex/pull/1580
- Add AppHarness for form submit by @Lendemor in https://github.com/reflex-dev/reflex/pull/1571
- FIXED #1598: pyproject.toml: Wrong repository URL by @jenisys in https://github.com/reflex-dev/reflex/pull/1602
- test_dynamic_routes: fix flakyness in test_dynamic_routes by @masenf in https://github.com/reflex-dev/reflex/pull/1603
- Fix rx.link href prop and Var.to_string type by @picklelo in https://github.com/reflex-dev/reflex/pull/1600
- integration tests: don't shadow real error when screenshot fails by @masenf in https://github.com/reflex-dev/reflex/pull/1608
- link: fix link with no href by @masenf in https://github.com/reflex-dev/reflex/pull/1612
- Update .gitignore to ignore coverage.* files by @martinxu9 in https://github.com/reflex-dev/reflex/pull/1623
- Remove unused
full_control
related code by @martinxu9 in https://github.com/reflex-dev/reflex/pull/1624 - test_form_submit: poll for backend_state to be updated by @masenf in https://github.com/reflex-dev/reflex/pull/1625
New Contributors
- @Smit-Parmar made their first contribution in https://github.com/reflex-dev/reflex/pull/1535
- @mat-mil made their first contribution in https://github.com/reflex-dev/reflex/pull/1568
- @jenisys made their first contribution in https://github.com/reflex-dev/reflex/pull/1602
- @martinxu9 made their first contribution in https://github.com/reflex-dev/reflex/pull/1614
- @danik292 made their first contribution in https://github.com/reflex-dev/reflex/pull/1645
Full Changelog: https://github.com/reflex-dev/reflex/compare/v0.2.4...v0.2.5