Commit Graph

2191 Commits

Author SHA1 Message Date
Masen Furer
f34dda2d68
pyproject: bump to 0.7.0 final release 2025-02-11 11:30:14 -08:00
Masen Furer
974c111c27
pyproject: bump to 0.7.0a5 2025-02-10 12:27:26 -08:00
Masen Furer
b5de9775d3
Sticky tweaks: only show in prod mode (#4789)
* Sticky tweaks: only show in prod mode

Only display the sticky badge in prod mode.

Display the mini-badge for mobile and tablet; full badge only displayed at
desktop width.

* Remove localhost checking
2025-02-10 12:24:42 -08:00
Thomas Brandého
f9d3fb3d8c
fix bun path handling and add a test (#4785)
* fix bun path handling and add a test

* fix flags

* fix tests

* fix unit tests and mock object

* fix units test again

* revert some changes for now

* remove unused test
2025-02-10 12:23:38 -08:00
Masen Furer
9cd55118fe
pyproject: bump to 0.7.0a4 2025-02-07 17:39:25 -08:00
Masen Furer
5246a6fa79
Add ComputedVar overloads for BASE_TYPE, SQLA_TYPE, and DATACLASS_TYPE (#4777)
Allow typing to find __getattr__ for rx.var that returns an object-like model.
2025-02-07 17:39:17 -08:00
Khaleel Al-Adhami
9c9491a2cb
provide plotly subpackages (#4776) 2025-02-07 17:39:16 -08:00
Masen Furer
8ef6fb5455
Copy/update assets on compile (#4765)
* Add path_ops.update_directory_tree:

Copy missing and newer files from src to dest

* add console.timing context

Log debug messages with timing for different processes.

* Update assets tree as app._compile step.

If the assets change between hot reload, then update them before reloading (in
case a CSS file was added or something).

* Add timing for other app._compile events

* Only copy assets if assets exist

* Fix docstring for update_directory_tree
2025-02-07 16:57:49 -08:00
Masen Furer
4b5c59c329
Ensure EventCallback exposes EventActionsMixin properties (#4772) 2025-02-07 16:57:49 -08:00
Khaleel Al-Adhami
0875a3eac0
use getattr when given str in getitem (#4761)
* use getattr when given str in getitem

* stronger checking and tests

* switch ordering

* use safe issubclass

* calculate origin differently
2025-02-07 16:57:49 -08:00
Masen Furer
88a44f45ec
pyproject: bump to 0.7.0a3 2025-02-05 16:17:13 -08:00
Khaleel Al-Adhami
080d0c0908
make computed var generic over mapping (#4762) 2025-02-05 16:17:06 -08:00
Masen Furer
ead2796c34
Resolve custom component version dynamically (#4759)
If the custom component is using setuptools_scm or some other dynamic
versioning scheme, use `build.util` to get the actual version being published.
2025-02-05 16:17:06 -08:00
Masen Furer
6c4597a211
bump to 0.7.0a2 2025-02-05 12:11:47 -08:00
Khaleel Al-Adhami
310334ca69
remove base_state from event types (#4740)
* remove base_state from event types

* pyi that guy

* unpack is new

* woops

* use type alias type to remove ambiguity of where types go

* use same thing with LAMBDA_OR_STATE

* do it for event type
2025-02-05 12:11:37 -08:00
Carlos
2832a3c67c
Update disabled backend component (#4747)
* Update disabled backend component

* fix test message

* it's ruff out there

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2025-02-05 12:11:21 -08:00
Thomas Brandého
35954f749a
throw error if computed var has args (#4753)
* throw error if computed var has args

* change message
2025-02-05 12:11:21 -08:00
Khaleel Al-Adhami
810ead844d
move id to trigger instead of root (#4752) 2025-02-05 12:11:21 -08:00
Khaleel Al-Adhami
7b72e3aec4
don't memoize tooltip or skeleton children (#4744)
* don't memoize tooltip children

* Skip memoizing skeleton children

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2025-02-05 12:11:21 -08:00
Masen Furer
3778d774d0
[ENG-4570] Fix rx.foreach over dict (#4743)
* Add test case for literal dict in foreach

* [ENG-4570] Iterate over ObjectVar.entries

* Adjust expectations of test_foreach.py unit tests
2025-02-05 12:11:21 -08:00
Masen Furer
076b99881b
Allow template with unspecified demo_url (#4741) 2025-02-05 12:11:21 -08:00
Thomas Brandého
b6ca991cc3
fix bun message (#4739)
* fix bun message

* fix units tests mocking
2025-02-05 12:11:20 -08:00
Masen Furer
69eef837d5
bump to 0.7.0a1 2025-02-03 13:07:51 -08:00
Thomas Brandého
ef93161840
Add a sticky Built with Reflex badge (#4584)
* add the watermark class

* remove shortcut exposing badge publicly for now

* Rename as "sticky" because "watermark" has a negative connotation

* Add config `show_built_with_reflex`

This config option is available for authenticated users on various plan tiers

* py3.11 compatible f-string

* sticky badge inherit from A instead of using on_click/redirect

* fix integration test

* Move export checking logic to reflex CLI

* rx.logo: make it accessible to screen readers

Add role="img" aria_label="Reflex" and title="Reflex".

* Hide the built with reflex badge for localhost

* Revert "fix integration test"

This reverts commit a978684d70.

* experimental: do not show warning for internal imports

Only show experimental feature warnings when accessing the names through the
rx._x namespace.

If reflex internally imports the names via deep imports, then this bypasses the
warning to avoid showing it to users that have no control over how the
framework uses experimental features.

* add help link for show_built_with_reflex option

* pre-commit fixes

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2025-02-03 11:50:31 -08:00
benedikt-bartscher
73ef17b96d
fix: allow replacing of _var_type in ComputedVar (worked in previous reflex versions) (#4730) 2025-02-03 10:16:01 -08:00
benedikt-bartscher
d6e08e90a8
better computed var static deps (#4729)
* better computed var static deps

* typing and usability improvements for computed var static dependencies
2025-02-03 09:34:12 -08:00
benedikt-bartscher
2b7e4d6b4e
improve rx.Field ObjectVar typing for sqlalchemy and dataclasses (#4728)
* improve rx.Field ObjectVar typing for sqlalchemy and dataclasses

* enable parametrized objectvar tests for sqlamodel and dataclass

* improve typing for ObjectVars in ArrayVars

* ruffing

* drop duplicate objectvar import

* remove redundant overload

* allow optional hints in rx.Field annotations to resolve to the correct var type
2025-02-03 09:33:22 -08:00
Khaleel Al-Adhami
15da4e17bd
fix optional wrapping of static call methods in pyi (#4727) 2025-02-03 09:31:32 -08:00
Alek Petuskey
68547dce4c
Remove upper pin (#4684)
Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2025-01-31 19:22:00 -08:00
Khaleel Al-Adhami
238b03a8c7
disable react strict mode for event loop (#4720)
* disable react strict mode for event loop

* oops

* pyi oui

* separate socket connection from event loop

* prettier state.js

* disable react strict mode

* didn't work sadge

* socket connect/disconnect depends on new isBackendDisabled state

* only start the event loop when the socket is set or we're not stateful

* Always drain the queue unless backend is disabled

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2025-01-31 18:36:35 -08:00
Thomas Brandého
83e635de0e
bump ruff version to 0.9.3 (#4705)
* bump ruff version to 0.9.3

* relock poetry file

* poetry relock

* ignore RUF008 for now

* pass pre-commit

* update-pyi-files: require_serial to avoid mp explosion

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2025-01-31 17:20:51 -08:00
Khaleel Al-Adhami
3cb4443128
add evaluate time to the progress counter (#4722) 2025-01-31 16:43:05 -08:00
Khaleel Al-Adhami
80a26b440d
include dynamic imports for custom components (#4725) 2025-01-31 16:42:55 -08:00
Masen Furer
a2243190ff
[ENG-4326] Async ComputedVar (#4711)
* WiP

* Save the var from get_var_name

* flatten StateManagerRedis.get_state algorithm

simplify fetching of states and avoid repeatedly fetching the same state

* Get all the states in a single redis round-trip

* update docstrings in StateManagerRedis

* Move computed var dep tracking to separate module

* Fix pre-commit issues

* ComputedVar.add_dependency: explicitly dependency declaration

Allow var dependencies to be added at runtime, for example, when defining a
ComponentState that depends on vars that cannot be known statically.

Fix more pyright issues.

* Fix/ignore more pyright issues from recent merge

* handle cleaning out _potentially_dirty_states on reload

* ignore accessed attributes missing on state class

these might be added dynamically later in which case we recompute the
dependency tracking dicts... if not, they'll blow up anyway at runtime.

* fix playwright tests, which insist on running an asyncio loop

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2025-01-31 16:33:30 -08:00
Khaleel Al-Adhami
7da5fa0e5c
implement a global var cache (#4691)
* implement a global var cache

* fix misisng types

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2025-01-31 14:28:04 -08:00
Khaleel Al-Adhami
8663dbcb97
improve var base typing (#4718)
* improve var base typing

* fix pyi

* dang it darglint

* drain _process in tests

* fixes #4576

* dang it darglint
2025-01-31 13:12:33 -08:00
Khaleel Al-Adhami
12a42b6c47
var_data fixes with hooks values (#4717)
* var_data fixes with hooks values

* remove the raise error
2025-01-31 13:07:51 -08:00
Khaleel Al-Adhami
335816cbf7
add backend disabled dialog (#4715)
* add backend disabled dialog

* pyi that guy

* pyi the other guy

* extend test_connection_banner to also test the cloud banner

* oops, need asyncio _inside_ the app

* Update reflex/components/core/banner.py

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

* use universal cookies

* fix pre-commit

* revert universal cookie 🍪

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2025-01-31 13:00:56 -08:00
Khaleel Al-Adhami
6231f82248
add codspeed (#4707)
* add codspeed

* add codspeed to dev deps

* poetry.lock: relock deps, no update

* add poetry run

* only compile components

* at least have something

* fix hash

* dang it darglint

* uwu

* test sorting algorithms

* test sort

* sad

* revert that guy

* add test_evaluate

* it's ruff out there

* delete test_sort

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2025-01-31 11:39:19 -08:00
Masen Furer
fc16bed7ca
Handle python range passed to rx.Var.create (#4716)
* Handle python `range` passed to rx.Var.create

Fix the range function to use Math.ceil to handle jagged steps.

Update test cases.

* Set ToVarOperation.__qualname__ for better repr
2025-01-31 11:21:51 -08:00
Thomas Brandého
87d93b33b8
followup for merge style PR (#4721) 2025-01-31 11:17:46 -08:00
Khaleel Al-Adhami
12bda1d4f5
make all triggers disable recurisve memoization (#4719) 2025-01-31 11:15:42 -08:00
Khaleel Al-Adhami
2c3257d4ea
fix tag render to be recursive (#4714) 2025-01-29 12:16:54 -08:00
Khaleel Al-Adhami
1e8e82ec0e
allow functools partial with foreach (#4709) 2025-01-28 23:03:22 -08:00
Khaleel Al-Adhami
58e63f387f
assert that .render returns jsonable values (#4708)
* assert that .render returns jsonable values

* render component default
2025-01-28 23:02:14 -08:00
Khaleel Al-Adhami
5beea25b31
improve var create typing (#4701) 2025-01-28 22:56:38 -08:00
Thomas Brandého
58f87a6aa7
only allow item inside root (#4697) 2025-01-28 22:54:23 -08:00
Thomas Brandého
96ead07606
fix padding style in textarea (#4696) 2025-01-28 22:53:40 -08:00
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
2a922214a2
improve error message for failed compile_state (#4702) 2025-01-28 16:07:53 -08:00