reflex 0.8.15a1__py3-none-any.whl → 0.8.16__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of reflex might be problematic. Click here for more details.

Files changed (140) hide show
  1. reflex/.templates/web/utils/state.js +68 -8
  2. reflex/app.py +45 -51
  3. reflex/app_mixins/lifespan.py +12 -5
  4. reflex/base.py +1 -0
  5. reflex/compiler/compiler.py +4 -6
  6. reflex/compiler/templates.py +25 -31
  7. reflex/compiler/utils.py +6 -5
  8. reflex/components/base/body.pyi +1 -195
  9. reflex/components/base/link.pyi +1 -407
  10. reflex/components/base/meta.pyi +1 -405
  11. reflex/components/base/script.pyi +1 -237
  12. reflex/components/component.py +41 -46
  13. reflex/components/core/auto_scroll.pyi +1 -195
  14. reflex/components/core/banner.pyi +1 -391
  15. reflex/components/core/breakpoints.py +14 -18
  16. reflex/components/core/html.pyi +1 -197
  17. reflex/components/core/match.py +2 -2
  18. reflex/components/core/sticky.py +11 -15
  19. reflex/components/core/sticky.pyi +0 -788
  20. reflex/components/core/upload.py +1 -3
  21. reflex/components/core/window_events.pyi +6 -5
  22. reflex/components/datadisplay/code.pyi +1 -0
  23. reflex/components/datadisplay/dataeditor.py +4 -6
  24. reflex/components/datadisplay/shiki_code_block.py +106 -110
  25. reflex/components/dynamic.py +4 -6
  26. reflex/components/el/elements/__init__.py +5 -7
  27. reflex/components/el/elements/__init__.pyi +5 -7
  28. reflex/components/el/elements/base.py +1 -1
  29. reflex/components/el/elements/base.pyi +1 -195
  30. reflex/components/el/elements/forms.py +7 -9
  31. reflex/components/el/elements/forms.pyi +12 -3112
  32. reflex/components/el/elements/inline.pyi +0 -5481
  33. reflex/components/el/elements/media.pyi +0 -10280
  34. reflex/components/el/elements/metadata.pyi +1 -835
  35. reflex/components/el/elements/other.pyi +1 -1365
  36. reflex/components/el/elements/scripts.pyi +1 -625
  37. reflex/components/el/elements/sectioning.pyi +1 -2911
  38. reflex/components/el/elements/tables.pyi +1 -1973
  39. reflex/components/el/elements/typography.pyi +1 -3125
  40. reflex/components/lucide/icon.py +4 -4
  41. reflex/components/lucide/icon.pyi +0 -4
  42. reflex/components/markdown/markdown.py +15 -19
  43. reflex/components/markdown/markdown.pyi +1 -0
  44. reflex/components/moment/moment.pyi +0 -49
  45. reflex/components/props.py +3 -3
  46. reflex/components/radix/primitives/accordion.py +4 -6
  47. reflex/components/radix/primitives/accordion.pyi +0 -14
  48. reflex/components/radix/primitives/base.pyi +0 -5
  49. reflex/components/radix/primitives/dialog.py +2 -0
  50. reflex/components/radix/primitives/dialog.pyi +1 -233
  51. reflex/components/radix/primitives/drawer.pyi +0 -18
  52. reflex/components/radix/primitives/form.pyi +30 -632
  53. reflex/components/radix/primitives/progress.pyi +0 -10
  54. reflex/components/radix/primitives/slider.pyi +0 -10
  55. reflex/components/radix/themes/color_mode.pyi +1 -284
  56. reflex/components/radix/themes/components/alert_dialog.pyi +0 -207
  57. reflex/components/radix/themes/components/aspect_ratio.pyi +0 -2
  58. reflex/components/radix/themes/components/avatar.pyi +0 -80
  59. reflex/components/radix/themes/components/badge.pyi +1 -270
  60. reflex/components/radix/themes/components/button.pyi +1 -274
  61. reflex/components/radix/themes/components/callout.pyi +0 -1197
  62. reflex/components/radix/themes/components/card.pyi +1 -209
  63. reflex/components/radix/themes/components/checkbox.pyi +0 -261
  64. reflex/components/radix/themes/components/checkbox_cards.pyi +1 -96
  65. reflex/components/radix/themes/components/checkbox_group.pyi +1 -80
  66. reflex/components/radix/themes/components/context_menu.pyi +13 -321
  67. reflex/components/radix/themes/components/data_list.pyi +1 -107
  68. reflex/components/radix/themes/components/dialog.pyi +1 -210
  69. reflex/components/radix/themes/components/dropdown_menu.pyi +0 -209
  70. reflex/components/radix/themes/components/hover_card.pyi +1 -246
  71. reflex/components/radix/themes/components/icon_button.pyi +1 -195
  72. reflex/components/radix/themes/components/inset.pyi +0 -252
  73. reflex/components/radix/themes/components/popover.pyi +1 -234
  74. reflex/components/radix/themes/components/progress.pyi +1 -84
  75. reflex/components/radix/themes/components/radio.pyi +1 -72
  76. reflex/components/radix/themes/components/radio_cards.pyi +1 -123
  77. reflex/components/radix/themes/components/scroll_area.pyi +1 -11
  78. reflex/components/radix/themes/components/select.pyi +1 -376
  79. reflex/components/radix/themes/components/separator.pyi +0 -77
  80. reflex/components/radix/themes/components/skeleton.pyi +0 -30
  81. reflex/components/radix/themes/components/slider.py +3 -5
  82. reflex/components/radix/themes/components/spinner.pyi +0 -5
  83. reflex/components/radix/themes/components/switch.pyi +0 -89
  84. reflex/components/radix/themes/components/table.pyi +0 -1453
  85. reflex/components/radix/themes/components/text_area.pyi +7 -282
  86. reflex/components/radix/themes/components/text_field.pyi +6 -392
  87. reflex/components/radix/themes/components/tooltip.pyi +0 -42
  88. reflex/components/radix/themes/layout/box.pyi +1 -195
  89. reflex/components/radix/themes/layout/center.pyi +0 -194
  90. reflex/components/radix/themes/layout/container.pyi +0 -178
  91. reflex/components/radix/themes/layout/flex.pyi +0 -194
  92. reflex/components/radix/themes/layout/grid.pyi +0 -194
  93. reflex/components/radix/themes/layout/list.pyi +0 -978
  94. reflex/components/radix/themes/layout/section.pyi +0 -194
  95. reflex/components/radix/themes/layout/spacer.pyi +0 -194
  96. reflex/components/radix/themes/layout/stack.pyi +0 -582
  97. reflex/components/radix/themes/typography/blockquote.pyi +0 -196
  98. reflex/components/radix/themes/typography/code.pyi +0 -194
  99. reflex/components/radix/themes/typography/heading.pyi +0 -194
  100. reflex/components/radix/themes/typography/link.pyi +0 -237
  101. reflex/components/radix/themes/typography/text.pyi +0 -1360
  102. reflex/components/react_router/dom.pyi +0 -237
  103. reflex/components/recharts/cartesian.py +12 -18
  104. reflex/components/recharts/general.py +12 -18
  105. reflex/constants/installer.py +5 -5
  106. reflex/custom_components/custom_components.py +6 -5
  107. reflex/environment.py +30 -7
  108. reflex/event.py +14 -12
  109. reflex/experimental/client_state.py +11 -12
  110. reflex/istate/data.py +8 -10
  111. reflex/istate/manager/__init__.py +3 -0
  112. reflex/istate/manager/disk.py +151 -5
  113. reflex/model.py +1 -1
  114. reflex/plugins/_screenshot.py +2 -2
  115. reflex/plugins/shared_tailwind.py +9 -14
  116. reflex/reflex.py +7 -9
  117. reflex/state.py +30 -37
  118. reflex/style.py +6 -6
  119. reflex/testing.py +54 -30
  120. reflex/utils/codespaces.py +31 -2
  121. reflex/utils/compat.py +1 -0
  122. reflex/utils/decorator.py +3 -3
  123. reflex/utils/format.py +18 -22
  124. reflex/utils/prerequisites.py +1 -1
  125. reflex/utils/pyi_generator.py +51 -57
  126. reflex/utils/serializers.py +1 -1
  127. reflex/utils/telemetry.py +1 -1
  128. reflex/utils/templates.py +4 -4
  129. reflex/utils/types.py +11 -4
  130. reflex/vars/base.py +26 -29
  131. reflex/vars/color.py +6 -8
  132. reflex/vars/dep_tracking.py +5 -3
  133. reflex/vars/function.py +3 -3
  134. reflex/vars/object.py +9 -13
  135. reflex/vars/sequence.py +18 -24
  136. {reflex-0.8.15a1.dist-info → reflex-0.8.16.dist-info}/METADATA +1 -1
  137. {reflex-0.8.15a1.dist-info → reflex-0.8.16.dist-info}/RECORD +140 -140
  138. {reflex-0.8.15a1.dist-info → reflex-0.8.16.dist-info}/WHEEL +0 -0
  139. {reflex-0.8.15a1.dist-info → reflex-0.8.16.dist-info}/entry_points.txt +0 -0
  140. {reflex-0.8.15a1.dist-info → reflex-0.8.16.dist-info}/licenses/LICENSE +0 -0
