Commit Graph

1318 Commits

Author SHA1 Message Date
Elijah
2320b3126b Form High Level API 2024-04-08 15:23:49 +00:00
Martin Xu
67702e0927
remove prompt for display name (#3025) 2024-04-05 18:25:37 -07:00
Thomas Brandého
11a64e04d5
change to a nicer error message when reflex run fail (#3023) 2024-04-05 13:44:03 -07:00
Martin Xu
43dff5397c
bugfix in processing the user entered keywords for custom component share command (#3012) 2024-04-04 18:23:04 -07:00
Tom Gotsman
8c99a4a7f5
add logo to blank template (#3014) 2024-04-04 16:06:19 -07:00
Martin Xu
7d36610cae
Support reflex app creation from templates from github (#2490) 2024-04-04 15:31:34 -07:00
Nikhil Rao
44d6c997dd
Reflex run automatically inits when needed (#3011) 2024-04-04 14:34:12 -07:00
Martin Xu
ef5c5bea2b
[REF-2303] Update custom component template for new API (#3007) 2024-04-04 11:58:39 -07:00
Tom Gotsman
0619017626
adding a reflex logo component (#2994) 2024-04-04 11:26:25 -07:00
Nikhil Rao
9606c65060
Include architecture post in readme (#2993) 2024-04-04 11:20:05 -07:00
Thomas Brandého
8735e01e5c
add experimental namespace under rx._x (#2951)
* add experimental namespace under rx._x

* add warning when using rx._x
2024-04-04 19:59:28 +02:00
Phuc Tran
2ba526fb8e
Fix typo under page.py (#3001) 2024-04-04 09:26:45 -07:00
Martin Xu
5274f04b66
[REF-2296] Rename recursive functions (#2999) 2024-04-04 09:26:31 -07:00
Elijah Ahianyo
619c0b0d06
Exclude .web dir when running uvicorn (#2986) 2024-04-04 09:25:03 -07:00
Swaraj Baral
ae3dfc6412
Added custom_attrs to the list of trigger props (#2980) 2024-04-04 09:24:48 -07:00
Thomas Brandého
bf0ebb8d09
Lendemor/improve coverage (#2988)
* add more tests

* add tests to raise coverage

* more tests, bump coverage to 73

* fix up icon_button test

* fix darglint for app.py

* fix utcnow usage warning

* set threshold to 72

* fix timestamp

* fix unit tests for linux-redis

* removed commented code and put a TODO
2024-04-04 14:31:43 +02:00
Thomas Brandého
34ee07ecd1
use dict instead of set to store hooks (#2995) 2024-04-03 17:13:42 -07:00
Sidharth Anil
b2c51b82a5
Windows uvicorn bug fix (#2954) 2024-04-03 14:43:28 -07:00
Elijah Ahianyo
d43a85bab2
Unpack component tuples in a fragment (#2985) 2024-04-03 10:44:04 -07:00
Martin Xu
00b1e193ad
the keywords in pyproject.toml template have extra spaces (#2990) 2024-04-02 14:07:12 -07:00
Alek Petuskey
0981ac675b
Update sidebar template (#2959) 2024-04-02 11:48:34 -07:00
Aman Salwan
0e221f0984
Logic for removing the 'None' property along with its corresponding test case. (#2969) 2024-04-02 11:37:05 -07:00
Martin Xu
9504700777
remove types-tabulate from dev deps, it is in CLI (#2977) 2024-04-01 15:57:46 -07:00
Martin Xu
6d400eddc9
Revert "[REF-2269] Add add_imports API for component class (#2937)" (#2978)
This reverts commit 8edd1dfdc9.
2024-04-01 15:57:03 -07:00
Masen Furer
c357405c3e
bump to 0.4.6 (#2975) 2024-04-01 12:06:10 -07:00
Nikhil Rao
d4a546ba70
Relax typer pin (#2976) 2024-04-01 12:05:58 -07:00
Nikhil Rao
108d5aa5b2
Pin uvicorn and typer versions (#2974) 2024-04-01 11:34:03 -07:00
Martin Xu
df5489807d
adjust share command prompt (#2965)
* adjust share command prompt

* use lower case "y" for console.ask, keep order consistent as "y" then "n"

* share command update: do not suggest demo URL is mandatory, also move to the last question; when checking if user has permission to upsert package, do POST to record this package (if first time sharing)

* clean up prompt for preview image
2024-04-01 11:32:34 -07:00
Martin Xu
7e4668f5ca
[REF-2425] Reduce unnecessary CI runs (#2966) 2024-03-29 16:25:03 -07:00
Thomas Brandého
0af4770180
generate pyi files when building/publishing 3rd party component (#2945)
* build pyi files when building/publishing 3rd party

* fix typo in workflow

* add future annotation

* add tests to pass coverage check

* add more unit tests

* omit pyi_generator from test coverage

* change black from dev deps to direct deps

* remake all pyi

* format pyi if black is present, return as if otherwise

* fix requested changes

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-03-29 09:54:21 -07:00
Masen Furer
55b0fb36e8
[REF-2219] Avoid refetching states that are already cached (#2953)
* Add test_get_state_from_sibling_not_cached

A better unit test to catch issues with refetching parent states
and calculating the wrong parent state names to fetch.

* _determine_missing_parent_states: correctly generate state names

Prepend only the previous state name to the current relative_parent_state_name
instead of joining all of the previous state names together.

* [REF-2219] Avoid refetching states that are already cached

The already cached states may have unsaved changes which can be wiped out if
they are refetched from redis in the middle of handling an event.

If the root state already knows about one of the potentially missing states,
then use the instance that is already cached.

Fix #2851
2024-03-29 09:42:25 -07:00
Masen Furer
628c865530
Set is_hydrated=False at route onChangeStart (#2949)
* Connection pulser only depends on has_connection_errors

Avoid showing the WiFi error icon when the state is hydrating / navigating
because not being hydrated is not indicative of a connection error in itself.

* Set is_hydrated=False at route onChangeStart

When navigation event starts, set is_hydrated=False on the client side before
any on_load event is dispatched. This avoids a flickering problem where the
client browser navigates and briefly shows content on the page before
processing on_load events associated with the page.

Fix #2885

* Update pyi
2024-03-29 09:41:18 -07:00
Abhivyakt Bhati
ee66884e96
Update README.md (#2963)
Fixed deployment link. The previous one was wrong and led to a 404 error on Reflex's website
2024-03-29 09:28:33 -07:00
Malte Klemm
86526cba51
[REF-2127] Loosen requirements (#2796)
* Remove upper bounds of most dependencies.

Also adds a import try except block for pydantic.v1 and relocks.

Keep black and ruff to not mess to much with current formatting

Make pyright see the right import as long as constraint still lock pydantiv v1

Down pin pytest-asyncio again due to known issue

Fix upload handler with latest versions of fastapi

Change comment

* Add changed lockfile

* Set max versions for deps

* Revert app.pyi

---------

Co-authored-by: Malte Klemm <malte.klemm@blueyonder.com>
Co-authored-by: Nikhil Rao <nikhil@reflex.dev>
2024-03-29 09:26:53 -07:00
Masen Furer
5510eaf820
[REF-2265] ComponentState: scaffold for copying State per Component instance (#2923)
* [REF-2265] ComponentState: scaffold for copying State per Component instance

Define a base ComponentState which can be used to easily create copies of the
given State definition (Vars and EventHandlers) that are tied to a particular
instance of a Component (returned by get_component)

* Define `State` field on `Component` for typing compatibility.

This is an Optional field of Type[State] and is populated by ComponentState.

* Add integration/test_component_state.py

Create two independent counters and increment them separately

* Add unit test for ComponentState
2024-03-29 09:22:25 -07:00
Martin Xu
f372402ee4
[REF-2272] Support declaring EventHandlers directly in component (#2952) 2024-03-29 06:26:07 -07:00
Yummy-Yums
e2eced79b1
Scroll to feature (#2948)
* updated watchdog dep

* added scroll_to feature

* Fix pre-commit and pyi issues

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-03-28 17:18:08 -07:00
Masen Furer
8ef193809c
textarea: expose auto_height and enter_key_submit props (#2884)
* textarea: expose auto_height and enter_key_submit props

These two props improve the workflow for chat apps and other situations where
we want multiline input.

auto_height: resize the textarea based on its contents

enter_key_submit: pressing enter submits the enclosing form (shift+enter
inserts new lines)

Fix #1231

* Update pyi
2024-03-28 17:17:30 -07:00
Martin Xu
68c56a9811
[REF-2168] Add share options to custom component commands (#2883)
* add command to share custom component info for gallery

* cleanup

* tested

* Update custom_components.py

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

* reorder the questions

* ask user to verify info before publishing

* remove questions already captured in pyproject.toml

* no need to cache form inputs since not many questions

* tested

* cleanup

* delete test

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-03-28 15:13:37 -07:00
Masen Furer
c9e87d70df
parse_args_spec: resolve annotations with typing.get_type_hints (#2849)
* parse_args_spec: resolve annotations with typing.get_type_hints

Ensure that event trigger specs in modules with future annotations are resolved
correctly.

Fix #2848

* Fix arg spec for on_upload_progress event

Make py3.8 compatible with `get_type_hints`
2024-03-28 12:16:04 -07:00
Martin Xu
8edd1dfdc9
[REF-2269] Add add_imports API for component class (#2937) 2024-03-28 11:03:26 -07:00
Thomas Brandého
1810288007
remove inheritance from Flex for list components (#2936) 2024-03-28 10:58:36 -07:00
Yummy-Yums
e4ff87326a
updated watchdog dep (#2946) 2024-03-28 09:29:46 -07:00
Masen Furer
03eb258ee7
[REF-2416] Pass shell=True when starting AppHarness on Windows (#2944)
In exec.py, run_process_and_launch_url already passes `shell=True` on windows,
but the AppHarness has never really been used on Windows, so we were missing
this detail.

Fix #2941
2024-03-27 16:22:58 -07:00
Masen Furer
b23859a45d
[REF-2302] When a Var points to a model, prefer access to model fields. (#2893)
* When a Var points to a model, prefer access to model fields.

When a Var points to a model, and fields of the model share the same name as
Var operations, access to the model fields is now preferred to avoid having Var
operation names shadow model fields. Since most Var operations do not actually
work against Models, this does not really block any functionality.

* Special case for ComputedVar needing to internally access fget

Since fget is a "slot" on property, normal __getattribute__ access cannot find it.

* Workaround https://github.com/python/cpython/issues/88459

In python 3.9 and 3.10, the `isinstance(list[...], type)` returns True, but
it's not a valid class for use in issubclass
2024-03-27 16:22:46 -07:00
Masen Furer
b788890696
[REF-2089] Use dill instead of cloudpickle for serialization (#2922)
* Use dill instead of cloudpickle for serialization

* smaller size pickles
* support dynamically defined states
* avoid issues with unpickleable globals

* pyproject: add dill, remove cloudpickle

* poetry.lock: relock dependencies

* Dynamically convert EventHandler to functools.partial

Instead of converting the functions up front and assigning them to the
instance, unbox the function from the EventHandler when it is requested via
__getattribute__. This reduces the size of the per-instance pickle, because
event handler bodies do not need to be included.

* Improve checking for cython_function_or_method

Because pydantic can be installed without cython, only use the workaround in
the case where the BaseModel.validate function is NOT a FunctionType,
indicating it's a cython function.

* Serialize all State subclasses by reference
2024-03-27 13:47:33 -07:00
Elijah Ahianyo
b34c97d725
Default to None if bun/fnm version is Invalid (#2940) 2024-03-27 12:38:56 -07:00
Thomas Brandého
94823f1317
fix hook order to use ref inside user hooks (#2906)
* fix hook order to use ref inside user hooks

* 2nd attempt to fix ref_hook order

* add missing definition

* remove print statements
2024-03-27 12:49:11 +01:00
Masen Furer
012151132e
Remove page.pyi: it's out of date, and not necessary (#2924)
Fix #2908
2024-03-26 20:21:29 +01:00
benedikt-bartscher
f27eae7655
fix AppHarness reloading (#2916)
* move AppHarness tests to module scope

* fix AppHarness reloading

* add test

* docstrings and formatting

* fix benchmarks not reloading state module
2024-03-26 11:09:46 -07:00