Commit Graph

2224 Commits

Author SHA1 Message Date
benedikt-bartscher
a5486335a3
rx._x.asset improvements (#3624)
* wip rx._x.asset improvements

* only add symlink if it doesn't already exist

* minor improvements, add more tests

* use deprecated Generator for python3.8 support

* improve docstring

* only allow explicit shared, only validate local assets if not backend_only

* fix darglint

* allow setting backend only env to false.

* use new is_backend_only in assets

* ruffing

* Move to `rx.asset`, retain old API in `rx._x.asset`

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-21 17:16:43 -08:00
Masen Furer
a6b324bd3e
[ENG-3953] Support pydantic BaseModel (v1 and v2) as state var (#4338)
* [ENG-3953] Support pydantic BaseModel (v1 and v2) as state var

Provide serializers and mutable proxy tracking for pydantic models directly.

* conditionally define v2 serializer

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>

* Add `MutableProxy._is_mutable_value` to avoid duplicate logic

* Conditionally import BaseModel to handle older pydantic v1 versions

* pre-commit fu

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-11-21 17:01:14 -08:00
Elijah Ahianyo
5702a18502
[GTM-836]Rework Init workflow (#4377)
* Rework Init workflow

* minor format

* refactor

* add comments

* fix pyright alongside some improvements

* add demolink for blank template

* fix darglint

* Add more templates and keep template name in kebab case

* revert getting other templates since we'll use the submodules approach

* remove debug statement

* Improvements based on standup comments

* Add redirect logic

* changes based on new flow

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-21 16:58:12 -08:00
Elijah Ahianyo
9faa5d6fd9
Downgrade syntax highlighter to fix wrapLongLines (#4368) 2024-11-21 16:54:15 -08:00
benedikt-bartscher
c13cec3d8a
implement performance mode for existing state size check (#4392) 2024-11-21 16:33:47 -08:00
Masen Furer
b5e4b02d9c
New Event Action: temporal (#4404)
When an event/event spec is marked as "temporal", it will not be queued unless
the backend is up. This can be used to prevent periodic events (like from
`rx.moment`) from queueing up while the backend is down, and then stampeding
when the backend comes up and the queue is drained. It can be used to avoid
processing many periodic events at once when the app is only expecting to
process such an event every so often.
2024-11-21 16:32:38 -08:00
Masen Furer
bbfbc82c9d
Handle Var passed to rx.toast (#4405)
* Handle Var passed to `rx.toast`

If the user provides a `Var` for `message` then apply it as `props["title"]` to
avoid a var operations error.

* remove unnecessary parentheses

* remove weird hacks

* get it right pyright

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-11-21 16:15:01 -08:00
Thomas Brandého
d4b197b517
fix for event handlers in py3.9 (#4416) 2024-11-21 12:41:48 -08:00
benedikt-bartscher
e0984aa834
Allow bound method as event handler (#4348)
* subtract 1 arg if the method is a bound method

* fix it early in user_args

* only bound methods pls

* add test
2024-11-21 11:53:50 -08:00
benedikt-bartscher
ecb52651c3
allow to disable checking for the latest package version via env (#4407) 2024-11-21 11:06:47 -08:00
Thomas Brandého
095c1e5b7f
remove deprecation for these events (#4415) 2024-11-21 11:05:02 -08:00
Masen Furer
05956c84a7
protect sys.path manipulation with a mutex (#4408)
Compiling pages in separate threads can result in `sys.path` being cleared,
which breaks subsequent imports.
2024-11-21 10:29:40 -08:00
Masen Furer
81583d45ca
[HOS-313] state.js: when a routing error occurs, delete it (#4410)
In some cases, a routing failure can cause the failure to be cached. When the
router has a cached failure, pushing such a route will never call
routeChangeComplete, and thus on_load event will never be fired for that route.

Purposely clearing the error from the router allows the page to properly load
on subsequent attempts without refreshing the app.
2024-11-21 10:27:44 -08:00
Masen Furer
4571524e1c
[ENG-4130] Disable typer/rich integration appropriately (#4412)
The `rich` module should be set to `None`, indicating that rich should not be used.

Setting it to `False` worked before, but recently added code in typer fails
when checking `if rich is not None`.

ref: https://github.com/fastapi/typer/pull/847
2024-11-21 13:11:34 +01:00
Thomas Brandého
681b616000
fix appearance broken by #3812 (#4403)
* fix appearance broken by #3812

* fix again to pass tests
2024-11-20 11:12:52 -08:00
Khaleel Al-Adhami
229df1ce09
ignore rxconfig not in cwd (#4398)
* ignore rxconfig not in cwd

* no type ignore

* resolve paths

* Remove rxconfig module from sys.modules cache when reloading

* modify sys path

* add try except

* refactor inner function

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-19 16:46:55 -08:00
Masen Furer
67296d43c0
Don't skip serialization when Var is callable (#4399) 2024-11-19 16:33:27 -08:00
Alek Petuskey
bffff01acb
Add datetime to moment (#4381)
* Add datetime to moment

* Remove recharts update

* Support other formats

* simplify

* Precommit

* PYI

* change imports for pyi compat

---------

Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-19 09:29:11 -08:00
Khaleel Al-Adhami
bcea79cd45
add typed dict type checking (#4340)
* add typed dict type checking

* technically it has to be a mapping, not specifically a dict
2024-11-18 19:28:38 -08:00
benedikt-bartscher
1f9a17539c
fix: do not allow instantiation of State mixins (#4347)
* fix: do not allow instantiation of State mixins
Closes #4343

* improve error message for ComponentState mixins

* fix typo

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

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-18 19:15:01 -08:00
Thomas Brandého
af4fe48428
[maintenance] bump some packages versions (#4385)
* bump some versions

* update ruff to 0.7.4

* bump tailwind version

* relock deps

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-11-18 18:56:28 -08:00
Thomas Brandého
adaf49e4f9
make list suggestions work in rx.input (#4391)
* make list suggestions work

* fix pyi
2024-11-18 18:22:01 -08:00
Khaleel Al-Adhami
22329e592e
add debug statement to evaluate page (#4396) 2024-11-18 18:21:45 -08:00
Simon Young
3f58ceef95
update cli version (#4394)
Co-authored-by: simon <simon@reflex.dev>
2024-11-18 16:59:54 -08:00
Masen Furer
6494683c27
Fix ternary logic when printing template name (#4393) 2024-11-19 00:11:04 +01:00
Masen Furer
34c11fdf10
require typing_extensions >= 4.6.0 (#4373)
* require typing_extensions >= 4.6.0

TypeAliasType was added in 4.6

https://github.com/python/typing_extensions/blob/main/CHANGELOG.md#release-460-may-22-2023

* update lock file, even though nothing has changed
2024-11-18 10:31:11 -08:00
Khaleel Al-Adhami
2e1bc057a4 aaaaa 2024-11-15 17:39:14 -08:00
Khaleel Al-Adhami
2b05ee98ed make it handle slice 2024-11-15 17:30:45 -08:00
Khaleel Al-Adhami
ed1ae0d3a2 add missing return 2024-11-15 17:15:43 -08:00
Khaleel Al-Adhami
7d0a4f7133 make safe issubclass 2024-11-15 17:12:42 -08:00
Khaleel Al-Adhami
079cc56f59 more types 2024-11-15 16:59:28 -08:00
benedikt-bartscher
dc347d10b3
fix: Failed to CreateArtifact (#4339) 2024-11-15 16:27:05 -08:00
Khaleel Al-Adhami
92b1232806 would this fix it? no clue 2024-11-15 16:16:13 -08:00
Khaleel Al-Adhami
7f1dc7c841 remove .bool 2024-11-15 15:58:03 -08:00
Khaleel Al-Adhami
eac54d60d2 call guess type 2024-11-15 15:54:04 -08:00
Khaleel Al-Adhami
702670ff26 add components to var data 2024-11-15 15:47:46 -08:00
Khaleel Al-Adhami
88cfb3b7e2 handle var at top level 2024-11-15 15:11:44 -08:00
Khaleel Al-Adhami
53b98543cc default factory 2024-11-15 14:58:19 -08:00
Khaleel Al-Adhami
5f0546f32e what am i doing anymore 2024-11-15 14:53:51 -08:00
Thomas Brandého
e45b76c01e
fix noSSRComponent imports (#4386) 2024-11-15 21:43:55 +01:00
Khaleel Al-Adhami
2c04153013 special case ellipsis types 2024-11-14 09:45:44 -08:00
Alek Petuskey
79a5409a8e
Update bug_report.md (#4382) 2024-11-13 20:42:29 -08:00
Khaleel Al-Adhami
a9db61b371 get it right pyright 2024-11-13 19:03:42 -08:00
Khaleel Al-Adhami
3cdd2097b6 fix pyright issues outside of vars 2024-11-13 18:43:20 -08:00
Khaleel Al-Adhami
9d7e353ed3 fix pyright issues 2024-11-13 18:40:06 -08:00
Khaleel Al-Adhami
f4aa1f58c3 implement type computers 2024-11-13 18:17:53 -08:00
Khaleel Al-Adhami
ebc81811c0 fix silly mistakes 2024-11-13 13:51:47 -08:00
Khaleel Al-Adhami
1e9743dcd6 Merge branch 'main' into add-validation-to-function-vars 2024-11-13 13:23:38 -08:00
Khaleel Al-Adhami
05bd41c040 add validation 2024-11-13 13:22:01 -08:00
Elijah Ahianyo
853a9d8614
Add template name to reflex init success msg (#4349)
* Add template name to reflex init success msg

* fix pyright message
2024-11-13 10:24:36 +00:00