Commit Graph

1250 Commits

Author SHA1 Message Date
Benedikt Bartscher
b565e8934a
dict -> model_dump and field_info fixes 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
b65c34b212
update_forward_refs -> model_rebuild 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
45cb36f59a
pydantic copy is deprecated in favor of model_copy 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
37c360e786
fix init_subclass for pydantic v2, add some missing type hints, format black 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
80f02753ba
add some missing type hints to test state vars 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
4380cd266d
fix pydantic _get_value for MutableProxy 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
7789118af3
prevent calling __bool__ for is_hydrated 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
211f9f3598
fix auto-var conversion 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
78db90d695
forgot to migrate one type_ to annotation 2024-03-05 21:36:41 +01:00
Benedikt Bartscher
d0f15c591d
optionalize all Var props without defaults 2024-03-05 21:36:39 +01:00
Benedikt Bartscher
fd5a5b97f2
Bare.contents should be a Var 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
1c89f012b6
optionalize some Component props 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
6d3809efcb
ModelField doesn't exist in pydantic v2 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
8c7dd39f02
fix EventSpec args type annotation for pydantic v2 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
80a25d6b29
add missing type annotation for initialColorMode 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
4d497e0053
hacky workaround to allow __class_getitem__ with pydantic 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
1abc57c68b
fix default value for theme in ChakraProvider 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
5c584da4ef
add missing default values to icon and link 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
7f8a457d74
migrate to field.annotation and fix default var wrapping for undefined 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
c057f2e3f3
minor pydantic fixups 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
2def8b97e7
FieldInfo has no name anymore 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
faebd22185
black fixes 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
a5d197c2fb
serialization fixes 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
6291c39fd7
minor state fixes, and var serialization 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
fd32942eb4
parse_obj is deprecated in favor of model_validate 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
66f1e21576
fix backend vars 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
67c81489cf
migrate remaining __fields__ to model_fields 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
ce06bf0114
migrate config to pydantic v2 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
8b2d0b40bc
outer_type_ -> annotation 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
95f9b12829
types adjustments 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
8e692cd305
state adjustments 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
25d05856f9
prepare base 2024-03-05 21:35:53 +01:00
Benedikt Bartscher
0b4b7c0d12
bump reflex_hosting_cli, pydantic and fastapi deps 2024-03-05 21:35:52 +01:00
Masen Furer
c79719f7be
Expose on_drop event trigger for rx.upload component. (#2766)
* Expose `on_drop` event trigger for rx.upload component.

If `on_drop` is provided, it should be an EventSpec accepting the special
rx.upload_files() arg.

When `on_drop` is provided, it will be called immediately when files are
selected. The default functionality of saving a file list to be uploaded later
will not be available.

* update pyi file

* Undeprecate explicit EventChain
2024-03-05 12:07:36 -08:00
Masen Furer
75b63cbc25
[REF-2087] Better rx.progress styling integration with radix themes (#2762)
* [REF-2087] Better rx.progress styling integration with radix themes

Support the `radius` prop on `ProgressRoot`, via data-radius and CSS tokens

Support the `color_scheme` on `ProgressIndicator`, via data-accent-color and CSS token

Move high-level `Progress` to a real `Component` subclass to get better pyi hinting

Allow overriding the background color of the `ProgressIndicator` via low-level api

Remove `value` and `max` props from `ProgressRoot` (these only apply to `ProgressIndicator`)

* Progress: do not pass `value` or `max` to ProgressRoot

* progress: use background_color instead of background-color
2024-03-05 12:07:20 -08:00
Masen Furer
e4c32e3edf
Include app.Dockerfile for deploying to container hosting platform (#2784) 2024-03-05 09:28:32 -08:00
Masen Furer
fc190c8c8f
app_module_for_backend: wait for _compile in prod mode (#2760)
* Expose reflex.utils.exec.is_prod_mode

Formalize runtime checking of the app's `--env` parameter.

* app_module_for_backend: wait for _compile in prod mode

Prod mode uses separate worker processes that fork from the main process.

If the app is not fully compiled when the fork occurs, any further changes to
the app (like mounting the _upload endpoint) will not be reflected in the
workers. This is not a performance hit because compile is skipped anyway
for backend processes and hot reload is not in the picture for prod mode.

* remove _is_dev_mode and replace it with calls to is_prod_mode()

_is_dev_mode was a private function in the compiler, but now that utils.exec
exposes is_prod_mode, we should use that throughout for consistency
2024-03-04 16:50:31 -08:00
Martin Xu
02bedca32e
bump up httpx to >= 0.25.1 (Add support for Python 3.12) (#2782) 2024-03-04 16:38:55 -08:00
Masen Furer
e8faec708e
docker-example overhaul (#2690)
* docker-example overhaul

Update docker-example with a more realistic multi-compose deployment, and
also a more simplistic single-image deploy.

* Use `uv` for faster bootstrapping
* Separate simple and production-ready docker files
* Split compose.yaml into 3 parts
  * Persist sqlite db and tls keys
  * Include postgres and redis
  * Include Adminer and redis-commander for adminstration
  * Suppose upload persistence
* Update documentation
* Update Caddyfile for compatibility with new Upload API

* Simple Dockerfile: keep `reflex export --frontend-only`

Pre-pack the resulting image with npm dependencies to reduce startup time

* Simplify simple docker file to just use pip
2024-03-04 16:21:37 -08:00
Masen Furer
ebd84b39f8
Bump to 0.4.3 (#2780) 2024-03-04 14:49:52 -08:00
Masen Furer
4f12d2e269
Fix infinite recursion when a substate named "state" has a computed var (#2778)
* test_potentially_dirty_substates: when a state named State should be computed

Catch a regression introduced in 0.4.3a1

* _potentially_dirty_substates: qualify substate name

When looking up substate classes, ensure the qualified name is used to avoid
issues with same-named substates.
2024-03-04 13:13:08 -08:00
Masen Furer
9327bfaa71
Mark Upload.is_used when calling get_upload_url (#2765) 2024-03-03 19:47:17 -08:00
Pablo GS
bbb9253985
Solved Nodejs prerequisite check (#2767) 2024-03-03 19:47:05 -08:00
macmoritz
9e0452beb0
pass lang and custom_attrs from app to html root (#2697)
* pass lang and custom_attrs from app to html root

* fix some pre-commit errors and try adding lang

* fix tests

* really fix test

* cleanup with @benedikt-bartscher

* fix props and tests

* use str instead of var

* change typing of html_custom_attrs to not allow Vars
2024-03-03 13:51:20 -08:00
Martin Xu
5cb1f2007c
remove pipdeptree as reflex dep (#2763) 2024-03-03 09:55:21 -08:00
Frank Bold Society
ab6ebfc1a8
Update CSS padding in accordion.py (#2759)
Typo in default padding for AccordionContent.

"15px, 20px" lead to invalid CSS.

"15px 20px" is correct.
2024-03-01 12:32:44 -08:00
Yummy-Yums
7725c48fb7
Reconnection Logic (#2743)
* reconnection logic

* prettier state.js

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-02-29 16:21:35 -08:00
Tom Gotsman
93fc269860
initial attempt at writing test for urls (#2689)
* initial attempt at writing test for urls

* turn it into a pytest test

* fix precommit and add wrong url to make sure test work

* fix darglint error and fix url set error

* black error

* add to test .md files in reflex as well

* update to fix masen comment

* black formatting

* Fix trailing slash in reflex/state.py

---------

Co-authored-by: Tom Gotsman <tomgotsman@Toms-MacBook-Pro.local>
Co-authored-by: Tom Gotsman <tomgotsman@toms-mbp.lan>
Co-authored-by: Masen Furer <m_github@0x26.net>
2024-02-29 13:45:57 -08:00
wassaf shahzad
0a18eaa28b
DRAFT PR - Added code for computed backend vars (#2540)
* added code for computed backend vars

* fixed formatting issues

* fix small bug

* fixes ruff issue

* fixed black issue

* augment test for backend computed var

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-02-29 13:00:41 -08:00
Thomas Brandého
cc678e8648
add pulser for connection + adjust condition for connnection_modal (#2676)
* add pulser for connection + adjust condition for connnection_modal

* update style for connection pulser

* rename connectError to connectErrors

* resolve update bug of connectErrors

* fix pulse definition

* rollback pulse definition

* Define WifiOffPulse icon as its own component

Attach the pulse keyframes and imports to the icon itself so that the code gets
properly included in stateful_components.js when it is used.

* limit number of errors in memory

---------

Co-authored-by: Masen Furer <m_github@0x26.net>
2024-02-29 19:01:12 +01:00