reflex 0.7.13a1__py3-none-any.whl → 0.7.14a1__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.
- reflex/.templates/apps/blank/code/blank.py +0 -2
- reflex/app.py +79 -72
- reflex/app_mixins/lifespan.py +2 -3
- reflex/app_mixins/middleware.py +1 -0
- reflex/app_mixins/mixin.py +0 -1
- reflex/assets.py +6 -3
- reflex/base.py +3 -2
- reflex/compiler/compiler.py +77 -64
- reflex/compiler/utils.py +8 -6
- reflex/components/base/app_wrap.pyi +0 -1
- reflex/components/base/bare.py +5 -7
- reflex/components/base/body.pyi +0 -1
- reflex/components/base/document.pyi +0 -5
- reflex/components/base/error_boundary.pyi +0 -1
- reflex/components/base/fragment.pyi +0 -1
- reflex/components/base/head.pyi +0 -2
- reflex/components/base/link.pyi +0 -2
- reflex/components/base/meta.py +2 -1
- reflex/components/base/meta.pyi +0 -4
- reflex/components/base/script.py +2 -1
- reflex/components/base/script.pyi +0 -1
- reflex/components/base/strict_mode.pyi +0 -1
- reflex/components/component.py +38 -40
- reflex/components/core/auto_scroll.pyi +0 -1
- reflex/components/core/banner.pyi +0 -6
- reflex/components/core/breakpoints.py +9 -11
- reflex/components/core/client_side_routing.pyi +0 -2
- reflex/components/core/clipboard.pyi +0 -1
- reflex/components/core/colors.py +10 -7
- reflex/components/core/cond.py +4 -2
- reflex/components/core/debounce.py +5 -3
- reflex/components/core/debounce.pyi +0 -1
- reflex/components/core/foreach.py +8 -6
- reflex/components/core/html.py +3 -3
- reflex/components/core/html.pyi +0 -1
- reflex/components/core/match.py +19 -17
- reflex/components/core/sticky.pyi +0 -4
- reflex/components/core/upload.pyi +0 -5
- reflex/components/datadisplay/code.py +1 -2
- reflex/components/datadisplay/code.pyi +0 -2
- reflex/components/datadisplay/dataeditor.py +7 -10
- reflex/components/datadisplay/dataeditor.pyi +0 -1
- reflex/components/datadisplay/logo.py +3 -4
- reflex/components/datadisplay/shiki_code_block.py +8 -11
- reflex/components/datadisplay/shiki_code_block.pyi +0 -3
- reflex/components/dynamic.py +2 -3
- reflex/components/el/__init__.pyi +2 -0
- reflex/components/el/element.pyi +0 -1
- reflex/components/el/elements/__init__.py +1 -0
- reflex/components/el/elements/__init__.pyi +3 -0
- reflex/components/el/elements/base.pyi +0 -1
- reflex/components/el/elements/forms.py +3 -4
- reflex/components/el/elements/forms.pyi +1 -18
- reflex/components/el/elements/inline.pyi +0 -28
- reflex/components/el/elements/media.py +26 -0
- reflex/components/el/elements/media.pyi +259 -25
- reflex/components/el/elements/metadata.py +0 -1
- reflex/components/el/elements/metadata.pyi +0 -6
- reflex/components/el/elements/other.pyi +0 -7
- reflex/components/el/elements/scripts.pyi +0 -3
- reflex/components/el/elements/sectioning.pyi +0 -15
- reflex/components/el/elements/tables.pyi +0 -10
- reflex/components/el/elements/typography.pyi +0 -15
- reflex/components/gridjs/datatable.py +10 -13
- reflex/components/gridjs/datatable.pyi +0 -2
- reflex/components/lucide/icon.py +10 -9
- reflex/components/lucide/icon.pyi +0 -3
- reflex/components/markdown/markdown.py +6 -8
- reflex/components/markdown/markdown.pyi +0 -1
- reflex/components/moment/moment.pyi +0 -1
- reflex/components/next/base.py +0 -2
- reflex/components/next/base.pyi +0 -3
- reflex/components/next/image.pyi +0 -1
- reflex/components/next/link.pyi +0 -1
- reflex/components/next/video.pyi +0 -1
- reflex/components/plotly/plotly.pyi +0 -9
- reflex/components/props.py +4 -3
- reflex/components/radix/primitives/accordion.py +1 -1
- reflex/components/radix/primitives/accordion.pyi +0 -7
- reflex/components/radix/primitives/base.py +1 -3
- reflex/components/radix/primitives/base.pyi +0 -2
- reflex/components/radix/primitives/drawer.py +1 -1
- reflex/components/radix/primitives/drawer.pyi +0 -11
- reflex/components/radix/primitives/form.py +5 -9
- reflex/components/radix/primitives/form.pyi +0 -12
- reflex/components/radix/primitives/progress.py +1 -1
- reflex/components/radix/primitives/progress.pyi +0 -5
- reflex/components/radix/primitives/slider.py +1 -1
- reflex/components/radix/primitives/slider.pyi +0 -5
- reflex/components/radix/themes/base.pyi +0 -8
- reflex/components/radix/themes/color_mode.pyi +0 -3
- reflex/components/radix/themes/components/alert_dialog.py +4 -2
- reflex/components/radix/themes/components/alert_dialog.pyi +4 -9
- reflex/components/radix/themes/components/aspect_ratio.py +1 -2
- reflex/components/radix/themes/components/aspect_ratio.pyi +1 -3
- reflex/components/radix/themes/components/avatar.py +5 -2
- reflex/components/radix/themes/components/avatar.pyi +1 -3
- reflex/components/radix/themes/components/badge.py +5 -2
- reflex/components/radix/themes/components/badge.pyi +1 -3
- reflex/components/radix/themes/components/button.py +2 -3
- reflex/components/radix/themes/components/button.pyi +1 -3
- reflex/components/radix/themes/components/callout.py +1 -2
- reflex/components/radix/themes/components/callout.pyi +1 -7
- reflex/components/radix/themes/components/card.py +1 -2
- reflex/components/radix/themes/components/card.pyi +1 -3
- reflex/components/radix/themes/components/checkbox.py +7 -4
- reflex/components/radix/themes/components/checkbox.pyi +1 -5
- reflex/components/radix/themes/components/checkbox_cards.py +1 -2
- reflex/components/radix/themes/components/checkbox_cards.pyi +1 -4
- reflex/components/radix/themes/components/checkbox_group.py +1 -2
- reflex/components/radix/themes/components/checkbox_group.pyi +1 -4
- reflex/components/radix/themes/components/context_menu.py +1 -1
- reflex/components/radix/themes/components/context_menu.pyi +1 -14
- reflex/components/radix/themes/components/data_list.py +1 -2
- reflex/components/radix/themes/components/data_list.pyi +1 -6
- reflex/components/radix/themes/components/dialog.py +4 -2
- reflex/components/radix/themes/components/dialog.pyi +4 -9
- reflex/components/radix/themes/components/dropdown_menu.py +5 -2
- reflex/components/radix/themes/components/dropdown_menu.pyi +4 -10
- reflex/components/radix/themes/components/hover_card.py +4 -2
- reflex/components/radix/themes/components/hover_card.pyi +4 -6
- reflex/components/radix/themes/components/icon_button.py +7 -8
- reflex/components/radix/themes/components/icon_button.pyi +1 -3
- reflex/components/radix/themes/components/inset.py +1 -2
- reflex/components/radix/themes/components/inset.pyi +1 -3
- reflex/components/radix/themes/components/popover.py +4 -2
- reflex/components/radix/themes/components/popover.pyi +4 -6
- reflex/components/radix/themes/components/progress.py +1 -2
- reflex/components/radix/themes/components/progress.pyi +1 -3
- reflex/components/radix/themes/components/radio.py +1 -2
- reflex/components/radix/themes/components/radio.pyi +1 -3
- reflex/components/radix/themes/components/radio_cards.py +1 -2
- reflex/components/radix/themes/components/radio_cards.pyi +1 -4
- reflex/components/radix/themes/components/radio_group.py +7 -5
- reflex/components/radix/themes/components/radio_group.pyi +1 -6
- reflex/components/radix/themes/components/scroll_area.py +1 -2
- reflex/components/radix/themes/components/scroll_area.pyi +1 -3
- reflex/components/radix/themes/components/segmented_control.py +1 -2
- reflex/components/radix/themes/components/segmented_control.pyi +1 -4
- reflex/components/radix/themes/components/select.py +5 -2
- reflex/components/radix/themes/components/select.pyi +1 -11
- reflex/components/radix/themes/components/separator.py +1 -2
- reflex/components/radix/themes/components/separator.pyi +1 -3
- reflex/components/radix/themes/components/skeleton.py +1 -2
- reflex/components/radix/themes/components/skeleton.pyi +1 -3
- reflex/components/radix/themes/components/slider.py +1 -2
- reflex/components/radix/themes/components/slider.pyi +1 -3
- reflex/components/radix/themes/components/spinner.py +1 -2
- reflex/components/radix/themes/components/spinner.pyi +1 -3
- reflex/components/radix/themes/components/switch.py +1 -2
- reflex/components/radix/themes/components/switch.pyi +1 -3
- reflex/components/radix/themes/components/table.py +1 -2
- reflex/components/radix/themes/components/table.pyi +1 -9
- reflex/components/radix/themes/components/tabs.py +1 -2
- reflex/components/radix/themes/components/tabs.pyi +1 -7
- reflex/components/radix/themes/components/text_area.py +5 -2
- reflex/components/radix/themes/components/text_area.pyi +1 -3
- reflex/components/radix/themes/components/text_field.py +5 -2
- reflex/components/radix/themes/components/text_field.pyi +1 -5
- reflex/components/radix/themes/components/tooltip.py +1 -2
- reflex/components/radix/themes/components/tooltip.pyi +1 -3
- reflex/components/radix/themes/layout/base.py +5 -2
- reflex/components/radix/themes/layout/base.pyi +5 -3
- reflex/components/radix/themes/layout/box.py +1 -2
- reflex/components/radix/themes/layout/box.pyi +1 -3
- reflex/components/radix/themes/layout/center.pyi +0 -1
- reflex/components/radix/themes/layout/container.py +1 -2
- reflex/components/radix/themes/layout/container.pyi +1 -3
- reflex/components/radix/themes/layout/flex.py +6 -2
- reflex/components/radix/themes/layout/flex.pyi +1 -3
- reflex/components/radix/themes/layout/grid.py +6 -2
- reflex/components/radix/themes/layout/grid.pyi +1 -3
- reflex/components/radix/themes/layout/list.py +2 -1
- reflex/components/radix/themes/layout/list.pyi +0 -5
- reflex/components/radix/themes/layout/section.py +1 -2
- reflex/components/radix/themes/layout/section.pyi +1 -3
- reflex/components/radix/themes/layout/spacer.pyi +0 -1
- reflex/components/radix/themes/layout/stack.py +1 -1
- reflex/components/radix/themes/layout/stack.pyi +0 -3
- reflex/components/radix/themes/typography/blockquote.py +1 -1
- reflex/components/radix/themes/typography/blockquote.pyi +1 -3
- reflex/components/radix/themes/typography/code.py +5 -1
- reflex/components/radix/themes/typography/code.pyi +1 -3
- reflex/components/radix/themes/typography/heading.py +1 -1
- reflex/components/radix/themes/typography/heading.pyi +1 -3
- reflex/components/radix/themes/typography/link.py +3 -2
- reflex/components/radix/themes/typography/link.pyi +1 -3
- reflex/components/radix/themes/typography/text.py +1 -1
- reflex/components/radix/themes/typography/text.pyi +1 -9
- reflex/components/react_player/audio.py +0 -2
- reflex/components/react_player/audio.pyi +0 -3
- reflex/components/react_player/react_player.pyi +0 -1
- reflex/components/react_player/video.py +0 -2
- reflex/components/react_player/video.pyi +0 -3
- reflex/components/recharts/__init__.py +1 -1
- reflex/components/recharts/__init__.pyi +1 -1
- reflex/components/recharts/cartesian.py +20 -25
- reflex/components/recharts/cartesian.pyi +20 -37
- reflex/components/recharts/charts.py +2 -1
- reflex/components/recharts/charts.pyi +0 -12
- reflex/components/recharts/general.pyi +0 -6
- reflex/components/recharts/polar.py +5 -4
- reflex/components/recharts/polar.pyi +4 -10
- reflex/components/recharts/recharts.py +12 -10
- reflex/components/recharts/recharts.pyi +10 -11
- reflex/components/sonner/toast.py +2 -2
- reflex/components/sonner/toast.pyi +0 -2
- reflex/components/suneditor/editor.py +2 -1
- reflex/components/suneditor/editor.pyi +0 -1
- reflex/components/tags/iter_tag.py +4 -2
- reflex/config.py +47 -35
- reflex/constants/base.py +3 -3
- reflex/constants/compiler.py +8 -6
- reflex/constants/installer.py +24 -15
- reflex/custom_components/custom_components.py +1 -2
- reflex/event.py +58 -60
- reflex/experimental/__init__.py +2 -2
- reflex/experimental/client_state.py +9 -4
- reflex/experimental/layout.pyi +0 -5
- reflex/istate/manager.py +15 -19
- reflex/istate/proxy.py +19 -12
- reflex/model.py +6 -4
- reflex/plugins/base.py +8 -0
- reflex/plugins/tailwind_v3.py +8 -0
- reflex/plugins/tailwind_v4.py +9 -0
- reflex/reflex.py +9 -11
- reflex/route.py +7 -9
- reflex/state.py +66 -70
- reflex/style.py +3 -1
- reflex/testing.py +46 -29
- reflex/utils/build.py +2 -1
- reflex/utils/console.py +9 -17
- reflex/utils/exec.py +9 -11
- reflex/utils/format.py +21 -24
- reflex/utils/imports.py +4 -3
- reflex/utils/lazy_loader.py +3 -3
- reflex/utils/misc.py +2 -1
- reflex/utils/net.py +2 -2
- reflex/utils/path_ops.py +2 -1
- reflex/utils/prerequisites.py +67 -38
- reflex/utils/processes.py +4 -6
- reflex/utils/pyi_generator.py +46 -41
- reflex/utils/redir.py +1 -1
- reflex/utils/serializers.py +4 -4
- reflex/utils/telemetry.py +42 -4
- reflex/utils/types.py +16 -13
- reflex/vars/base.py +96 -109
- reflex/vars/datetime.py +2 -1
- reflex/vars/dep_tracking.py +19 -28
- reflex/vars/number.py +6 -7
- reflex/vars/object.py +5 -6
- reflex/vars/sequence.py +11 -11
- {reflex-0.7.13a1.dist-info → reflex-0.7.14a1.dist-info}/METADATA +1 -1
- reflex-0.7.14a1.dist-info/RECORD +407 -0
- reflex-0.7.13a1.dist-info/RECORD +0 -407
- {reflex-0.7.13a1.dist-info → reflex-0.7.14a1.dist-info}/WHEEL +0 -0
- {reflex-0.7.13a1.dist-info → reflex-0.7.14a1.dist-info}/entry_points.txt +0 -0
- {reflex-0.7.13a1.dist-info → reflex-0.7.14a1.dist-info}/licenses/LICENSE +0 -0
|
@@ -61,7 +61,6 @@ class Recharts(Component):
|
|
|
61
61
|
Returns:
|
|
62
62
|
The component.
|
|
63
63
|
"""
|
|
64
|
-
...
|
|
65
64
|
|
|
66
65
|
class RechartsCharts(NoSSRComponent, MemoizationLeaf):
|
|
67
66
|
@overload
|
|
@@ -113,7 +112,6 @@ class RechartsCharts(NoSSRComponent, MemoizationLeaf):
|
|
|
113
112
|
Returns:
|
|
114
113
|
The memoization leaf
|
|
115
114
|
"""
|
|
116
|
-
...
|
|
117
115
|
|
|
118
116
|
LiteralAnimationEasing = Literal["ease", "ease-in", "ease-out", "ease-in-out", "linear"]
|
|
119
117
|
LiteralIfOverflow = Literal["discard", "hidden", "visible", "extendDomain"]
|
|
@@ -168,25 +166,25 @@ LiteralPosition = Literal[
|
|
|
168
166
|
"center",
|
|
169
167
|
]
|
|
170
168
|
LiteralIconType = Literal[
|
|
171
|
-
"line",
|
|
172
|
-
"plainline",
|
|
173
|
-
"square",
|
|
174
|
-
"rect",
|
|
175
169
|
"circle",
|
|
176
170
|
"cross",
|
|
177
171
|
"diamond",
|
|
172
|
+
"line",
|
|
173
|
+
"plainline",
|
|
174
|
+
"rect",
|
|
175
|
+
"square",
|
|
178
176
|
"star",
|
|
179
177
|
"triangle",
|
|
180
178
|
"wye",
|
|
181
179
|
]
|
|
182
180
|
LiteralLegendType = Literal[
|
|
183
|
-
"line",
|
|
184
|
-
"plainline",
|
|
185
|
-
"square",
|
|
186
|
-
"rect",
|
|
187
181
|
"circle",
|
|
188
182
|
"cross",
|
|
189
183
|
"diamond",
|
|
184
|
+
"line",
|
|
185
|
+
"plainline",
|
|
186
|
+
"rect",
|
|
187
|
+
"square",
|
|
190
188
|
"star",
|
|
191
189
|
"triangle",
|
|
192
190
|
"wye",
|
|
@@ -198,7 +196,7 @@ LiteralStackOffset = Literal["expand", "none", "wiggle", "silhouette"]
|
|
|
198
196
|
LiteralBarChartStackOffset = Literal["expand", "none", "wiggle", "silhouette", "sign"]
|
|
199
197
|
LiteralComposedChartBaseValue = Literal["dataMin", "dataMax", "auto"]
|
|
200
198
|
LiteralAxisType = Literal["number", "category"]
|
|
201
|
-
|
|
199
|
+
LiteralCurveType = Literal[
|
|
202
200
|
"basis",
|
|
203
201
|
"basisClosed",
|
|
204
202
|
"basisOpen",
|
|
@@ -221,3 +219,4 @@ LiteralIntervalAxis = Literal[
|
|
|
221
219
|
"preserveStart", "preserveEnd", "preserveStartEnd", "equidistantPreserveStart"
|
|
222
220
|
]
|
|
223
221
|
LiteralSyncMethod = Literal["index", "value"]
|
|
222
|
+
ACTIVE_DOT_TYPE = bool | dict[str, Any]
|
|
@@ -147,7 +147,6 @@ class ToastProps(PropsBase, NoExtrasAllowedProps):
|
|
|
147
147
|
Returns:
|
|
148
148
|
The object as a dictionary with ToastAction fields intact.
|
|
149
149
|
"""
|
|
150
|
-
kwargs.setdefault("exclude_none", True)
|
|
151
150
|
d = super().dict(*args, **kwargs)
|
|
152
151
|
# Keep these fields as ToastAction so they can be serialized specially
|
|
153
152
|
if "action" in d:
|
|
@@ -266,7 +265,8 @@ class Toaster(Component):
|
|
|
266
265
|
props.setdefault("title", message)
|
|
267
266
|
message = ""
|
|
268
267
|
elif message == "" and "title" not in props and "description" not in props:
|
|
269
|
-
|
|
268
|
+
msg = "Toast message or title or description must be provided."
|
|
269
|
+
raise ValueError(msg)
|
|
270
270
|
|
|
271
271
|
if props:
|
|
272
272
|
args = LiteralVar.create(ToastProps(component_name="rx.toast", **props)) # pyright: ignore [reportCallIssue]
|
|
@@ -177,7 +177,6 @@ class Toaster(Component):
|
|
|
177
177
|
Returns:
|
|
178
178
|
The toaster component.
|
|
179
179
|
"""
|
|
180
|
-
...
|
|
181
180
|
|
|
182
181
|
class ToastNamespace(ComponentNamespace):
|
|
183
182
|
provider = staticmethod(Toaster.create)
|
|
@@ -210,6 +209,5 @@ class ToastNamespace(ComponentNamespace):
|
|
|
210
209
|
Returns:
|
|
211
210
|
The toast event.
|
|
212
211
|
"""
|
|
213
|
-
...
|
|
214
212
|
|
|
215
213
|
toast = ToastNamespace()
|
|
@@ -259,7 +259,8 @@ class Editor(NoSSRComponent):
|
|
|
259
259
|
"""
|
|
260
260
|
if set_options is not None:
|
|
261
261
|
if isinstance(set_options, Var):
|
|
262
|
-
|
|
262
|
+
msg = "EditorOptions cannot be a state Var"
|
|
263
|
+
raise ValueError(msg)
|
|
263
264
|
props["set_options"] = {
|
|
264
265
|
to_camel_case(k): v
|
|
265
266
|
for k, v in set_options.dict().items()
|
|
@@ -121,7 +121,8 @@ class IterTag(Tag):
|
|
|
121
121
|
else:
|
|
122
122
|
# If the render function takes the index as an argument.
|
|
123
123
|
if len(args) != 2:
|
|
124
|
-
|
|
124
|
+
msg = "The render function must take 2 arguments."
|
|
125
|
+
raise ValueError(msg)
|
|
125
126
|
component = self.render_fn(arg, index)
|
|
126
127
|
|
|
127
128
|
# Nested foreach components or cond must be wrapped in fragments.
|
|
@@ -131,7 +132,8 @@ class IterTag(Tag):
|
|
|
131
132
|
component = _into_component_once(component)
|
|
132
133
|
|
|
133
134
|
if component is None:
|
|
134
|
-
|
|
135
|
+
msg = "The render function must return a component."
|
|
136
|
+
raise ValueError(msg)
|
|
135
137
|
|
|
136
138
|
# Set the component key.
|
|
137
139
|
if component.key is None:
|
reflex/config.py
CHANGED
|
@@ -69,9 +69,27 @@ def _load_dotenv_from_str(env_files: str) -> None:
|
|
|
69
69
|
load_dotenv(env_file_path, override=True)
|
|
70
70
|
|
|
71
71
|
|
|
72
|
+
def _load_dotenv_from_env():
|
|
73
|
+
"""Load environment variables from paths specified in REFLEX_ENV_FILE."""
|
|
74
|
+
show_deprecation = False
|
|
75
|
+
env_env_file = os.environ.get("REFLEX_ENV_FILE")
|
|
76
|
+
if not env_env_file:
|
|
77
|
+
env_env_file = os.environ.get("ENV_FILE")
|
|
78
|
+
if env_env_file:
|
|
79
|
+
show_deprecation = True
|
|
80
|
+
if show_deprecation:
|
|
81
|
+
console.deprecate(
|
|
82
|
+
"Usage of deprecated ENV_FILE env var detected.",
|
|
83
|
+
reason="Prefer `REFLEX_` prefix when setting env vars.",
|
|
84
|
+
deprecation_version="0.7.13",
|
|
85
|
+
removal_version="0.8.0",
|
|
86
|
+
)
|
|
87
|
+
if env_env_file:
|
|
88
|
+
_load_dotenv_from_str(env_env_file)
|
|
89
|
+
|
|
90
|
+
|
|
72
91
|
# Load the env files at import time if they are set in the ENV_FILE environment variable.
|
|
73
|
-
|
|
74
|
-
_load_dotenv_from_str(env_files)
|
|
92
|
+
_load_dotenv_from_env()
|
|
75
93
|
|
|
76
94
|
|
|
77
95
|
class DBConfig(Base):
|
|
@@ -196,12 +214,10 @@ def get_default_value_for_field(field: dataclasses.Field) -> Any:
|
|
|
196
214
|
"""
|
|
197
215
|
if field.default != dataclasses.MISSING:
|
|
198
216
|
return field.default
|
|
199
|
-
|
|
217
|
+
if field.default_factory != dataclasses.MISSING:
|
|
200
218
|
return field.default_factory()
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
f"Missing value for environment variable {field.name} and no default value found"
|
|
204
|
-
)
|
|
219
|
+
msg = f"Missing value for environment variable {field.name} and no default value found"
|
|
220
|
+
raise ValueError(msg)
|
|
205
221
|
|
|
206
222
|
|
|
207
223
|
# TODO: Change all interpret_.* signatures to value: str, field: dataclasses.Field once we migrate rx.Config to dataclasses
|
|
@@ -223,9 +239,10 @@ def interpret_boolean_env(value: str, field_name: str) -> bool:
|
|
|
223
239
|
|
|
224
240
|
if value.lower() in true_values:
|
|
225
241
|
return True
|
|
226
|
-
|
|
242
|
+
if value.lower() in false_values:
|
|
227
243
|
return False
|
|
228
|
-
|
|
244
|
+
msg = f"Invalid boolean value: {value} for {field_name}"
|
|
245
|
+
raise EnvironmentVarValueError(msg)
|
|
229
246
|
|
|
230
247
|
|
|
231
248
|
def interpret_int_env(value: str, field_name: str) -> int:
|
|
@@ -244,9 +261,8 @@ def interpret_int_env(value: str, field_name: str) -> int:
|
|
|
244
261
|
try:
|
|
245
262
|
return int(value)
|
|
246
263
|
except ValueError as ve:
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
) from ve
|
|
264
|
+
msg = f"Invalid integer value: {value} for {field_name}"
|
|
265
|
+
raise EnvironmentVarValueError(msg) from ve
|
|
250
266
|
|
|
251
267
|
|
|
252
268
|
def interpret_existing_path_env(value: str, field_name: str) -> ExistingPath:
|
|
@@ -264,7 +280,8 @@ def interpret_existing_path_env(value: str, field_name: str) -> ExistingPath:
|
|
|
264
280
|
"""
|
|
265
281
|
path = Path(value)
|
|
266
282
|
if not path.exists():
|
|
267
|
-
|
|
283
|
+
msg = f"Path does not exist: {path} for {field_name}"
|
|
284
|
+
raise EnvironmentVarValueError(msg)
|
|
268
285
|
return path
|
|
269
286
|
|
|
270
287
|
|
|
@@ -298,9 +315,8 @@ def interpret_enum_env(value: str, field_type: GenericType, field_name: str) ->
|
|
|
298
315
|
try:
|
|
299
316
|
return field_type(value)
|
|
300
317
|
except ValueError as ve:
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
) from ve
|
|
318
|
+
msg = f"Invalid enum value: {value} for {field_name}"
|
|
319
|
+
raise EnvironmentVarValueError(msg) from ve
|
|
304
320
|
|
|
305
321
|
|
|
306
322
|
def interpret_env_var_value(
|
|
@@ -322,21 +338,20 @@ def interpret_env_var_value(
|
|
|
322
338
|
field_type = value_inside_optional(field_type)
|
|
323
339
|
|
|
324
340
|
if is_union(field_type):
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
)
|
|
341
|
+
msg = f"Union types are not supported for environment variables: {field_name}."
|
|
342
|
+
raise ValueError(msg)
|
|
328
343
|
|
|
329
344
|
if field_type is bool:
|
|
330
345
|
return interpret_boolean_env(value, field_name)
|
|
331
|
-
|
|
346
|
+
if field_type is str:
|
|
332
347
|
return value
|
|
333
|
-
|
|
348
|
+
if field_type is int:
|
|
334
349
|
return interpret_int_env(value, field_name)
|
|
335
|
-
|
|
350
|
+
if field_type is Path:
|
|
336
351
|
return interpret_path_env(value, field_name)
|
|
337
|
-
|
|
352
|
+
if field_type is ExistingPath:
|
|
338
353
|
return interpret_existing_path_env(value, field_name)
|
|
339
|
-
|
|
354
|
+
if get_origin(field_type) is list:
|
|
340
355
|
return [
|
|
341
356
|
interpret_env_var_value(
|
|
342
357
|
v,
|
|
@@ -345,13 +360,11 @@ def interpret_env_var_value(
|
|
|
345
360
|
)
|
|
346
361
|
for i, v in enumerate(value.split(":"))
|
|
347
362
|
]
|
|
348
|
-
|
|
363
|
+
if inspect.isclass(field_type) and issubclass(field_type, enum.Enum):
|
|
349
364
|
return interpret_enum_env(value, field_type, field_name)
|
|
350
365
|
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
f"Invalid type for environment variable {field_name}: {field_type}. This is probably an issue in Reflex."
|
|
354
|
-
)
|
|
366
|
+
msg = f"Invalid type for environment variable {field_name}: {field_type}. This is probably an issue in Reflex."
|
|
367
|
+
raise ValueError(msg)
|
|
355
368
|
|
|
356
369
|
|
|
357
370
|
T = TypeVar("T")
|
|
@@ -964,9 +977,8 @@ If you are not using tailwind, set `tailwind` to `None` in rxconfig.py.""",
|
|
|
964
977
|
self.state_manager_mode == constants.StateManagerMode.REDIS
|
|
965
978
|
and not self.redis_url
|
|
966
979
|
):
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
)
|
|
980
|
+
msg = f"{self._prefixes[0]}REDIS_URL is required when using the redis state manager."
|
|
981
|
+
raise ConfigError(msg)
|
|
970
982
|
|
|
971
983
|
@property
|
|
972
984
|
def app_module(self) -> ModuleType | None:
|
|
@@ -988,9 +1000,9 @@ If you are not using tailwind, set `tailwind` to `None` in rxconfig.py.""",
|
|
|
988
1000
|
Returns:
|
|
989
1001
|
The module name.
|
|
990
1002
|
"""
|
|
991
|
-
if self.
|
|
992
|
-
return self.
|
|
993
|
-
return
|
|
1003
|
+
if self.app_module_import is not None:
|
|
1004
|
+
return self.app_module_import
|
|
1005
|
+
return self.app_name + "." + self.app_name
|
|
994
1006
|
|
|
995
1007
|
def update_from_env(self) -> dict[str, Any]:
|
|
996
1008
|
"""Update the config values based on set environment variables.
|
reflex/constants/base.py
CHANGED
|
@@ -33,11 +33,11 @@ class Dirs(SimpleNamespace):
|
|
|
33
33
|
# The name of the utils file.
|
|
34
34
|
UTILS = "utils"
|
|
35
35
|
# The name of the state file.
|
|
36
|
-
STATE_PATH =
|
|
36
|
+
STATE_PATH = UTILS + "/state"
|
|
37
37
|
# The name of the components file.
|
|
38
|
-
COMPONENTS_PATH =
|
|
38
|
+
COMPONENTS_PATH = UTILS + "/components"
|
|
39
39
|
# The name of the contexts file.
|
|
40
|
-
CONTEXTS_PATH =
|
|
40
|
+
CONTEXTS_PATH = UTILS + "/context"
|
|
41
41
|
# The name of the output static directory.
|
|
42
42
|
STATIC = "_static"
|
|
43
43
|
# The name of the public html directory served at "/"
|
reflex/constants/compiler.py
CHANGED
|
@@ -176,6 +176,13 @@ DATA_DASH = "data-"
|
|
|
176
176
|
ARIA_UNDERSCORE = "aria_"
|
|
177
177
|
ARIA_DASH = "aria-"
|
|
178
178
|
|
|
179
|
+
SPECIAL_ATTRS = (
|
|
180
|
+
DATA_UNDERSCORE,
|
|
181
|
+
DATA_DASH,
|
|
182
|
+
ARIA_UNDERSCORE,
|
|
183
|
+
ARIA_DASH,
|
|
184
|
+
)
|
|
185
|
+
|
|
179
186
|
|
|
180
187
|
class SpecialAttributes(enum.Enum):
|
|
181
188
|
"""Special attributes for components.
|
|
@@ -194,9 +201,4 @@ class SpecialAttributes(enum.Enum):
|
|
|
194
201
|
Returns:
|
|
195
202
|
True if the attribute is special.
|
|
196
203
|
"""
|
|
197
|
-
return (
|
|
198
|
-
attr.startswith(DATA_UNDERSCORE)
|
|
199
|
-
or attr.startswith(DATA_DASH)
|
|
200
|
-
or attr.startswith(ARIA_UNDERSCORE)
|
|
201
|
-
or attr.startswith(ARIA_DASH)
|
|
202
|
-
)
|
|
204
|
+
return attr.startswith(SPECIAL_ATTRS)
|
reflex/constants/installer.py
CHANGED
|
@@ -14,7 +14,7 @@ class Bun(SimpleNamespace):
|
|
|
14
14
|
"""Bun constants."""
|
|
15
15
|
|
|
16
16
|
# The Bun version.
|
|
17
|
-
VERSION = "1.2.
|
|
17
|
+
VERSION = "1.2.15"
|
|
18
18
|
|
|
19
19
|
# Min Bun Version
|
|
20
20
|
MIN_VERSION = "1.2.8"
|
|
@@ -113,22 +113,31 @@ class PackageJson(SimpleNamespace):
|
|
|
113
113
|
|
|
114
114
|
_react_version = _determine_react_version()
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
"
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
"
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
116
|
+
@classproperty
|
|
117
|
+
@classmethod
|
|
118
|
+
def DEPENDENCIES(cls) -> dict[str, str]:
|
|
119
|
+
"""The dependencies to include in package.json.
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
A dictionary of dependencies with their versions.
|
|
123
|
+
"""
|
|
124
|
+
return {
|
|
125
|
+
"@emotion/react": "11.14.0",
|
|
126
|
+
"axios": "1.9.0",
|
|
127
|
+
"json5": "2.2.3",
|
|
128
|
+
"next": _determine_nextjs_version(),
|
|
129
|
+
"next-sitemap": "4.2.3",
|
|
130
|
+
"next-themes": "0.4.6",
|
|
131
|
+
"react": cls._react_version,
|
|
132
|
+
"react-dom": cls._react_version,
|
|
133
|
+
"react-focus-lock": "2.13.6",
|
|
134
|
+
"socket.io-client": "4.8.1",
|
|
135
|
+
"universal-cookie": "7.2.2",
|
|
136
|
+
}
|
|
137
|
+
|
|
129
138
|
DEV_DEPENDENCIES = {
|
|
130
139
|
"autoprefixer": "10.4.21",
|
|
131
|
-
"postcss": "8.5.
|
|
140
|
+
"postcss": "8.5.4",
|
|
132
141
|
"postcss-import": "16.1.0",
|
|
133
142
|
}
|
|
134
143
|
OVERRIDES = {
|
|
@@ -35,7 +35,6 @@ def set_loglevel(ctx: Any, self: Any, value: str | None):
|
|
|
35
35
|
@click.group
|
|
36
36
|
def custom_components_cli():
|
|
37
37
|
"""CLI for creating custom components."""
|
|
38
|
-
pass
|
|
39
38
|
|
|
40
39
|
|
|
41
40
|
loglevel_option = click.option(
|
|
@@ -575,7 +574,7 @@ def _validate_url_with_protocol_prefix(url: str | None) -> bool:
|
|
|
575
574
|
Returns:
|
|
576
575
|
Whether the entered URL is acceptable.
|
|
577
576
|
"""
|
|
578
|
-
return not url or (url.startswith("http://"
|
|
577
|
+
return not url or (url.startswith(("http://", "https://")))
|
|
579
578
|
|
|
580
579
|
|
|
581
580
|
def _get_file_from_prompt_in_loop() -> tuple[bytes, str] | None:
|