@@ -31,219 +31,6 @@ class ReactRouterLink(A):
31
31
  | Var[Literal["none", "render"]]
32
32
  | None = None,
33
33
  view_transition: Var[bool] | bool | None = None,
34
- download: Var[bool | str] | bool | str | None = None,
35
- href: Var[str] | str | None = None,
36
- href_lang: Var[str] | str | None = None,
37
- media: Var[str] | str | None = None,
38
- ping: Var[str] | str | None = None,
39
- referrer_policy: Literal[
40
- "",
41
- "no-referrer",
42
- "no-referrer-when-downgrade",
43
- "origin",
44
- "origin-when-cross-origin",
45
- "same-origin",
46
- "strict-origin",
47
- "strict-origin-when-cross-origin",
48
- "unsafe-url",
49
- ]
50
- | Var[
51
- Literal[
52
- "",
53
- "no-referrer",
54
- "no-referrer-when-downgrade",
55
- "origin",
56
- "origin-when-cross-origin",
57
- "same-origin",
58
- "strict-origin",
59
- "strict-origin-when-cross-origin",
60
- "unsafe-url",
61
- ]
62
- ]
63
- | None = None,
64
- rel: Var[str] | str | None = None,
65
- target: Literal["_blank", "_parent", "_self", "_top"]
66
- | Var[Literal["_blank", "_parent", "_self", "_top"] | str]
67
- | str
68
- | None = None,
69
- access_key: Var[str] | str | None = None,
70
- auto_capitalize: Literal[
71
- "characters", "none", "off", "on", "sentences", "words"
72
- ]
73
- | Var[Literal["characters", "none", "off", "on", "sentences", "words"]]
74
- | None = None,
75
- content_editable: Literal["inherit", "plaintext-only", False, True]
76
- | Var[Literal["inherit", "plaintext-only", False, True]]
77
- | None = None,
78
- context_menu: Var[str] | str | None = None,
79
- dir: Var[str] | str | None = None,
80
- draggable: Var[bool] | bool | None = None,
81
- enter_key_hint: Literal[
82
- "done", "enter", "go", "next", "previous", "search", "send"
83
- ]
84
- | Var[Literal["done", "enter", "go", "next", "previous", "search", "send"]]
85
- | None = None,
86
- hidden: Var[bool] | bool | None = None,
87
- input_mode: Literal[
88
- "decimal", "email", "none", "numeric", "search", "tel", "text", "url"
89
- ]
90
- | Var[
91
- Literal[
92
- "decimal", "email", "none", "numeric", "search", "tel", "text", "url"
93
- ]
94
- ]
95
- | None = None,
96
- item_prop: Var[str] | str | None = None,
97
- lang: Var[str] | str | None = None,
98
- role: Literal[
99
- "alert",
100
- "alertdialog",
101
- "application",
102
- "article",
103
- "banner",
104
- "button",
105
- "cell",
106
- "checkbox",
107
- "columnheader",
108
- "combobox",
109
- "complementary",
110
- "contentinfo",
111
- "definition",
112
- "dialog",
113
- "directory",
114
- "document",
115
- "feed",
116
- "figure",
117
- "form",
118
- "grid",
119
- "gridcell",
120
- "group",
121
- "heading",
122
- "img",
123
- "link",
124
- "list",
125
- "listbox",
126
- "listitem",
127
- "log",
128
- "main",
129
- "marquee",
130
- "math",
131
- "menu",
132
- "menubar",
133
- "menuitem",
134
- "menuitemcheckbox",
135
- "menuitemradio",
136
- "navigation",
137
- "none",
138
- "note",
139
- "option",
140
- "presentation",
141
- "progressbar",
142
- "radio",
143
- "radiogroup",
144
- "region",
145
- "row",
146
- "rowgroup",
147
- "rowheader",
148
- "scrollbar",
149
- "search",
150
- "searchbox",
151
- "separator",
152
- "slider",
153
- "spinbutton",
154
- "status",
155
- "switch",
156
- "tab",
157
- "table",
158
- "tablist",
159
- "tabpanel",
160
- "term",
161
- "textbox",
162
- "timer",
163
- "toolbar",
164
- "tooltip",
165
- "tree",
166
- "treegrid",
167
- "treeitem",
168
- ]
169
- | Var[
170
- Literal[
171
- "alert",
172
- "alertdialog",
173
- "application",
174
- "article",
175
- "banner",
176
- "button",
177
- "cell",
178
- "checkbox",
179
- "columnheader",
180
- "combobox",
181
- "complementary",
182
- "contentinfo",
183
- "definition",
184
- "dialog",
185
- "directory",
186
- "document",
187
- "feed",
188
- "figure",
189
- "form",
190
- "grid",
191
- "gridcell",
192
- "group",
193
- "heading",
194
- "img",
195
- "link",
196
- "list",
197
- "listbox",
198
- "listitem",
199
- "log",
200
- "main",
201
- "marquee",
202
- "math",
203
- "menu",
204
- "menubar",
205
- "menuitem",
206
- "menuitemcheckbox",
207
- "menuitemradio",
208
- "navigation",
209
- "none",
210
- "note",
211
- "option",
212
- "presentation",
213
- "progressbar",
214
- "radio",
215
- "radiogroup",
216
- "region",
217
- "row",
218
- "rowgroup",
219
- "rowheader",
220
- "scrollbar",
221
- "search",
222
- "searchbox",
223
- "separator",
224
- "slider",
225
- "spinbutton",
226
- "status",
227
- "switch",
228
- "tab",
229
- "table",
230
- "tablist",
231
- "tabpanel",
232
- "term",
233
- "textbox",
234
- "timer",
235
- "toolbar",
236
- "tooltip",
237
- "tree",
238
- "treegrid",
239
- "treeitem",
240
- ]
241
- ]
242
- | None = None,
243
- slot: Var[str] | str | None = None,
244
- spell_check: Var[bool] | bool | None = None,
245
- tab_index: Var[int] | int | None = None,
246
- title: Var[str] | str | None = None,
247
34
  style: Sequence[Mapping[str, Any]]
