Commit Graph

1650 Commits

Author SHA1 Message Date
Masen Furer
8f396fc348
ImmutableVar perf optimizations (#3814)
* Use lru_cache on expensive typing-related functions

* Skip instantiation of VarData unless data was actually merged

* Revert "integration: bump listening timeout to 1800 seconds"

This reverts commit a94eedff6d.

* Revert "integration: bump listening timeout to 1200 seconds"

This reverts commit 86563b66a4.
2024-08-28 10:02:16 -07:00
Masen Furer
3fa9f1fc06
[REF-3633] [main] Introduce a workaround for enterprise users who get stuck with httpx.get SSL (#3847)
* [REF-3633] Introduce a workaround for enterprise users who get stuck with httpx.get SSL

Setting SSL_NO_VERIFY=1 will disable SSL verification during `reflex init`

* Also install fnm using `reflex.utils.net.get`
2024-08-28 09:33:31 -07:00
Masen Furer
be71254250
Fix double-quoting of defaultColorMode (#3840)
If the user provided an `appearance` or `color_mode` value to `rx.theme`, then
the resulting value ended up being double-double-quoted in the resulting JS
output.

Instead remove the quotes from the context.js.jinja2 and always pass appearance
as a Var.
2024-08-26 17:17:39 -07:00
Masen Furer
1d9a154d5b
guess_type: if the type is optional, treat it like it's "not None" (#3839)
* guess_type: if the type is optional, treat it like it's "not None"

When guessing the type for an Optional annotation, the Optional was already
being stripped off, but this value was being ignored, except for error
messages. So actually use the Optional-stripped value.

* Strip Optional when casting Var .to
2024-08-26 16:26:17 -07:00
Khaleel Al-Adhami
ea15b184c0
fully migrate vars into new system (#3743)
* fully migrate vars into new system

* i hate rufffff (no i don't)

* fix silly pright issues (except colormode and state)

* remove all instances of Var.create

* create immutable callable var and get rid of more base vars

* implement hash for all functions

* get reflex-web to compile

* get it to compile reflex-web successfully

* fix tests

* fix pyi

* use override from typing_extension

* put plotly inside of a catch

* dicts are unusable sadly

* fix silly mistake

* overload equals to special case immutable var

* improve test_cond

* solve more CI issues, down to 94 failures

* down to 20 errors

* down to 13 errors

* pass all testcases

* fix pyright issues

* reorder things

* use get origin more

* use fixed_type logic

* various optimizations

* go back to passing test cases

* use less boilerplate

* remove unnecessary print message

* remove weird comment

* add test for html issue

* add type ignore

* fix another silly issue

* override get all var data for var operations call

* make integration tests pass

* fix immutable call var

* better logic for finding parent class

* use even better logic for finding state wrt computedvar

* only choose the ones that are defined in the same module

* small dict to large dict

* [REF-3591] Remove chakra-related files from immutable vars PR (#3821)

* Add comments to html metadata component (#3731)

* fix: add verification for path /404 (#3723)

Co-authored-by: coolstorm <manas.gupta@fampay.in>

* Use the new state name when setting `is_hydrated` to false (#3738)

* Use `._is_mutable()` to account for parent state proxy (#3739)

When a parent state proxy is set, also allow child StateProxy._self_mutable to
override the parent's `_is_mutable()`.

* bump to 0.5.9 (#3746)

* add message when installing requirements.txt is needed for chosen template during init (#3750)

* #3752 bugfix add domain for XAxis (#3764)

* fix appharness app_source typing (#3777)

* fix import clash between connectionToaster and hooks.useState (#3749)

* use different registry when in china, fixes #3700 (#3702)

* do not reload compilation if using local app in AppHarness (#3790)

* do not reload if using local app

* Update reflex/testing.py

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

---------

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

* Bump memory on relevant actions (#3781)

Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>

* [REF-3334] Validate Toast Props (#3793)

* [REF-3536][REF-3537][REF-3541] Move chakra components into its repo(reflex-chakra) (#3798)

* fix get_uuid_string_var (#3795)

* minor State cleanup (#3768)

* Fix code wrap in markdown (#3755)

---------

Co-authored-by: Alek Petuskey <alek@pynecone.io>
Co-authored-by: Manas Gupta <53006261+Manas1820@users.noreply.github.com>
Co-authored-by: coolstorm <manas.gupta@fampay.in>
Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>
Co-authored-by: Shubhankar Dimri <dimrishubhi@gmail.com>
Co-authored-by: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com>
Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
Co-authored-by: Elijah Ahianyo <elijahahianyo@gmail.com>

* pyproject.toml: bump to 0.6.0a1

* pyproject.toml: depend on reflex-chakra>=0.6.0a

New Var system support in reflex-chakra 0.6.0a1

* poetry.lock: relock dependencies

* integration: bump listening timeout to 1200 seconds

* integration: bump listening timeout to 1800 seconds

* Use cached_var_no_lock to avoid ImmutableVar deadlocks (#3835)

* Use cached_var_no_lock to avoid ImmutableVar deadlocks

ImmutableVar subclasses will always return the same value for a _var_name or
_get_all_var_data so there is no need to use a per-class lock to protect a
cached attribute on an instance, and doing so actually is observed to cause
deadlocks when a particular _cached_var_name creates new LiteralVar instances
and attempts to serialize them.

* remove unused module global

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
Co-authored-by: Alek Petuskey <alek@pynecone.io>
Co-authored-by: Manas Gupta <53006261+Manas1820@users.noreply.github.com>
Co-authored-by: coolstorm <manas.gupta@fampay.in>
Co-authored-by: Thomas Brandého <thomas.brandeho@gmail.com>
Co-authored-by: Shubhankar Dimri <dimrishubhi@gmail.com>
Co-authored-by: benedikt-bartscher <31854409+benedikt-bartscher@users.noreply.github.com>
Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
Co-authored-by: Elijah Ahianyo <elijahahianyo@gmail.com>
2024-08-26 13:28:18 -07:00
elvis kahoro
a265fb4ae5
Add comments to DataList components (#3827)
* fix: Adding missing comments to the data list

* fix: Ran make pyi
2024-08-23 18:29:33 -07:00
Masen Furer
56c24f5432
Upper bound for reflex-chakra dependency (#3824)
* Upper bound for reflex-chakra dependency

We have to make a breaking change in reflex-chakra, and it will happen in 0.6.0, so ensure that reflex 0.5.10 never installs the breaking version of reflex-chakra.

* Relock deps
2024-08-23 12:59:34 -07:00
Elijah Ahianyo
9c656a0f9c
Fix benchmark tests (#3822) 2024-08-23 11:55:18 -07:00
Alek Petuskey
13a6d538a9
Fix code wrap in markdown (#3755) 2024-08-20 12:11:39 -07:00
benedikt-bartscher
2d9380a6fd
minor State cleanup (#3768) 2024-08-20 12:10:13 -07:00
Shubhankar Dimri
9c70971dc6
fix get_uuid_string_var (#3795) 2024-08-20 10:25:37 -07:00
Elijah Ahianyo
1f3779f40e
[REF-3536][REF-3537][REF-3541] Move chakra components into its repo(reflex-chakra) (#3798) 2024-08-19 13:41:31 -07:00
Elijah Ahianyo
4190a79835
[REF-3334] Validate Toast Props (#3793) 2024-08-15 09:30:32 -07:00
Alek Petuskey
b01c4b6c6a
Bump memory on relevant actions (#3781)
Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
2024-08-13 15:49:43 -07:00
Thomas Brandého
634c0916f6
do not reload compilation if using local app in AppHarness (#3790)
* do not reload if using local app

* Update reflex/testing.py

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

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-08-13 23:14:38 +02:00
Khaleel Al-Adhami
910bcdb017
use different registry when in china, fixes #3700 (#3702) 2024-08-12 03:06:34 -07:00
Thomas Brandého
0eff63eed4
fix import clash between connectionToaster and hooks.useState (#3749) 2024-08-12 03:04:55 -07:00
benedikt-bartscher
b58ce1082e
fix appharness app_source typing (#3777) 2024-08-11 17:42:39 -07:00
Shubhankar Dimri
911c2af044
#3752 bugfix add domain for XAxis (#3764) 2024-08-09 12:12:49 -07:00
Thomas Brandého
1a3a6f4a34
add message when installing requirements.txt is needed for chosen template during init (#3750) 2024-08-09 12:08:16 -07:00
Masen Furer
1131caebe8
bump to 0.5.9 (#3746) 2024-08-06 13:43:12 -07:00
Masen Furer
3309c0e533
Use ._is_mutable() to account for parent state proxy (#3739)
When a parent state proxy is set, also allow child StateProxy._self_mutable to
override the parent's `_is_mutable()`.
2024-08-05 14:03:49 -07:00
Masen Furer
7d9ed7e2ce
Use the new state name when setting is_hydrated to false (#3738) 2024-08-05 14:03:30 -07:00
Manas Gupta
c7e30522bc
fix: add verification for path /404 (#3723)
Co-authored-by: coolstorm <manas.gupta@fampay.in>
2024-08-05 14:02:47 -07:00
Alek Petuskey
76627c2076
Add comments to html metadata component (#3731) 2024-08-01 13:24:39 -07:00
Khaleel Al-Adhami
ad14f38329
add type hinting to existing types (#3729)
* add type hinting to existing types

* dang it darglint

* i cannot
2024-07-31 12:01:17 -07:00
benedikt-bartscher
129adc941a
add test for initial state dict (#3727) 2024-07-31 11:37:53 -07:00
benedikt-bartscher
2629366b23
fix initial_value for computed_var (#3726)
* fix initial_value for computed_var

* fix initial_value in pyi
2024-07-31 10:00:52 -07:00
Khaleel Al-Adhami
1c400043c6
[REF-3328] Implement __getitem__ for ArrayVar (#3705)
* half of the way there

* implement __getitem__ for array

* add some tests

* add fixes to pyright

* fix default factory

* implement array operations

* format code

* fix pyright issue

* give up

* add object operations

* add test for merge

* pyright 🥺

* use str isntead of _var_name

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

* wrong var_type

* make to much nicer

* add subclass checking

* enhance types

* use builtin list type

* improve typing even more

* i'm awaiting october

* use even better typing

* add hash, json, and guess type method

* fix pyright issues

* add a test and fix lots of errors

* fix pyright once again

* add type inference to list

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-30 15:38:32 -07:00
Masen Furer
06833f6d8d
[REF-3203] Find a DOM event-like object in addEvents (#3706) 2024-07-29 17:17:51 -07:00
Khaleel Al-Adhami
800685da68
fix silly bug when style is set directly to breakpoints (#3719)
* fix silly bug when style is set directly to breakpoints

* add helpful comment

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

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-07-29 16:57:33 -07:00
Masen Furer
4cdd87d851
Bump to v0.5.8 (#3716) 2024-07-29 09:52:45 -07:00
paoloemilioserra
2e726f1bb9
Update vars.py (#3659)
Prevent a validation error from pydantic/v1 that cannot find _var_name, etc. in __dataclass_fields__
2024-07-28 17:51:08 -07:00
Masen Furer
a4e3f05601
[REF-3375] useMemo on generateUUID props to maintain consistent value (#3708)
When using rx.vars.get_uuid_string_var, wrap the prop Var in `useMemo` so that
the value remains consistent across re-renders of the component.

Fix #3707
2024-07-26 17:10:08 -07:00
Thomas Brandého
c4346c2624
update init prompt to use new templates from reflex-dev/templates (#3677) 2024-07-25 10:51:44 -07:00
Thomas Brandého
d389f4b5ca
fix var warning (#3704) 2024-07-25 10:50:18 -07:00
Khaleel Al-Adhami
ede5cd1f2c
[REF-3321] implement var operation decorator (#3698)
* implement var operation decorator

* use older syntax

* use cast and older syntax

* use something even simpler

* add some tests

* use old union tactics

* that's not how you do things

* implement arithmetic operations while we're at it

* add test

* even more operations

* can't use __bool__

* thanos snap

* forgot ruff

* use default factory

* dang it darglint

* i know i should have done that but

* convert values into literalvars

* make test pass

* use older union tactics

* add test to string var

* pright why do you hate me 🥺
2024-07-25 09:34:14 -07:00
Masen Furer
0845d2ee76
[REF-3184] [REF-3339] Background task locking improvements (#3696)
* [REF-3184] Raise exception when encountering nested `async with self` blocks

Avoid deadlock when the background task already holds the mutation lock for a
given state.

* [REF-3339] get_state from background task links to StateProxy

When calling `get_state` from a background task, the resulting state instance
is wrapped in a StateProxy that is bound to the original StateProxy and shares
the same async context, lock, and mutability flag.

* If StateProxy has a _self_parent_state_proxy, retrieve the correct substate

* test_state fixup
2024-07-23 15:28:38 -07:00
Thomas Brandého
b9927b6f49
notifying frontend about backend error looks better (#3491) 2024-07-23 13:58:15 -07:00
Khaleel Al-Adhami
ea016314b0
[REF-3227] implement more literal vars (#3687)
* implement more literal vars

* fix super issue

* pyright has a bug i think

* oh we changed that

* fix docs

* literalize vars recursively

* do what masen told me :D

* use dynamic keys

* forgot .create

* adjust _var_value

* dang it darglint

* add test for serializing literal vars into js exprs

* fix silly mistake

* add  handling for var and none

* use create safe

* is none bruh

* implement function vars and do various modification

* fix None issue

* clear a lot of creates that did nothing

* add tests to function vars

* added simple fix smh

* use fconcat to make an even more complicated test
2024-07-22 12:45:23 -07:00
Elijah Ahianyo
9666244a87
[REF-3273] Add SVG circle, polygon and rect components (#3684) 2024-07-22 12:05:50 -07:00
Elijah Ahianyo
decdc857be
rx.list Dont set/hardcode list_style_position css prop (#3695) 2024-07-22 10:56:34 -07:00
Masen Furer
8b45d289bd
reflex init --ai fixups (#3691)
* reflex.build polling: catch exceptions and retry

Extend interval to 2 seconds to reduce server load.

* Add function to check if a string looks like a generation hash

* reflex init: allow --template to be a generation hash if --ai is specified
2024-07-19 14:05:53 -07:00
Thomas Brandého
921a5cd632
fix typo (#3689) 2024-07-19 18:02:50 +02:00
Masen Furer
1da606dd8e
[REF-3197] Browser init workflow (#3673) 2024-07-18 18:51:33 -07:00
Elijah Ahianyo
1bc1978c31
[REF-3135] Radix Primitive components should not ignore provided class_name prop (#3676) 2024-07-18 13:26:46 -07:00
Benyamin Zojaji
25aa0cbab1
add Persian translation and update the language links in the README.md files to include Persian (#3666) 2024-07-17 18:31:18 -07:00
Alek Petuskey
0a8b8a89b4
Benchmarking Updates (#3680)
* Benchmark test

* Lighthouse posthog

---------

Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
2024-07-17 17:15:13 -07:00
Khaleel Al-Adhami
458cbfac59
[REF-3228] implement LiteralStringVar and format/retrieval mechanism (#3669)
* implement LiteralStringVar and format/retrieval mechanism

* use create safe

* add cached properties to ConcatVarOperation

* fix caches

* also include self

* fix inconsistencies in typings

* use default factory not default

* add missing docstring

* experiment with immutable var data

* solve pydantic issues

* add sorted function

* missing docs

* forgot ellipses

* give up on frozen

* dang it darglint

* fix string serialization bugs and remove unused code

* add returns statement

* whitespace moment

* add simple test for string concat

* export ConcatVarOperation
2024-07-17 17:01:27 -07:00
Masen Furer
94c4c2f29f
bump to 0.5.7 (#3678) 2024-07-16 11:38:56 -07:00