Commit Graph

2156 Commits

Author SHA1 Message Date
Thomas Brandého
4da32a122b
allow dynamic icons name (#4636)
* allow dynamic icons name

* handle literal vars

* clean up code
2025-01-17 16:43:11 -08:00
Thomas Brandého
6e546526b4
computed var default to cache=True (#4194)
* computed var default to cache=True

* fix lifespan integration tests

* fix redis test
2025-01-16 21:49:54 +01:00
Khaleel Al-Adhami
c8de356d98
cast return_expr to Var all the time (#4649) 2025-01-16 20:22:56 +01:00
Thomas Brandého
e8dd0ae47d
don't need node when --backend_only is used (#4641) 2025-01-15 15:57:50 -08:00
Khaleel Al-Adhami
cb24492371
fix boolean to boolen comparisons (#4620)
* fix boolean to boolen comparisons

* fixes #4618

* fix tests
2025-01-15 14:23:45 -08:00
Khaleel Al-Adhami
b50b7692b2
improve type support for .get_state (#4623)
* improve type support for .get_state

* dang it darglint
2025-01-15 14:21:33 -08:00
Thomas Brandého
9fe8e6f1ce
bump nextJS to v15 (#4630)
* bump nextJS to v15

* make turbopack depends on env var
2025-01-15 14:20:04 -08:00
Masen Furer
fbf9524a6c
Show file and line number in deprecation warnings (#4631)
* Show file and line number in deprecation warnings

* Exclude modules/packages by import

Less bespoke method of considering some packages to be part of the framework
and passed over when finding user code.
2025-01-15 14:19:11 -08:00
Khaleel Al-Adhami
caf29c3680
put import at the top of dynamic component evaluation (#4632) 2025-01-15 14:17:58 -08:00
Masen Furer
e8a7112249
[ENG-4383] Handle special float values on frontend (#4638)
Add a test case to `test_computed_vars.py` which renders a list of special floats.

Fix #4637
2025-01-15 13:04:15 -08:00
Thomas Brandého
f69be58f59
small fix for color_mode_button (#4634) 2025-01-14 15:02:54 +01:00
Masen Furer
1e7a37bcf9
[ENG-4351] Add mapping for lucide icons (#4622)
* [ENG-4351] Add mapping for lucide icons

For icon names that don't auto-translate to the correct lucide tag name,
provide manual override.

Fix #4621

* account for new mapping in unit tests
2025-01-10 15:23:16 -08:00
Masen Furer
427d7c56ab
Revert "[ENG-4005] Proxy backend requests on '/' to the frontend (#3300)" (#4614)
This reverts commit 438b31f270.
2025-01-09 16:30:49 -08:00
Masen Furer
fe9c02062d
EventChain.create accepts arbitrary kwargs (#4609)
Pass _var_data when creating LiteralVar

Partial fixes for #4608
2025-01-09 16:14:38 -08:00
Khaleel Al-Adhami
79611abdab
make that one line better (#4610) 2025-01-08 17:16:38 -08:00
Masen Furer
4c97072a3c
pyproject.toml: bump to 0.7.0dev1 for further development (#4604) 2025-01-08 09:37:33 -08:00
Masen Furer
5d877d54d0
Use older python versions for macos actions (#4601)
Use python versions that have a darwin/arm64 build for use with the newer
(faster) macos actions runners
2025-01-07 15:46:26 -08:00
Khaleel Al-Adhami
0ad0a84ee1
fix recursive UI (#4599)
* fix recursive UI

* get it right pyright

* dang it darglint
2025-01-07 15:11:38 -08:00
Khaleel Al-Adhami
880975ae94
improve client state (#4597)
* improve client state

* no comma

* update python for unit tests

* overwrite it for windows

* bump other python versions
2025-01-07 14:41:03 -08:00
Masen Furer
93245ef143
[ENG-4255] Code blocks lead to redefined const in web page (#4598)
Instead of potentially defining `_LANGUAGE` constant twice in a component,
simply pass the language prop directly to the hook generator function.

If no language is passed, then it defaults to `_LANGUAGE`, which continues to
work for markdown component_map use case.
2025-01-07 13:20:25 -08:00
Masen Furer
5f169bc884
test_lifespan: stop periodic events (#4600)
avoid lingering events after getting the information we came for
2025-01-07 13:20:10 -08:00
Masen Furer
08d9fbf9bc
unbreak link _hover (#4537)
* unbreak link _hover

* add a test to catch the error

* change tmp path for harness

* add () to fixture

* add spacer to avoid initial hover

* only install chromium browser for faster ci

---------

Co-authored-by: Lendemor <thomas.brandeho@gmail.com>
2025-01-07 10:35:36 -08:00
Masen Furer
72d7616726
Enable automatic retry on redis errors (#4595)
* Enable automatic retry on redis errors

ExponentialBackoff 3x retry for BusyLoadingError, ConnectionError, and TimeoutError

* retry on any redis error

* Use default single-retry for any RedisError

Using the default Retry means that async and sync clients get the appropriate type of Retry
2025-01-07 10:24:43 -08:00
Masen Furer
eae15e3a83
poetry 2.0.0 compatibility (#4593)
Remove `packages` key, since this project uses the "default" package layout, so
this key isn't needed.
2025-01-06 14:35:45 -08:00
Thomas Brandého
9fafb6d526
use position in vardata to mark internal hooks (#4549)
* use position in vardata to mark internal hooks

* update all render to use position

* use macros for rendering

* reduce number of iterations over hooks during rendering

* cleanup code and add typing

* add __future__

* use new macros to render component maps in markdown

* remove calls to _get_all_hooks_internal

* fix typo

* forgot to replace this

* unnecessary expand in utils.py
2025-01-06 13:06:56 -08:00
Masen Furer
59b3aaca42
Add deprecation message for non-cached var (#4591)
DeprecationWarning: Default non-cached rx.var has been deprecated in version
0.6.8 the default value will be `@rx.var(cache=True)` in a future release. To
retain uncached var, explicitly pass `@rx.var(cache=False)`. It will be
completely removed in 0.7.0
2025-01-06 11:17:03 -08:00
Kanva Bhatia
ab4e05be34
fixes #4578 - correct the way dim_props created (#4587) 2025-01-05 14:53:39 -08:00
Masen Furer
dcdcbfd833
[ENG-2157] [Refix] Allow rx.download to resolve rx.get_upload_url (#4470)
* [ENG-2157] [Refix] Allow `rx.download` to resolve `rx.get_upload_url`

Update the special case in a way that works with the new Var system and its
unstoppable determination to concatenate strings instead of using template
string

This has been broken since 0.6.0, so a regression test was added to avoid
future inadvertant breakage.

Fix #2812 (again)

* use safer indirect eval
2025-01-03 16:56:29 -08:00
Masen Furer
438b31f270
[ENG-4005] Proxy backend requests on '/' to the frontend (#3300)
* Proxy backend requests on '/' to the frontend

If the optional extra `proxy` is installed, then the backend can handle all
requests by proxy unrecognized routes to the frontend nextjs server.

* Update lock file

* pre-commit fu

* AppHarness: set config frontend_port and backend_port

* integration: frontend port and backend port should return the same content

with proxying enabled by default in dev mode, both frontend and backend ports
on / should return the same content.

* Retry up to 100 times when proxying to frontend

* Reduce retry attempts to 25

Fix log level passing to subprocess

* scripts/wait_for_listening_port: primarily check HTTP responses

if the port is up or not, we don't really care... the HTTP request needs to
work and not return errors

* aiohttp is an optional dep

* adapt integration.sh for --backend-only (counter integration test)

* woops

* windows WTF?

* scratching my head 🎄

* double WTF windows

* Fix remaining integration tests
2025-01-03 15:50:38 -08:00
Masen Furer
316a0c9bde
Do not allow call_function callback argument to be added afterwards (#4552)
The default behavior for EventSpec is to treat the spec as a partial, wherein
if additional unfilled arguments are available, and the event trigger wants to
pass additional arguments, they will be applied positionally.

However, it never makes sense to fill in `callback` with an event trigger arg.
Therefore, if the callback is not provided initially, set it to None explicitly
so that some invalid value cannot be added later.
2025-01-03 15:50:01 -08:00
Masen Furer
8477a1aba0
BaseState.get_var_value helper to get a value from a Var (#4553)
* BaseState.get_var_value helper to get a value from a Var

When given a state Var or a LiteralVar, retrieve the actual value associated
with the Var.

For state Vars, the returned value is directly tied to the associated state and
can be modified.

Modifying LiteralVar values or ComputedVar values will have no useful effect.

* Use Var[VAR_TYPE] annotation to take advantage of generics

This requires rx.Field to pass typing where used.

* Add case where get_var_value gets something that's not a var
2025-01-03 15:49:46 -08:00
Masen Furer
41cb2d8cff
[ENG-4083] Track internal changes in dataclass instances (#4558)
* [ENG-4083] Track internal changes in dataclass instances

Create a dynamic subclass of MutableProxy with `__dataclass_fields__` set
according to the dataclass being wrapped.

* support dataclasses.asdict on MutableProxy instances
2025-01-03 15:49:28 -08:00
Simon Young
4b89b8260b
HOS-400: adding support for config (#4540)
* HOS-400: adding support for config

* ruff

---------

Co-authored-by: simon <simon@reflex.dev>
2025-01-03 15:15:13 -08:00
benedikt-bartscher
879dcbd1bf
improve dynamic route vars, no need to compute deps (#4551) 2025-01-03 13:00:48 -08:00
celsius narhwal
0d9b2c75e4
Upgrade lucide-react to version 0.469.0 (#4571) 2025-01-03 12:59:05 -08:00
JonZeolla
72a60f074b
chore: update sonner (toast) (#4572) 2025-01-03 12:55:51 -08:00
Thomas Brandého
53f09756b6
autodetect print/breakpoints (#4581)
* catch stray breakpoints and prints

* autodetect debug prints and breakpoints in main code

* readd hacky print in pyi_generator?
2025-01-03 12:51:02 -08:00
Ryan
97fb157b25
Add endswith method to String class (#4577)
Co-authored-by: ryan <>
2025-01-03 12:50:04 -08:00
Masen Furer
12eaf08c88
Add expire_on_commit=False for async sessions (#4582) 2025-01-02 14:15:59 -08:00
Masen Furer
41ed9f0514
Move _create_event_chain to EventChain.create (#4557)
The ability to convert `EventType` arguments into `EventChain` is crucial for
wrapping JS libraries that need to pass event handlers via hooks or
other non-component centric interfaces.

Improve typing such that wrapped components accepting `EventType` arguments can
be directly converted to `EventChain` / `EventChainVar` to be rendered as JS
code.
2025-01-02 14:15:38 -08:00
Thomas Brandého
848b87070c
fix health check and skip not needed tasks (#4563) 2024-12-20 17:08:10 -08:00
Thomas Brandého
a2ec1bc1d8
add codespell to pre-commit (#4559) 2024-12-20 17:04:39 -08:00
benedikt-bartscher
c310c020bb
Minor performance improvements for state getattribute and setattr (#4543) 2024-12-20 16:27:07 -08:00
Masen Furer
28568fd12f
Suppress exceptions from telemetry send (#4564) 2024-12-19 16:20:09 -08:00
Masen Furer
d8e988105f
pyproject.toml: bump to 0.6.8dev1 for further development (#4539) 2024-12-17 19:52:37 +01:00
Masen Furer
f71e6f9559
Revert "only mark backend vars as dirty if they have changed (#4494)" (#4547)
This reverts commit 3d89d74bdc.
2024-12-16 12:21:32 -08:00
Thomas Brandého
d7956c19d3
enable PERF rules (#4469)
* enable PERF rules

* fix scripts folder

* Update reflex/compiler/utils.py

Co-authored-by: Masen Furer <m_github@0x26.net>

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-12-13 14:49:37 -08:00
Thomas Brandého
61cb72596e
enable PTH rule (#4476)
* enable PTH rule

* fix import in test_call_script

* fix units tests

* reorder ruff rules

* Update reflex/utils/build.py

Co-authored-by: Masen Furer <m_github@0x26.net>

* format pyproject.toml

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-12-13 14:06:26 -08:00
Thomas Brandého
1444421766
add deps and position field in VarData (#4518)
* fix memoized event trigger order

* allow to declare deps in event signature for memoized event triggers

* clean up the code to pass tests

* handle position of hooks

* clean up code

* revert test changes

* add future annotations

* remove non-necessary stuff

* reuse data_callback name if already set during first call to add_hooks

* remove HookVar and use Var with VarData instead

* remove test change

* readd removed line

* fix order of stmt for cleaner code

* fix typing

* something broke during the merge I guess

* remove hack and pass proper const for position

* oops, bad syntax in jinja

* use "hook_position" instead of "hook_positions"

match the name of the enum

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-12-13 13:28:55 -08:00
Thomas Brandého
76ce112002
add datetime var comparison operations (#4406)
* add datetime var operations

* add future annotations

* add LiteralDatetimeVar

* remove methods that don't apply

* fix serialization

* add unit and integrations test

* oops, forgot to commit that important change
2024-12-13 12:41:29 -08:00