248
35
  | Mapping[str, Any]
249
36
  | Var[Mapping[str, Any]]
@@ -282,30 +69,6 @@ class ReactRouterLink(A):
282
69
  prevent_scroll_reset: Prevents the scroll position from being reset to the top of the window when the link is clicked and the app is using ScrollRestoration. This only prevents new locations resetting scroll to the top, scroll position will be restored for back/forward button navigation.
283
70
  discover: Defines the link discovery behavior
284
71
  view_transition: Enables a View Transition for this navigation.
285
- download: Specifies that the target (the file specified in the href attribute) will be downloaded when a user clicks on the hyperlink.
286
- href: Specifies the URL of the page the link goes to
287
- href_lang: Specifies the language of the linked document
288
- media: Specifies what media/device the linked document is optimized for
289
- ping: Specifies which referrer is sent when fetching the resource
290
- referrer_policy: Specifies the relationship between the current document and the linked document
291
- rel: Specifies the relationship between the linked document and the current document
292
- target: Specifies where to open the linked document
293
- access_key: Provides a hint for generating a keyboard shortcut for the current element.
294
- auto_capitalize: Controls whether and how text input is automatically capitalized as it is entered/edited by the user.
295
- content_editable: Indicates whether the element's content is editable.
296
- context_menu: Defines the ID of a <menu> element which will serve as the element's context menu.
297
- dir: Defines the text direction. Allowed values are ltr (Left-To-Right) or rtl (Right-To-Left)
298
- draggable: Defines whether the element can be dragged.
299
- enter_key_hint: Hints what media types the media element is able to play.
300
- hidden: Defines whether the element is hidden.
301
- input_mode: Defines the type of the element.
302
- item_prop: Defines the name of the element for metadata purposes.
303
- lang: Defines the language used in the element.
304
- role: Defines the role of the element.
305
- slot: Assigns a slot in a shadow DOM shadow tree to an element.
306
- spell_check: Defines whether the element may be checked for spelling errors.
307
- tab_index: Defines the position of the current element in the tabbing order.
308
- title: Defines a tooltip for the element.
309
72
  style: The style of the component.
