Commit Graph

1778 Commits

Author SHA1 Message Date
Masen Furer
289c21eedc
bump to 0.6.2.post1 2024-10-09 11:55:38 -07:00
Masen Furer
8119ec1795
Pin attr-accept to 2.2.2 to avoid breakage 2024-10-09 11:54:11 -07:00
Masen Furer
e637f488bd
bump to final release version 0.6.2 2024-10-08 09:18:29 -07:00
Thomas Brandého
475f666998
fix custom component init (#4123) 2024-10-08 09:18:20 -07:00
Masen Furer
d750b10c05
pyproject.toml: bump to 0.6.2a2 2024-10-07 13:19:35 -07:00
Khaleel Al-Adhami
3810161873
fail safely when pickling (#4085)
* fail safely when pickling

* why did i do that
2024-10-07 13:19:17 -07:00
Masen Furer
08a493882d
Get default for backend var defined in mixin (#4060)
* Get default for backend var defined in mixin

If the backend var is defined in a mixin class, it won't appear in
`cls.__dict__`, but the value is still retrievable via `getattr` on `cls`.
Prefer to use the actual defined default before using
`Var.get_default_value()`.

If `Var.get_default_value()` fails, set the default to `None` such that the
backend var still gets recognized as a backend var when it is used on `self`.

----

Update test_component_state to include backend vars

Extra coverage for backend vars with and without defaults, defined in a
ComponentState/mixin class.

* fix integration test
2024-10-07 13:17:28 -07:00
Thomas Brandého
c05d0bca55
catch CancelledError in lifespan hack for windows (#4083) 2024-10-07 13:17:27 -07:00
Khaleel Al-Adhami
8528f67a4a
convert literal type to its variants (#4062) 2024-10-07 13:17:27 -07:00
Masen Furer
9dafe5f813
bump to 0.6.2a1 2024-10-03 19:24:42 -07:00
Masen Furer
d77b900bd7
[ENG-3867] Garden Variety Pickle (#4054)
* Use regular `pickle` module from stdlib

* Avoid recreating the rx.State tree for every `get_state`

* Remove dill dependency

* relock deps
2024-10-03 19:19:06 -07:00
Khaleel Al-Adhami
fafdeb892e
Include emotion inside of dynamic components (#4052)
* bundle chakra in window for CSR

* remove repeated chakra ui reference

* use dynamically generated libraries

* remove js from it

* include emotion react for dynamic components

* make code more readable

Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>

* jsx yea

* what

---------

Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>
2024-10-03 15:58:42 -07:00
Khaleel Al-Adhami
0f8630fb2d
remove var operation error (#4053)
* remove var operation error

* dang it darglint
2024-10-03 15:58:04 -07:00
Khaleel Al-Adhami
73e8a4e0ab
support eventspec/eventchain in var operations (#4038) 2024-10-03 15:33:51 -07:00
Khaleel Al-Adhami
ad0827c59c
bundle chakra in window for CSR (#4042)
* bundle chakra in window for CSR

* remove repeated chakra ui reference

* use dynamically generated libraries

* remove js from it
2024-10-03 14:25:21 -07:00
Masen Furer
a66e0f2e11
[ENG-3870] rx.call_script with f-string var produces incorrect code (#4039)
* Add additional test cases for rx.call_script

Include internal vars inside an f-string to be properly rendered on the backend
and frontend.

* [ENG-3870] rx.call_script with f-string var produces incorrect code

Avoid casting javascript code with embedded Var as LiteralStringVar

There are two cases that need to be handled:

1. The javascript code contains Vars with VarData, these can only be evaluated
   in the component context, since they may use hooks. Vars with VarData cannot be
   used from the backend. In this case, we cast the given code as a raw js
   expression and include the extracted VarData.

2. The javascript code has no VarData. In this case, we pass the code as the
   raw js expression and cast to a python str to get a js literal string to eval.

* use VarData.__bool__ instead of `is None`
2024-10-03 14:18:53 -07:00
Thomas Brandého
40f1880932
move router dataclasses in their own file (#4044) 2024-10-03 14:18:28 -07:00
Khaleel Al-Adhami
56709a210b
add of_type to _evaluate (#4051)
* add of_type to _evaluate

* get it right pyright
2024-10-03 13:01:19 -07:00
Khaleel Al-Adhami
27bb7179d6
default should be warning for subprocesses not info (#4049) 2024-10-03 12:24:56 -07:00
Elijah Ahianyo
4b3d056212
[ENG-3476] Setting State Vars that are not defined should raise an error (#4007) 2024-10-03 10:35:34 -07:00
Elijah Ahianyo
12d73e4167
Track the last reflex run time (#4045) 2024-10-03 09:48:50 -07:00
Thomas Brandého
3f51943162
use pathlib as much as possible (#3967)
* use pathlib as much as possible

* fixstuff

* break locally to unbreak in CI 🤷

* add type on env

* debug attempt 1

* debugged

* oops, there is the actual fix

* fix 3.9 compat
2024-10-03 17:50:39 +02:00
Thomas Brandého
f3be9a3305
fix granian message (#4037) 2024-10-03 15:04:44 +02:00
Khaleel Al-Adhami
6a9f83cc2d
set loglevel to info with hosting cli (#4043)
* set loglevel to info with hosting cli

* reduce reused logic
2024-10-02 18:04:04 -07:00
Masen Furer
c08720ed1a
Use an equality check instead of startswith (#4024) 2024-10-01 15:23:35 -07:00
Simon Young
e96b4bf42e
a friendly little helper (#4021)
* a friendly little helper

* addressing comments

* update comment

---------

Co-authored-by: simon <simon@reflex.dev>
2024-10-01 14:32:05 -07:00
Masen Furer
9c3cc0cfa6
bump version to 0.6.2dev1 (#4025)
For further development against the version that will become 0.6.2
2024-10-01 12:34:28 -07:00
ChinoUkaegbu
bd71c8e6c9
feat: Add support for missing SVGs (#3962) 2024-10-01 09:24:26 -07:00
Khaleel Al-Adhami
9719f5d57e
use literal var instead of serialize for toast props (#4027) 2024-09-29 12:08:56 -07:00
Thomas Brandého
23e979717f
remove all runtime asserts (#4019)
* remove all runtime asserts

* Update reflex/testing.py

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

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-09-27 17:25:22 -07:00
Khaleel Al-Adhami
62021b0b40
implement _evaluate in state (#4018)
* implement _evaluate in state

* add warning

* use typing_extension

* add integration test
2024-09-27 16:58:20 -07:00
Thomas Brandého
1b3422dab6
improve lifespan typecheck and debug (#4014)
* add lifespan debug statement

* improve some of the logic for lifespan tasks

* fix partial name with update_wrapper
2024-09-27 16:17:30 -07:00
Masen Furer
9ca5d4a095
Track backend-only vars that are declared without a default value (#4016)
* Track backend-only vars that are declared without a default value

Without this provision, declared backend vars can be accidentally shared among
all states if a mutable value is assigned to the class attribute.

* add test case for no default backend var
2024-09-27 12:04:43 -07:00
Khaleel Al-Adhami
eea5dc1918
change loglevel and fix granian on linux (#4012)
* change loglevel and fix it on linux

* run precommit

* fix that as well
2024-09-26 21:54:03 -07:00
Masen Furer
ae0f3f820e
Handle bool cast for optional NumberVar (#4010)
* Handle bool cast for optional NumberVar

If the _var_type is optional, then also check that the value is not None

* boolify the result of `and_operation`

* flip order to be more semantically pure

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-09-26 21:52:31 -07:00
Thomas Brandého
299f842756
add env var to enable using system node and bun (#4006)
* add env var to enable using system node and bun

* fix test to use env var
2024-09-26 16:12:12 -07:00
Khaleel Al-Adhami
0ab161c119
remove format_state and override behavior for bare (#3979)
* remove format_state and override behavior for bare

* pass the test cases

* only do one level of dicting dataclasses

* remove dict and replace list with set

* delete unnecessary serialize calls

* remove serialize for mutable proxy

* dang it darglint
2024-09-26 16:00:28 -07:00
Khaleel Al-Adhami
70bd88c682
serialize default value for disk state manager (#4008) 2024-09-26 13:59:17 -07:00
LeoH
60276cf1ff
EventFnArgMismatch fix to support defaults args (#4004)
* EventFnArgMismatch fix to support defaults args

* fixing type hint and docstring raises

* enforce stronger type checking

* unwrap var annotations :(

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-09-26 13:56:53 -07:00
Khaleel Al-Adhami
54c7b5a261
disable prose by default for rx.html (#4001)
* disable prose by default for rx.html

* remove styled

* put that on one line
2024-09-26 13:47:05 -07:00
Thomas Brandého
130bcf96ca
default on_submit in form set to prevent_default (#4005)
* default submit forms set to prevent_default

* fix tests
2024-09-26 11:56:59 -07:00
Masen Furer
25016f5e27
Update markdown component map to use new rx.code_block.theme enum (#3996)
* Update markdown component map to use new rx.code_block.theme enum

* change var to theme

* give the types some attention instead of ignoring them

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-09-26 11:04:35 -07:00
Thomas Brandého
3f538865b5
reorganize all tests in a single top folder (#3981)
* lift node version restraint to allow more recent version if already installed

* add node test for latest version

* change python version

* use purple for debug logs

* update workflow

* add playwright dev dependency

* update workflow

* change test

* oops

* improve test

* update test

* fix tests

* mv units tests to a subfolder

* reorganize tests

* fix install

* update test_state

* revert node changes and only keep new tests organization

* move integration tests in tests/integration

* fix integration workflow

* fix dockerfile workflow

* fix dockerfile workflow 2

* fix shared_state
2024-09-26 01:22:52 +02:00
Thomas Brandého
b07fba72e9
add missing message when running in backend_only (#4002)
* add missing message when running in backend_only

* actually pass loglevel to backend_cmd
2024-09-26 00:57:08 +02:00
Khaleel Al-Adhami
9d8b737b1a
hash the state file name (#4000)
* hash the state file name

* forgot to digest my food oop
2024-09-25 13:11:04 -07:00
Masen Furer
e1538b75f8
bump to 0.6.1 for further dev (#3995)
* bump version to 0.6.1dev1

* bump reflex-chakra requirement to 0.6.0

* update poetry file

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-09-25 11:31:45 -07:00
Khaleel Al-Adhami
74d1c47ce2
allow classname to be state vars (#3991)
* allow classname to be state vars

* simplify join with all literal string vars

* add test case and avoid concat var operation if it's not necessary

* remove silly print statement

* simplify case where there's no var

* don't automatically do class name str to literal var
2024-09-25 09:57:29 -07:00
Khaleel Al-Adhami
982c43d595
use bundled radix ui for dynamic components (#3993) 2024-09-25 09:57:16 -07:00
Thomas Brandého
3eeb0bde9c
bump nextjs version (#3992) 2024-09-25 09:56:15 -07:00
Khaleel Al-Adhami
fc5d352431
add basic integration test for dynamic components (#3990)
* add basic integration test

* fix docstrings

* dang it darglint
2024-09-25 09:55:16 -07:00