Commit Graph

1869 Commits

Author SHA1 Message Date
Thomas Brandého
13591793de
move client storage classes to their own file (#4216)
* move client storage classes to their own file

* fix 3.9 annotations
2024-10-22 21:17:31 +02:00
Thomas Brandého
0aca89781f
bump ruff to 0.7.0 (#4213)
* bump ruff to 0.7.0

* ignore SIM115 and reverse change for it
2024-10-22 20:48:47 +02:00
Simon Young
993bfaef2d
HOS-92: added max-request support to gunicorn (#4217)
Co-authored-by: simon <simon@reflex.dev>
2024-10-22 11:32:13 -07:00
Elijah Ahianyo
d63b3a2bce
[ENG-3848][ENG-3861]Shiki Code block Experimental (#4030)
* Shiki Code block Experimental

* refactor

* update code

* remove console.log

* add transformers to namespace

* some validations

* fix components paths

* fix ruff

* add a high-level component

* fix mapping

* fix mapping

* python 3.9+

* see if this fixes the tests

* fix pyi and annotations

* minimal update of theme and language map

* add hack for reflex-web/flexdown

* unit test file commit

* [ENG-3895] [ENG-3896] Update styling for shiki code block

* strip transformer triggers

* minor refactor

* linter

* fix pyright

* pyi fix

* add unit tests

* sneaky pyright ignore

* the transformer trigger regex should remove the language comment character

* minor refactor

* fix silly mistake

* component mapping in markdown should use the first child for codeblock

* use ternary operator in numbers.py, move code block args to class for docs discoverability

* precommit

* pyright fix

* remove id on copy button animation

* pyright fix for real

* pyi fix

* pyi fix fr

* check if svg exists

* copy event chain

* do a concatenation instead of first child

* added comment

---------

Co-authored-by: Carlos <cutillascarlos@gmail.com>
2024-10-22 17:01:34 +00:00
Khaleel Al-Adhami
c103ab5e28
Add type hinting to dataeditor events (#4210) 2024-10-21 18:53:51 -07:00
Khaleel Al-Adhami
3ab750fecd
add event types to suneditor (#4209) 2024-10-21 18:17:27 -07:00
Khaleel Al-Adhami
45959881ac
add type hinting to error boundary (#4182)
* add type hinting to error boundary

* remove logFrontendError

* fix other calls to handle_frontend_exception
2024-10-21 18:17:06 -07:00
Khaleel Al-Adhami
54ad9f0f4b
make var system expandable (#4175)
* make var system expandable

* use old syntax

* remove newer features

* that's a weird error

* remove unnecessary error message

* remove hacky getattr as it's no longer necessary

* improve color handling

* get it right pyright

* dang it darglint

* fix prototype to string

* don't try twice

* adjust test case

* add test for var alpha

* change place of type ignore

* fix json

* add name to custom var operation

* don't delete that you silly

* change logic

* remove extra word
2024-10-21 17:05:13 -07:00
Khaleel Al-Adhami
f39e8c9667
move all environment variables to the same place (#4192)
* move all environment variables to the same place

* reorder things around

* move more variables to environment

* remove cyclical imports

* forgot default value for field

* for some reason type hints aren't being interpreted

* put the field type *before* not after

* make it get

* move a bit more

* add more fields

* move reflex dir

* add return

* put things somewhere else

* add custom error
2024-10-21 13:28:55 -07:00
Masen Furer
c05da488f9
Raise TypeError when ComputedVar.__init__ gets bad kwargs (#4199)
It's easy to mis-spell `rx.var(cached=True)` instead of `rx.var(cache=True)`,
and in 0.6.3, this doesn't actual raise an error... the bad value is silently
discarded and the var is NOT marked as being cached.
2024-10-21 12:56:56 -07:00
Thomas Brandého
7168b42bab
versions bump before 0.6.4 (#4208) 2024-10-21 12:56:36 -07:00
benedikt-bartscher
7560bf6429
allow setting run mode via env, add helpers to determine it (#4168) 2024-10-21 12:26:09 -07:00
Khaleel Al-Adhami
fcc97b0402
upgrade node to latest lts (#4191) 2024-10-21 12:11:00 -07:00
Masen Furer
6cb87a812f
Fix runtime error on python 3.11.0 (#4197)
All generic types present in a Union must be parametrized on 3.11.0 if any
other generic types in the union are parametrized.

This appears to be a bug in 3.11.0, as the behavior is not observed in 3.11.1
or 3.10; fixing here as this is technically more correct anyway and avoids a
crash.
2024-10-17 19:21:43 -07:00
Masen Furer
330c280c78
When REDIS_URL is set, use redis, regardless of config preference. (#4196)
We might change this down the road, but we don't want to introduce a breaking
change at this time.
2024-10-17 16:54:36 -07:00
Masen Furer
e14c79d57d
[ENG-3954] Treat ArrayVar.foreach index as int (#4193)
* [ENG-3954] Treat ArrayVar.foreach index as int

* foreach: convert return value to a Var

When the value returned from the foreach is not hashable (mutable type), then
it will raise an exception if it is not first converted to a LiteralVar.
2024-10-17 16:16:24 -07:00
Khaleel Al-Adhami
101fb1b540
check for none before returning which (#4187) 2024-10-16 15:21:47 -07:00
Khaleel Al-Adhami
35810fe1bd
use larger or equal for node version check (#4189) 2024-10-16 15:20:51 -07:00
Khaleel Al-Adhami
d8ea2fc795
fix pyi for untyped event handlers (#4186)
* fix pyi for untyped event handlers

* no more empty lambdas
2024-10-16 13:39:49 -07:00
Alek Petuskey
13c9094343
Remove demo command (#4176)
* Remove demo command

* Format

---------

Co-authored-by: Alek Petuskey <alekpetuskey@Aleks-MacBook-Pro.local>
2024-10-16 11:35:56 -07:00
Masen Furer
da9d7eabdd
Arbitrary arg access two levels deep for untyped handler (#4180)
* Arbitrary arg access two levels deep for untyped handler

Provide drop-in compatibility with existing component wrapping code
that was accessing attributes on the default handler arg type.

* py3.9 compat
2024-10-16 11:35:27 -07:00
Masen Furer
4422515f4b
LiteralEventChainVar becomes an ArgsFunctionOperation (#4174)
* LiteralEventChainVar becomes an ArgsFunctionOperation

Instead of using the ArgsFunctionOperation to create the string representation
of the _js_expr, make the identity of the var an ArgsFunctionOperation so the
_args_names and _return_expr remain accessible.

Rely on the default behavior of ArgsFunctionOperation to create the
_cached_var_name / _js_expr value.

This allows the compat shim in `format_event_chain` to remain functional, as it
does special handling for ArgsFunctionOperation to retain the previous behavior
of that function (this was a regression introduced in 0.6.2).

* _var_type is EventChain; fix parent class order

* Re-fix LiteralEventChainVar inheritence list w/ comment

* [ENG-3942] LiteralEventVar becomes VarCallOperation

instead of using `.call` when constructing the `_js_expr`, have the identity of
a LiteralEventVar as a VarCallOperation to take advantage of the _var_data
carrying.

* add event overlords

* EventCallback descriptor always returns EventSpec from class

Relax actual `__get__` definition to support the multitude of overloads

* test case for event related vars carrying _var_data

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-10-16 11:35:09 -07:00
Khaleel Al-Adhami
7565ae15ef
disk is memory is disk (#4185) 2024-10-16 11:31:05 -07:00
Khaleel Al-Adhami
2018be8e08
only treat dict object vars as key value mapping (#4177) 2024-10-15 12:21:03 -07:00
Masen Furer
5b802c2c9e
bump version to 0.6.4dev1 for further development (#4178) 2024-10-15 10:54:14 -07:00
Masen Furer
3a14025999
pin AppHarness tests to ubuntu-22.04 runner (#4173) 2024-10-14 15:36:30 -07:00
Manoj Bhat
d6797a1f1d
Change the defalut direction of radio group (#4070). (#4146)
- The default direction of radio groups is column.
- Since most use cases are horizontal, change the default direction from
  column to row.
2024-10-14 08:47:38 -07:00
Masen Furer
1d268f8b13
Support aria and data props (#4149)
* Support aria and data props

* Fix busted docstring

* Ignore special_attributes logic for defined props

* simplify special attribute checking logic

avoid special cases in the special case handling code 🙄
2024-10-14 08:45:25 -07:00
Khaleel Al-Adhami
b2d2719f90
add type hinting to events (#4145)
* add type hinting to events

* fix pyi

* make it a list

* add on change

* dang it darglintz

* add future annotations

* add try except becuse i hate this

* add check for class

* aaaa

* sometimes you need to make hard decisions

* ono

* i hate unions

* add rx event

* move stuff around

* maybe

* special case osmething

* i don't need no test

* remove stray print

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

* remove another stray print

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

* add rx event

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-10-14 08:44:31 -07:00
Khaleel Al-Adhami
b1d449897a
unionize base var fields types (#4153)
* unionize base var fields types

* add tests

* fix union types for vars (#4152)

* remove 3.11 special casing

* special case on version

* fix old versions of python

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-10-11 17:27:15 -07:00
benedikt-bartscher
0889276e24
Do not auto-determine generic args if already supplied (#4148)
* add failing test for figure_out_type

* do not auto-determine generic args if already supplied

* move has_args to utils.types, add tests for it
2024-10-11 17:08:39 -07:00
Masen Furer
736b2a6ea9
Handle rx.State subclasses defined in function (#4129)
* Handle rx.State subclasses defined in function

* create a new container module: `reflex.istate.dynamic` to save references to
  dynamically generated substates.
* for substates with `<locals>` in the name, copy these to the container module
  and update the name to avoid duplication.
* add test for "poor man" ComponentState

Fix #4128

* test_state: disable local def handling for dupe-detection test

* Track the original module and name for type hint evaluation

Also use the original name when checking for the "mangled name" pattern when
doing undeclared Var assignment checking.
2024-10-11 16:51:10 -07:00
Masen Furer
a2862bd102
Allow setting a different invocation function for EventChain (#4160)
In rx.call_script scenario, the EventChain must call `queueEvents` and
`processEvent` instead of `addEvents`, because the former are in scope in the
call_script eval environment where `addEvents` is not.

This is an escape hatch for certain wrapping scenarios.
2024-10-11 16:49:40 -07:00
Khaleel Al-Adhami
0311dae568
only read if it's *not* empty (#4165) 2024-10-11 16:49:01 -07:00
Khaleel Al-Adhami
1eb92fa39b
change bun install link to main (#4164) 2024-10-11 15:51:30 -07: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
Khaleel Al-Adhami
210c1ed902
fix union types for vars (#4152) 2024-10-11 11:39:31 -07:00
Carlos
3da1a8d082
default props comment for Axis (#4109)
* default props comment for Axis

* update
2024-10-10 15:10:42 -07:00
Carlos
efd633e76a
default props comment for Pie (#4103) 2024-10-10 15:10:28 -07:00
Carlos
c3d7cd0da1
default props comment for PolarRadiusAxis (#4108)
* default props comment for PolarRadiusAxis

* update
2024-10-10 15:10:11 -07:00
Carlos
ec6990fb71
default props comment for RadialBar (#4105)
* default props comment for RadialBar

* update
2024-10-10 13:04:49 -07:00
Carlos
ee3182a2df
default props comment for Cartesian (#4114)
* default props comment for Cartesian

* add animation events

* update
2024-10-10 13:00:23 -07:00
Carlos
4a314394fd
default props comment for ErrorBar (#4120)
* default props comment for ErrorBar

* union int float

* update
2024-10-10 12:59:38 -07:00
Carlos
132a3d4d1d
default props comment for Funnel (#4119)
* default props comment for Funnel

* update
2024-10-10 12:58:38 -07:00
Carlos
11abaf8055
default props comment for Grid (#4125) 2024-10-10 12:57:46 -07:00
Thomas Brandého
6f586c8b8f
let users pick state manager mode (#4041) 2024-10-10 12:22:35 -07:00
benedikt-bartscher
1aed39a848
catch ValueError("I/O operation on closed file.") if frontend crashes (#4150) 2024-10-10 12:18:57 -07:00
Khaleel Al-Adhami
8ec3cf6157
remove dictify from state dict (#4141) 2024-10-10 12:18:18 -07:00
abulvenz
87648af3ee
fix: Determine var type from value. (#4143) 2024-10-09 17:33:34 -07:00
benedikt-bartscher
7a971e5842
fix docstring (#4140) 2024-10-09 13:42:44 -07:00