310
73
  key: A unique key for the component.
311
74
  id: The id for the component.
@@ -352,12 +352,10 @@ class Area(Cartesian):
352
352
  dot: Var[ACTIVE_DOT_TYPE]
353
353
 
354
354
  # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {stroke: rx.color("accent", 2), fill: rx.color("accent", 10)}
355
- active_dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create(
356
- {
357
- "stroke": Color("accent", 2),
358
- "fill": Color("accent", 10),
359
- }
360
- )
355
+ active_dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create({
356
+ "stroke": Color("accent", 2),
357
+ "fill": Color("accent", 10),
358
+ })
361
359
 
362
360
  # The value which can describle the line, usually calculated internally.
363
361
  base_line: Var[int | Sequence[dict[str, Any]]]
@@ -439,20 +437,16 @@ class Line(Cartesian):
439
437
  stroke_width: Var[str | int | float]
440
438
 
441
439
  # The dot is shown when mouse enter a line chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 10), "fill": rx.color("accent", 4)}
442
- dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create(
443
- {
444
- "stroke": Color("accent", 10),
445
- "fill": Color("accent", 4),
446
- }
447
- )
440
+ dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create({
441
+ "stroke": Color("accent", 10),
442
+ "fill": Color("accent", 4),
443
+ })
448
444
 
