Commit Graph

74 Commits

Author SHA1 Message Date
Thomas Brandého
b8b3f8910e
add more type annotations through the code (#4401)
* add more type annotations through the code

* add typing in reflex/utils

* misc typing

* more typings

* state typing

* keep typing

* typing init and utils

* more typing for components

* fix attempt for 3.9

* need more __future

* more typings

* type event plz

* type model

* type vars/base.py

* enable 'ANN001' for reflex folder (ignore tests and benchmarks)

* fix pyi

* add missing annotations

* use more precise error when ignoring
2025-01-29 01:12:47 +01:00
Khaleel Al-Adhami
8dea682781
update bun to 1.2.0 (#4678) 2025-01-22 15:19:25 -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
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
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
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
Khaleel Al-Adhami
189700ecb3
Change bun link (#4162)
* change bun to download from us

* make it use branch
2024-10-11 15:43:54 -07:00
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
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
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
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
Masen Furer
f1dafc0373
pyi_generator cleanup: ruff, remove fully qualified reflex. names (#3591)
* pyi_generator: avoid fully qualified names for reflex. types

The previous method added quite a large line diff to the pyi files, so for now,
lets just add the `Breakpoints` import to the default set along with Var,
EventHandler, Style and others.

* pyi_generator: fix generated files using ruff

also generate updated pyi files in reflex/experimental namespace

* remove black from dev dependencies

* poetry.lock: relock deps

* Update all pyi files with new formatting

* pre-commit fixes

* pyi_generator: fix __init__.pyi files again
2024-06-29 08:48:01 -07:00
Thomas Brandého
0d39237b3c
upgrade to latest ruff (#3497)
* upgrade to latest ruff

* try to fix dep review

* try to fix dep review (2)

* upgrade black

* upgrade black (2)

* update allowed dependencies

* update allowed dependencies (2)

* update allowed dependencies (3)

* wait between interim and final in yield test

* remove previous commit, increase delay between yield

* forgot to save on the time.sleep(1) removal

* fix integration (maybe?)

* fix pyi?

* what even is going on

* what is realityi?

* test another fix for app harness

* try to wait even longer?

* force uvloop to be optional

* downpin fastapi < 0.111, remove changes to test
2024-06-19 12:32:13 +02:00
Masen Furer
fb173908db
Only run pyi_generator on files in reflex/components or reflex/__init__.py (#3452) 2024-06-06 21:31:17 -07:00
Elijah Ahianyo
34bf25071a
[REF-2821]Improve Dynamic Imports (#3345)
* Improve import times

* add lazy loading to rx.el

* add lazy loading to reflex core components

* minor refactor

* Get imports working with reflex web

* get imports to work with all reflex examples

* refactor to define imports only in the root.

* lint

* deadcode remove

* update poetry deps

* unit tests fix

* app_harness fix

* app_harness fix

* pyi file generate

* pyi file generate

* sort pyi order

* fix pyi

* fix docker ci

* rework pyi-generator

* generate pyi for __init__ files

* test pyright

* test pyright ci

* partial pyright fix

* more pyright fix

* pyright fix

* fix pyi_generator

* add rx.serializer and others

* add future annotation import which fixes container CI, then also load recharts lazily

* add new pyi files

* pyright fix

* minor fixes for reflex-web and flexdown

* forward references for py38

* ruff fix

* pyi fix

* unit tests fix

* reduce coverage to 68%

* reduce coverage to 67%

* reduce coverage to 66%as a workaround to coverage's rounding issue

* reduce coverage to 66%as a workaround to coverage's rounding issue

* exclude lazy_loader dependency review checks.

* its lazy-loader

* Add docstrings and regenerate pyi files

* add link

* address Pr comments

* CI fix

* partially address PR comments.

* edit docstrings and fix integration tests

* fix typo in docstring

* pyi fix
2024-05-31 16:43:10 +00:00
Elijah Ahianyo
89a83ecd42
[REF-2803] Add imports benchmarks (#3272) 2024-05-14 23:19:46 -07:00
Elijah Ahianyo
93c4f5024e
Windows Pin Bun version (#3192) 2024-05-01 14:47: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
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
Elijah Ahianyo
e0fedeb419
[REF-1682][REF-1683][REF-1684][REF-2283]Benchmark reflex package size and .web folder (#2880)
* remove codspeed.yml

* test upload job

* minor edits to get upload job working

* perhaps this works

* upload needs relex-install-size

* retrigger pipeline

* test only on ubuntu

* change to save to db directly

* oops

* size benchmarks

* .web for counter

* its timeout-minutes

* se integration.sh to run and kill process

* install psycopg2

* move .web runs to integration_tests.yml to save runners

* fix measurement-type for reflex-web

* add database url to env

* psycopg2

* test run ids

* commit sha gets the job done

* refactor

* add more matrices

* move reflex package size to integration_test.yml

* fix venv path

* test fix

* test fix

* use hyphen

* testing reflex build size

* ls for temp debug

* fix typo in command

* possible fix

* possible fix for windows

* remove dead code

* remove dead code

* remove unwanted comments

* refactor

* rebase on main

* pr_title

* remove pr_title from args

* debug

* should work now

* precommit fix

* print out package size for

* add shell

* test

* trying again

* dont use cached poetry to have accurate measurement of deps

* remove reflex deps calculation step from integration job

* fix script path

* precommit fix

* no real difference on different python versions so use 3.11.5

* remove ls keyword
2024-03-25 08:33:28 +00:00
Elijah Ahianyo
83318530f2
[REF-2284]Benchmark add extra info on publishing data (#2864)
* Benchmark add extra info on publishing data

* fix typo

* get file name for simplicity

* precommit fix

* removesuffix not in python3.8

* add pr_id in case the pr title is changed

* precommit fix
2024-03-21 07:25:40 +00:00
Martin Xu
f80d7978d2
make PR title optional since push event or PR merge will not have the title (#2889) 2024-03-20 16:38:09 -07:00
Martin Xu
fa99407b81
Handle quote marks ' " in PR titles in benchmark CI (#2877)
* escape double quote marks in PR title

* move the pr title into the env
2024-03-20 11:30:47 -07:00
Elijah Ahianyo
a06b570e3a
Benchmark with app harness (#2774) 2024-03-13 15:59:55 -07:00
Masen Furer
4206afeb7b
[REF-1958] Remove shadowed radix css props (#2590)
* style: shorthand replacements need camelCase

Avoid warning on terminal and in browser console from using kebab-case CSS
props with emotion.

* _rename_props only replace prop name once

In case the value also contains the prop name, we don't want to replace it
multiple times.

* pyi_generator: ignore _rename_props in create signature

* Avoid shadowing CSS prop `display` and `gap`

Replace usages of `gap` with `spacing` to retain Radix sizing number system,
while allowing users to specify a responsive `gap` using CSS units.

Remove `display` props from radix components, allowing `display` to accept
responsive lists.

* checkbox: apply `gap` to `flex` if provided

* Remove _rename_props from .create signatures

* Fix spacing prop in blank template

* Fixup tests after changing style shorthand to return camelCase
2024-02-13 10:06:28 -08:00
Masen Furer
d28109f4c4
Merge remote-tracking branch 'origin/main' into reflex-0.4.0 2024-02-08 11:54:02 -08:00
jackie-pc
a4ee985509
CLI script to maintain Chakra backed components in rx namespace in older apps (#2322) 2024-02-08 11:12:20 -08:00
Masen Furer
f99c48806a
Top-level namespace tweaks (#2523)
* pyi_generator: always ignore files starting with `tests`

* Move CodeBlock out of chakra namespace

* Expose additional names in the top-level namespace

* code pyi fixup

* expose input and quote at the top-level

* add text_field to top-level namespace (maybe)

* fixup chakra code.pyi

* Remove `text_field` from top level namespace

* Remove top-level big C Cond

* fixup top level pyi
2024-02-05 11:14:02 -08:00
Masen Furer
35b20d26b5
Merge remote-tracking branch 'origin/main' into reflex-0.4.0 2024-02-02 08:39:10 -08:00
Nikhil Rao
5176a7cb14
Support component create methods as keys in global styles (#2498) 2024-01-31 12:25:18 -08:00
Masen Furer
4df279b060
Merge remote-tracking branch 'origin/main' into reflex-0.4.0 2024-01-31 12:06:51 -08:00
Masen Furer
a5302f1866
[0.4.0] Namespace the Drawer primitive subcomponents (#2492) 2024-01-31 11:39:13 -08:00
Tianze
a14575009c
Minor fix on path to make it work in Windows (#2494) 2024-01-31 10:00:41 -08:00
Nikhil Rao
27b9a10233 Merge branch 'main' into reflex-0.4.0 2024-01-30 16:48:38 -08:00
Masen Furer
2782c0fe3c
Fix pyi_generator relative path determination (#2485) 2024-01-30 15:03:15 -08:00
Tianze
209c5fab7b
Tabs validate parent is proper tab container (#2463) 2024-01-30 11:45:00 -08:00
Masen Furer
763c1c1f07
pyi_generator: Generate stubs for SimpleNamespace classes
If the namespace assigns `__call__` to an existing component `create` function,
generate args and docstring for IDE integration.
2024-01-29 17:38:58 -08:00
benedikt-bartscher
08524e22aa
pyi generator git diff (#2460) 2024-01-26 14:21:25 -08:00
benedikt-bartscher
4219a78e7c
use multiprocessing to speed up pyi generation (#2453) 2024-01-25 13:46:15 -08:00
Masen Furer
1a50a63b98
Docstrings for radix components (#2407) 2024-01-24 12:39:05 -08:00
benedikt-bartscher
0b1b8ee639
auto enable /_upload endpoint only if Upload component is used (#2430) 2024-01-23 12:20:06 -08:00
Elijah Ahianyo
abfc099779
rx.match component (#2318)
* initial commit

* add more tests

* refactor match jinja template

* add docstrings

* cleanup

* possible fix for pyright

* fix conflicts

* fix conflicts again

* comments

* fixed bug from review

* fix tests

* address PR comment

* fix tests

* type error improvement

* formatting

* darglint fix

* more tests

* stringify switch condition and cases as js doesnt support complex types(lists and dicts) in switch cases.

* Update reflex/vars.py

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

* change usages

* Precommit fix

---------

Co-authored-by: Alek Petuskey <alek@pynecone.io>
Co-authored-by: Masen Furer <m_github@0x26.net>
Co-authored-by: Alek Petuskey <alekpetuskey@aleks-mbp.lan>
2024-01-04 09:48:18 -08:00
Thomas Brandého
8ac08e2cb4
color_scheme props added and updated pyi files (#2279) 2023-12-18 20:47:18 -08:00
Masen Furer
a2d5bbc133
[reflex-web tweaks] Do not memoize children of InputGroup (#2230) 2023-11-30 09:48:28 -08:00
Masen Furer
8e7d4819ee
check_generated_pyi: fix diff checking (#2029) 2023-11-17 15:21:52 -08:00
Thomas Brandého
ddb1f8133b
Apply new pyi script (#2041) 2023-11-16 10:27:04 -08:00
Nikhil Rao
33e4816950
Lazy import modules in reflex (#2144) 2023-11-13 19:48:12 -08:00
Alek Petuskey
dd982c5ace
Add benchmarking tests (#2143) 2023-11-08 17:41:08 -08:00
Thomas Brandého
9a5579e1ef
Add datagrid editor (#1941) 2023-10-26 16:17:34 -07:00
Masen Furer
5d590c350e
Refactor pyi_generator to use AST directly (#2034) 2023-10-26 10:56:35 -07:00