Commit Graph

1966 Commits

Author SHA1 Message Date
Benedikt Bartscher
f94328f74f
delete unused function, add cleanup fixture for test_is_prod_mode 2024-11-06 23:58:01 +01:00
Benedikt Bartscher
46fefcf58c
Merge remote-tracking branch 'upstream/main' into minify-state-names-v2 2024-11-06 23:11:41 +01:00
Thomas Brandého
4c0b49135b
stop ignoring some lint rules (#4311)
* bump python packages version

* stop ignoring some lint rules that pass ruff check

* stop ignoring rule F541

* remove sneaky test file
2024-11-06 13:32:31 -08:00
Khaleel Al-Adhami
6ea797d0cd
pin marked to correct version (#4313)
* pin marked to correct version

* remove it completely?

* missing quotations

* match against reflex
2024-11-06 11:28:08 -08:00
Carlos
8a4701143e
add toast classname prop (#4310) 2024-11-06 09:49:09 -08:00
Thomas Brandého
54b081c104
allow custom bunfig.toml file (#4280)
* allow custom bunfig.toml file

* always copy custom bunfig

* split tests into half

* forgot a space

* use different syntax

* also split node latest check

* turn off failfast for app harness

---------

Co-authored-by: Khaleel Al-Adhami <khaleel.aladhami@gmail.com>
2024-11-06 09:31:13 -08:00
Simon Young
8d5187432f
add codeowners (#4312)
Co-authored-by: simon <simon@reflex.dev>
2024-11-06 09:30:43 -08:00
Khaleel Al-Adhami
c57d496184
improve typing for non decorated events (#4308)
* improve typing for non decorated events

* fix any typing
2024-11-06 09:21:19 -08:00
Khaleel Al-Adhami
bfa7ca639f
better missing system package message (#4306)
* better missing system package message

* change error type
2024-11-06 09:21:04 -08:00
Khaleel Al-Adhami
6334cfab0d
allow for event handlers to ignore args (#4282)
* allow for event handlers to ignore args

* use a constant

* dang it darglint

* forgor

* keep the tests but move them to valid place
2024-11-06 09:20:37 -08:00
simon
d9ab3a0f1c Revert "add v1 support"
This reverts commit c216eeafeb.
2024-11-05 18:28:16 -08:00
simon
c216eeafeb add v1 support 2024-11-05 18:23:18 -08:00
Benedikt Bartscher
24caf5fef1
cleanup unnecessary or False 2024-11-06 01:32:12 +01:00
Benedikt Bartscher
bcd0cf824d
Merge remote-tracking branch 'upstream/main' into minify-state-names-v2 2024-11-06 00:46:11 +01:00
Carlos
01e3844ac4
default props comment for GraphinTooltip (#4101)
* default props comment for GraphinTooltip

* update
2024-11-05 14:03:07 -08:00
Benedikt Bartscher
84c14a189f
cleanup conflicts 2024-11-05 22:35:47 +01:00
Benedikt Bartscher
4116ab9f66
do not set appharness env twice, already done in AppHarnessProd 2024-11-05 22:34:59 +01:00
Benedikt Bartscher
d32604713c
implement default_factory for EnvVar, improve env_var typing
also migrate environment to be a class singleton to prevent unintended chaos with default factories
2024-11-05 12:53:17 -08:00
Masen Furer
db2b5b0320
AppHarness: handle get_state_name for minified names
Also clear the StatefulComponent cache between AppInstance runs
2024-11-05 12:53:17 -08:00
Masen Furer
6eb808ca2c
state.js: more reliable isStateful detection 2024-11-05 12:53:17 -08:00
Masen Furer
4bbd988411
test_minified_states: remove skip -- things seem to be working as-is 2024-11-05 12:53:16 -08:00
Benedikt Bartscher
f163d41563
pass constants via js consts to state.js 2024-11-05 12:53:16 -08:00
Benedikt Bartscher
c26d626bf2
Revert "move state.js to jinja, related to #3738"
This reverts commit 4d2a72c4e86be3c8466cc701daf173ea70cba90d.
2024-11-05 12:53:16 -08:00
Benedikt Bartscher
79fc10957d
move state.js to jinja, related to #3738 2024-11-05 12:53:16 -08:00
Benedikt Bartscher
4e76e4d6ac
fix type ignore comment 2024-11-05 12:53:16 -08:00
Benedikt Bartscher
dadfb5663a
wip: more dynamic jinja contexts, tests for minification 2024-11-05 12:53:16 -08:00
Benedikt Bartscher
215a8343f4
wip minified state integration test 2024-11-05 12:53:15 -08:00
Benedikt Bartscher
7287c3a167
fix typo 2024-11-05 12:53:15 -08:00
Benedikt Bartscher
e9cedd2a92
fix default state names 2024-11-05 12:53:15 -08:00
Benedikt Bartscher
7bf15b4f44
add simple test that minified state names are unique 2024-11-05 12:53:15 -08:00
Benedikt Bartscher
51aef9fd22
enable minified state names by default in prod 2024-11-05 12:53:15 -08:00
Benedikt Bartscher
8fc8fd9ec7
fix state name init for substates, thanks @masenf 2024-11-05 12:53:14 -08:00
Benedikt Bartscher
bae98e80ed
fix hardcoded event handlers and states 2024-11-05 12:53:14 -08:00
Benedikt Bartscher
1b0577a7e1
all _state_names should be classvars 2024-11-05 12:53:14 -08:00
Benedikt Bartscher
0c406f4bac
cleanup 2024-11-05 12:53:14 -08:00
Benedikt Bartscher
673c488dc0
wip minified state names 2024-11-05 12:53:13 -08:00
benedikt-bartscher
4a6c16e9dc
More env var cleanup (#4248)
* fix and test bug in config env loading

* streamline env var interpretation with @adhami3310

* improve error messages, fix invalid value for TELEMETRY_ENABLED

* just a small hint

* ruffing

* fix typo from review

* refactor - ruff broke the imports..

* cleanup imports

* more

* add internal and enum env var support

* ruff cleanup

* more global imports

* revert telemetry, it lives in rx.Config

* minor fixes/cleanup

* i missed some refs

* fix darglint

* reload config is internal

* fix EnvVar name

* add test for EnvVar + minor typing improvement

* bool tests

* was this broken?

* retain old behavior

* migrate APP_HARNESS_HEADLESS to new env var system

* migrate more APP_HARNESS env vars to new config system

* migrate SCREENSHOT_DIR to new env var system

* refactor EnvVar.get to be a method

* readd deleted functions and deprecate them

* improve EnvVar api, cleanup RELOAD_CONFIG question

* move is_prod_mode back to where it was
2024-11-05 12:25:13 -08:00
Thomas Brandého
1c4f410052
bump python packages version (#4302) 2024-11-05 10:50:43 -08:00
Thomas Brandého
ce22ca5f71
rollback to 14.2.16 until v15 is more stable (#4297) 2024-11-05 10:50:32 -08:00
Khaleel Al-Adhami
b5d1e03de1
improve object var symantics (#4290)
* improve object var symantics

* add case for serializers

* check against serializer with to = dict

* add tests

* fix typing issues

* remove default value

* older version of python doesn't have assert type

* add base to rx field cases

* get it from typing_extension
2024-11-05 09:56:10 -08:00
Thomas Brandého
0ed7c5d969
expose rx.get_state() to get instance of state from anywhere (#3959)
* expose rx.get_state() to get instance of state from anywhere

* fix circular import and add read-only proxy
2024-11-05 16:21:59 +01:00
abulvenz
bb903b605a
Fix wrong hook (#4295)
* fix: Typo in variable name.

* fix: Using existing hook constant.

---------

Co-authored-by: Benedikt Bartscher <bb@senbax.de>
2024-11-04 15:20:02 -08:00
Khaleel Al-Adhami
1122cbf0b1
handle none case in state setattr (#4301) 2024-11-04 14:37:58 -08:00
benedikt-bartscher
b3c199870e
bypass pydantic runtime validation for state init (#4256)
* bypass pydantic runtime validation for state init
closes #4235

* cleanup
2024-11-04 13:05:39 -08:00
graham
702808afa6
Bugfix/leave gitignore as is (#4291)
* Refactor initialize_gitignore to support list type for files_to_ignore and improve current ignore handling.  Dont sort the gitignore file.

* more consistent list comprehension var
2024-11-04 11:36:12 -08:00
Khaleel Al-Adhami
51b0f7d28e
special case field in _isinstance (#4298) 2024-11-04 11:06:24 -08:00
Khaleel Al-Adhami
16ed266d11
move check of path to only check name (#4299)
* move check of path to only check name

* assert .name in other tests as well

* get even more ones
2024-11-04 11:01:14 -08:00
Khaleel Al-Adhami
ca81e623db
add noop event (#4288)
* add noop event

* fix pyi

* get it right pyright

* why

* remove silly events

* fix tests

* remove semi colon

* errors in merging
2024-11-04 10:33:07 -08:00
Khaleel Al-Adhami
6394a6dfc5
raise error when get package manager is not found (#4289)
* raise error when get package manager is not found

* add escape hatch

* handle installing frontend packages more gracefully

* fix no return

* dang it darglint
2024-11-04 10:31:24 -08:00
Masen Furer
163acf70a2
[ENG-759] [ENG-1104] patch json.dumps to handle __wrapped__ objects (#4166)
* [ENG-1104] patch `json.dumps` to handle `__wrapped__` objects

Unwrap proxied objects if the default serializer doesn't work.

* pre-commit fixup

* Skip default fallback logic when `cls` is specified

`cls` will provide its own default serialization mechanism, passing a `cls`
Encoder class is now also a way to opt-out of our patching shenanigans and just
use your own code.

This will work, provided the library doing the JSON encoding isn't also using
their own custom class.

* Override JSONEncoder.default instead of json.dumps

Many libraries (like httpx, used by openai), will use `from json import dumps`,
and if they do that before `reflex.state` gets imported, then they will get the
original dumps function instead of our patched one.

To workaround this, monkeypatch the `JSONEncoder.default` function instead.

This is also nicer behavior for custom subclasses of JSONEncoder; if someone
wants to opt-out of our monkeypatching, they can simply not call
`super().default(o)` in their subclass, which by default only raises a
TypeError.

---------

Co-authored-by: Nikhil Rao <nikhil@reflex.dev>
2024-11-04 10:11:51 -08:00