449
445
  # The dot is shown when user enter an area chart and this chart has tooltip. If false set, no active dot will not be drawn. If true set, active dot will be drawn which have the props calculated internally. Default: {"stroke": rx.color("accent", 2), "fill": rx.color("accent", 10)}
450
- active_dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create(
451
- {
452
- "stroke": Color("accent", 2),
453
- "fill": Color("accent", 10),
454
- }
455
- )
446
+ active_dot: Var[ACTIVE_DOT_TYPE] = LiteralVar.create({
447
+ "stroke": Color("accent", 2),
448
+ "fill": Color("accent", 10),
449
+ })
456
450
 
457
451
  # Hides the line when true, useful when toggling visibility state via legend. Default: False
458
452
  hide: Var[bool]
@@ -147,34 +147,28 @@ class GraphingTooltip(Recharts):
147
147
  filter_null: Var[bool]
148
148
 
149
149
  # If set false, no cursor will be drawn when tooltip is active. Default: {"strokeWidth": 1, "fill": rx.color("gray", 3)}
150
- cursor: Var[dict[str, Any] | bool] = LiteralVar.create(
151
- {
152
- "strokeWidth": 1,
153
- "fill": Color("gray", 3),
154
- }
155
- )
150
+ cursor: Var[dict[str, Any] | bool] = LiteralVar.create({
151
+ "strokeWidth": 1,
152
+ "fill": Color("gray", 3),
153
+ })
156
154
 
157
155
  # The box of viewing area, which has the shape of {x: someVal, y: someVal, width: someVal, height: someVal}, usually calculated internally.
158
156
  view_box: Var[dict[str, Any]]
159
157
 
160
158
  # The style of default tooltip content item which is a li element. Default: {"color": rx.color("gray", 12)}
161
- item_style: Var[dict[str, Any]] = LiteralVar.create(
162
- {
163
- "color": Color("gray", 12),
164
- }
165
- )
159
+ item_style: Var[dict[str, Any]] = LiteralVar.create({
160
+ "color": Color("gray", 12),
161
+ })
166
162
 
167
163
  # The style of tooltip wrapper which is a dom element. Default: {}
168
164
  wrapper_style: Var[dict[str, Any]]
169
165
 
170
166
  # The style of tooltip content which is a dom element. Default: {"background": rx.color("gray", 1), "borderColor": rx.color("gray", 4), "borderRadius": "8px"}
171
- content_style: Var[dict[str, Any]] = LiteralVar.create(
172
- {
173
- "background": Color("gray", 1),
174
- "borderColor": Color("gray", 4),
175
- "borderRadius": "8px",
176
- }
177
- )
167
+ content_style: Var[dict[str, Any]] = LiteralVar.create({
168
+ "background": Color("gray", 1),
169
+ "borderColor": Color("gray", 4),
170
+ "borderRadius": "8px",
171
+ })
178
172
 
179
173
  # The style of default tooltip label which is a p element. Default: {"color": rx.color("gray", 11)}
180
174
  label_style: Var[dict[str, Any]] = LiteralVar.create({"color": Color("gray", 11)})
@@ -14,10 +14,10 @@ class Bun(SimpleNamespace):
14
14
  """Bun constants."""
15
15
 
16
16
  # The Bun version.
17
- VERSION = "1.2.23"
17
+ VERSION = "1.3.0"
18
18
 
19
19
  # Min Bun Version
20
- MIN_VERSION = "1.2.17"
20
+ MIN_VERSION = "1.3.0"
21
21
 
22
22
  # URL to bun install script.
23
23
  INSTALL_URL = "https://raw.githubusercontent.com/reflex-dev/reflex/main/scripts/bun_install.sh"
@@ -75,7 +75,7 @@ fetch-retries=0
75
75
 
76
76
 
77
77
  def _determine_react_router_version() -> str:
78
- default_version = "7.9.3"
78
+ default_version = "7.9.4"
79
79
  if (version := os.getenv("REACT_ROUTER_VERSION")) and version != default_version:
80
80
  from reflex.utils import console
81
81
 
@@ -143,11 +143,11 @@ class PackageJson(SimpleNamespace):
143
143
  "postcss-import": "16.1.1",
144
144
  "@react-router/dev": _react_router_version,
145
145
  "@react-router/fs-routes": _react_router_version,
146
- "vite": "npm:rolldown-vite@7.1.16",
146
+ "vite": "npm:rolldown-vite@7.1.17",
147
147
  }
148
148
  OVERRIDES = {
149
149
  # This should always match the `react` version in DEPENDENCIES for recharts compatibility.
150
150
  "react-is": _react_version,
151
151
  "cookie": "1.0.2",
152
- "vite": "npm:rolldown-vite@7.1.16",
152
+ "vite": "npm:rolldown-vite@7.1.17",
153
153
  }
@@ -366,8 +366,8 @@ def _get_default_library_name_parts() -> list[str]:
366
366
  """
367
367
  current_dir_name = Path.cwd().name
368
368
 
369
- cleaned_dir_name = re.sub("[^0-9a-zA-Z-_]+", "", current_dir_name).lower()
370
- parts = [part for part in re.split("-|_", cleaned_dir_name) if part]
369
+ cleaned_dir_name = re.sub(r"[^0-9a-zA-Z-_]+", "", current_dir_name).lower()
370
+ parts = [part for part in re.split(r"-|_", cleaned_dir_name) if part]
371
371
  if parts and parts[0] == constants.Reflex.MODULE_NAME:
372
372
  # If the directory name already starts with "reflex", remove it from the parts.
373
373
  parts = parts[1:]
@@ -702,9 +702,10 @@ def _collect_details_for_gallery():
702
702
 
703
703
  files = []
704
704
  if (image_file_and_extension := _get_file_from_prompt_in_loop()) is not None:
705
- files.append(
706
- ("files", (image_file_and_extension[1], image_file_and_extension[0]))
707
- )
705
+ files.append((
706
+ "files",
707
+ (image_file_and_extension[1], image_file_and_extension[0]),
708
+ ))
708
709
 
709
710
  demo_url = None
710
711
  while True:
reflex/environment.py CHANGED
@@ -95,6 +95,26 @@ def interpret_int_env(value: str, field_name: str) -> int:
95
95
  raise EnvironmentVarValueError(msg) from ve
96
96
 
97
97
 
98
+ def interpret_float_env(value: str, field_name: str) -> float:
99
+ """Interpret a float environment variable value.
100
+
101
+ Args:
102
+ value: The environment variable value.
103
+ field_name: The field name.
104
+
105
+ Returns:
106
+ The interpreted value.
107
+
108
+ Raises:
109
+ EnvironmentVarValueError: If the value is invalid.
110
+ """
111
+ try:
112
+ return float(value)
113
+ except ValueError as ve:
114
+ msg = f"Invalid float value: {value!r} for {field_name}"
115
+ raise EnvironmentVarValueError(msg) from ve
116
+
117
+
98
118
  def interpret_existing_path_env(value: str, field_name: str) -> ExistingPath:
99
119
  """Interpret a path environment variable value as an existing path.
100
120
 
@@ -228,6 +248,8 @@ def interpret_env_var_value(
228
248
  return loglevel
229
249
  if field_type is int:
230
250
  return interpret_int_env(value, field_name)
251
+ if field_type is float:
252
+ return interpret_float_env(value, field_name)
231
253
  if field_type is Path:
232
254
  return interpret_path_env(value, field_name)
233
255
  if field_type is ExistingPath:
@@ -671,6 +693,9 @@ class EnvironmentVariables:
671
693
  # Whether to mount the compiled frontend app in the backend server in production.
672
694
  REFLEX_MOUNT_FRONTEND_COMPILED_APP: EnvVar[bool] = env_var(False, internal=True)
673
695
 
696
+ # How long to delay writing updated states to disk. (Higher values mean less writes, but more chance of lost data.)
697
+ REFLEX_STATE_MANAGER_DISK_DEBOUNCE_SECONDS: EnvVar[float] = env_var(2.0)
698
+
674
699
 
675
700
  environment = EnvironmentVariables()
676
701
 
@@ -691,13 +716,11 @@ def _paths_from_env_files(env_files: str) -> list[Path]:
691
716
  """
692
717
  # load env files in reverse order
693
718
  return list(
694
- reversed(
695
- [
696
- Path(path)
697
- for path_element in env_files.split(os.pathsep)
698
- if (path := path_element.strip())
699
- ]
700
- )
719
+ reversed([
720
+ Path(path)
721
+ for path_element in env_files.split(os.pathsep)
722
+ if (path := path_element.strip())
723
+ ])
701
724
  )
702
725
 
703
726
 
reflex/event.py CHANGED
@@ -1672,16 +1672,14 @@ def parse_args_spec(arg_spec: ArgsSpec | Sequence[ArgsSpec]):
1672
1672
  spec = inspect.getfullargspec(arg_spec)
1673
1673
 
1674
1674
  return list(
1675
- arg_spec(
1676
- *[
1677
- Var(f"_{l_arg}").to(
1678
- unwrap_var_annotation(
1679
- resolve_annotation(annotations[0], l_arg, spec=arg_spec)
1680
- )
1675
+ arg_spec(*[
1676
+ Var(f"_{l_arg}").to(
1677
+ unwrap_var_annotation(
1678
+ resolve_annotation(annotations[0], l_arg, spec=arg_spec)
1681
1679
  )
1682
- for l_arg in spec.args
1683
- ]
1684
- )
1680
+ )
1681
+ for l_arg in spec.args
1682
+ ])
1685
1683
  ), annotations
1686
1684
 
1687
1685
 
@@ -2381,9 +2379,13 @@ class EventNamespace:
2381
2379
  Returns:
2382
2380
  Dict of event actions to apply, or empty dict if none specified.
2383
2381
  """
2384
- if not any(
2385
- [stop_propagation, prevent_default, throttle, debounce, temporal]
2386
- ):
2382
+ if not any([
2383
+ stop_propagation,
2384
+ prevent_default,
2385
+ throttle,
2386
+ debounce,
2387
+ temporal,
2388
+ ]):
2387
2389
  return {}
2388
2390
 
2389
2391
  event_actions = {}
@@ -68,9 +68,12 @@ class ClientStateVar(Var):
68
68
  Returns:
69
69
  The hash of the var.
70
70
  """
71
- return hash(
72
- (self._js_expr, str(self._var_type), self._getter_name, self._setter_name)
73
- )
71
+ return hash((
72
+ self._js_expr,
73
+ str(self._var_type),
74
+ self._getter_name,
75
+ self._setter_name,
76
+ ))
74
77
 
75
78
  @classmethod
76
79
  def create(
@@ -141,13 +144,9 @@ class ClientStateVar(Var):
141
144
  .to(list)
142
145
  .to(list)
143
146
  )
144
- + Var.create(
145
- [
146
- Var(
147
- f"(value) => {{ {_client_state_ref(var_name)} = value; }}"
148
- )
149
- ]
150
- ).to(list),
147
+ + Var.create([
148
+ Var(f"(value) => {{ {_client_state_ref(var_name)} = value; }}")
149
+ ]).to(list),
151
150
  ArgsFunctionOperationBuilder.create(
152
151
  args_names=("setter",),
153
152
  return_expr=Var("setter").to(FunctionVar).call(Var(arg_name)),
@@ -221,12 +220,12 @@ class ClientStateVar(Var):
221
220
  Returns:
222
221
  A special EventChain Var which will set the value when triggered.
223
222
  """
224
- _var_data = VarData(imports=_refs_import if self._global_ref else {})
223
+ var_data = VarData(imports=_refs_import if self._global_ref else {})
225
224
 
226
225
  setter = (
227
226
  Var(_client_state_ref(self._setter_name))
228
227
  if self._global_ref
229
- else Var(self._setter_name, _var_data=_var_data)
228
+ else Var(self._setter_name, _var_data=var_data)
230
229
  ).to(FunctionVar)
231
230
 
232
231
  if value is not NoValue:
reflex/istate/data.py CHANGED
@@ -47,9 +47,9 @@ class _HeaderData:
47
47
  )
48
48
 
49
49
 
50
- _HEADER_DATA_FIELDS = frozenset(
51
- [field.name for field in dataclasses.fields(_HeaderData)]
52
- )
50
+ _HEADER_DATA_FIELDS = frozenset([
51
+ field.name for field in dataclasses.fields(_HeaderData)
52
+ ])
53
53
 
54
54
 
55
55
  @dataclasses.dataclass(frozen=True)
@@ -73,13 +73,11 @@ class HeaderData(_HeaderData):
73
73
  if v
74
74
  and (snake_case_key := format.to_snake_case(k)) in _HEADER_DATA_FIELDS
75
75
  },
76
- raw_headers=_FrozenDictStrStr(
77
- **{
78
- k: v
79
- for k, v in router_data.get(constants.RouteVar.HEADERS, {}).items()
80
- if v
81
- }
82
- ),
76
+ raw_headers=_FrozenDictStrStr(**{
77
+ k: v
78
+ for k, v in router_data.get(constants.RouteVar.HEADERS, {}).items()
79
+ if v
80
+ }),
83
81
  )
84
82
 
85
83
 
@@ -92,6 +92,9 @@ class StateManager(ABC):
92
92
  """
93
93
  yield self.state()
94
94
 
95
+ async def close(self): # noqa: B027
96
+ """Close the state manager."""
97
+
95
98
 
96
99
  def _default_token_expiration() -> int:
97
100
  """Get the default token expiration time.