reflex 0.8.13__py3-none-any.whl → 0.8.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/app.py +25 -5
- reflex/components/core/upload.py +9 -13
- reflex/components/plotly/plotly.py +9 -9
- reflex/components/radix/primitives/slider.py +3 -17
- reflex/components/radix/primitives/slider.pyi +2 -4
- reflex/components/radix/themes/components/slider.py +1 -2
- reflex/components/radix/themes/components/slider.pyi +3 -6
- reflex/constants/colors.py +1 -3
- reflex/constants/installer.py +5 -5
- reflex/custom_components/custom_components.py +18 -18
- reflex/environment.py +3 -0
- reflex/plugins/shared_tailwind.py +1 -1
- reflex/reflex.py +62 -24
- reflex/state.py +3 -2
- reflex/utils/exec.py +23 -4
- reflex/utils/frontend_skeleton.py +3 -5
- reflex/utils/js_runtimes.py +10 -10
- reflex/utils/prerequisites.py +5 -6
- reflex/utils/processes.py +10 -11
- reflex/utils/rename.py +3 -5
- reflex/utils/serializers.py +3 -7
- reflex/utils/templates.py +20 -22
- reflex/vars/color.py +2 -68
- {reflex-0.8.13.dist-info → reflex-0.8.14a1.dist-info}/METADATA +1 -1
- {reflex-0.8.13.dist-info → reflex-0.8.14a1.dist-info}/RECORD +28 -28
- {reflex-0.8.13.dist-info → reflex-0.8.14a1.dist-info}/WHEEL +0 -0
- {reflex-0.8.13.dist-info → reflex-0.8.14a1.dist-info}/entry_points.txt +0 -0
- {reflex-0.8.13.dist-info → reflex-0.8.14a1.dist-info}/licenses/LICENSE +0 -0
reflex/app.py
CHANGED
|
@@ -69,7 +69,6 @@ from reflex.components.core.banner import (
|
|
|
69
69
|
)
|
|
70
70
|
from reflex.components.core.breakpoints import set_breakpoints
|
|
71
71
|
from reflex.components.core.sticky import sticky
|
|
72
|
-
from reflex.components.core.upload import Upload, get_upload_dir
|
|
73
72
|
from reflex.components.radix import themes
|
|
74
73
|
from reflex.components.sonner.toast import toast
|
|
75
74
|
from reflex.config import get_config
|
|
@@ -628,6 +627,18 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
628
627
|
|
|
629
628
|
asgi_app = self._api
|
|
630
629
|
|
|
630
|
+
if environment.REFLEX_MOUNT_FRONTEND_COMPILED_APP.get():
|
|
631
|
+
asgi_app.mount(
|
|
632
|
+
"/" + config.frontend_path.strip("/"),
|
|
633
|
+
StaticFiles(
|
|
634
|
+
directory=prerequisites.get_web_dir()
|
|
635
|
+
/ constants.Dirs.STATIC
|
|
636
|
+
/ config.frontend_path.strip("/"),
|
|
637
|
+
html=True,
|
|
638
|
+
),
|
|
639
|
+
name="frontend",
|
|
640
|
+
)
|
|
641
|
+
|
|
631
642
|
if self.api_transformer is not None:
|
|
632
643
|
api_transformers: Sequence[Starlette | Callable[[ASGIApp], ASGIApp]] = (
|
|
633
644
|
[self.api_transformer]
|
|
@@ -670,6 +681,8 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
670
681
|
|
|
671
682
|
def _add_optional_endpoints(self):
|
|
672
683
|
"""Add optional api endpoints (_upload)."""
|
|
684
|
+
from reflex.components.core.upload import Upload, get_upload_dir
|
|
685
|
+
|
|
673
686
|
if not self._api:
|
|
674
687
|
return
|
|
675
688
|
upload_is_used_marker = (
|
|
@@ -1010,11 +1023,18 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1010
1023
|
for component in tuple(app_wrappers.values()):
|
|
1011
1024
|
app_wrappers.update(component._get_all_app_wrap_components())
|
|
1012
1025
|
order = sorted(app_wrappers, key=lambda k: k[0], reverse=True)
|
|
1013
|
-
root =
|
|
1014
|
-
|
|
1026
|
+
root = copy.deepcopy(app_wrappers[order[0]])
|
|
1027
|
+
|
|
1028
|
+
def reducer(parent: Component, key: tuple[int, str]) -> Component:
|
|
1015
1029
|
child = copy.deepcopy(app_wrappers[key])
|
|
1016
1030
|
parent.children.append(child)
|
|
1017
|
-
|
|
1031
|
+
return child
|
|
1032
|
+
|
|
1033
|
+
functools.reduce(
|
|
1034
|
+
lambda parent, key: reducer(parent, key),
|
|
1035
|
+
order[1:],
|
|
1036
|
+
root,
|
|
1037
|
+
)
|
|
1018
1038
|
return root
|
|
1019
1039
|
|
|
1020
1040
|
def _should_compile(self) -> bool:
|
|
@@ -1274,7 +1294,7 @@ class App(MiddlewareMixin, LifespanMixin):
|
|
|
1274
1294
|
|
|
1275
1295
|
toast_provider = Fragment.create(memoized_toast_provider())
|
|
1276
1296
|
|
|
1277
|
-
app_wrappers[(
|
|
1297
|
+
app_wrappers[(44, "ToasterProvider")] = toast_provider
|
|
1278
1298
|
|
|
1279
1299
|
# Add the app wraps to the app.
|
|
1280
1300
|
for key, app_wrap in chain(
|
reflex/components/core/upload.py
CHANGED
|
@@ -6,6 +6,7 @@ from collections.abc import Callable, Sequence
|
|
|
6
6
|
from pathlib import Path
|
|
7
7
|
from typing import Any, ClassVar
|
|
8
8
|
|
|
9
|
+
from reflex.app import UploadFile
|
|
9
10
|
from reflex.components.base.fragment import Fragment
|
|
10
11
|
from reflex.components.component import (
|
|
11
12
|
Component,
|
|
@@ -29,7 +30,9 @@ from reflex.event import (
|
|
|
29
30
|
call_event_fn,
|
|
30
31
|
call_event_handler,
|
|
31
32
|
parse_args_spec,
|
|
33
|
+
passthrough_event_spec,
|
|
32
34
|
run_script,
|
|
35
|
+
upload_files,
|
|
33
36
|
)
|
|
34
37
|
from reflex.style import Style
|
|
35
38
|
from reflex.utils import format
|
|
@@ -168,16 +171,7 @@ def get_upload_url(file_path: str | Var[str]) -> Var[str]:
|
|
|
168
171
|
return Var.create(f"{uploaded_files_url_prefix}/{file_path}")
|
|
169
172
|
|
|
170
173
|
|
|
171
|
-
|
|
172
|
-
"""Args spec for the on_drop event trigger.
|
|
173
|
-
|
|
174
|
-
Args:
|
|
175
|
-
files: The files to upload.
|
|
176
|
-
|
|
177
|
-
Returns:
|
|
178
|
-
Signature for on_drop handler including the files to upload.
|
|
179
|
-
"""
|
|
180
|
-
return (files,)
|
|
174
|
+
_on_drop_spec = passthrough_event_spec(list[UploadFile])
|
|
181
175
|
|
|
182
176
|
|
|
183
177
|
def _default_drop_rejected(rejected_files: ArrayVar[list[dict[str, Any]]]) -> EventSpec:
|
|
@@ -302,11 +296,11 @@ class Upload(MemoizationLeaf):
|
|
|
302
296
|
}
|
|
303
297
|
|
|
304
298
|
# Create the component.
|
|
305
|
-
upload_props["id"] = props.get("id", DEFAULT_UPLOAD_ID)
|
|
299
|
+
upload_props["id"] = upload_id = props.get("id", DEFAULT_UPLOAD_ID)
|
|
306
300
|
|
|
307
301
|
if upload_props.get("on_drop") is None:
|
|
308
302
|
# If on_drop is not provided, save files to be uploaded later.
|
|
309
|
-
upload_props["on_drop"] = upload_file(
|
|
303
|
+
upload_props["on_drop"] = upload_file(upload_id)
|
|
310
304
|
else:
|
|
311
305
|
on_drop = (
|
|
312
306
|
[on_drop_prop]
|
|
@@ -314,7 +308,9 @@ class Upload(MemoizationLeaf):
|
|
|
314
308
|
else list(on_drop_prop)
|
|
315
309
|
)
|
|
316
310
|
for ix, event in enumerate(on_drop):
|
|
317
|
-
if isinstance(event,
|
|
311
|
+
if isinstance(event, EventHandler):
|
|
312
|
+
event = event(upload_files(upload_id))
|
|
313
|
+
if isinstance(event, EventSpec):
|
|
318
314
|
# Call the lambda to get the event chain.
|
|
319
315
|
event = call_event_handler(event, _on_drop_spec)
|
|
320
316
|
elif isinstance(event, Callable):
|
|
@@ -72,7 +72,7 @@ class Plotly(NoSSRComponent):
|
|
|
72
72
|
|
|
73
73
|
library = "react-plotly.js@2.6.0"
|
|
74
74
|
|
|
75
|
-
lib_dependencies: list[str] = ["plotly.js@3.1.
|
|
75
|
+
lib_dependencies: list[str] = ["plotly.js@3.1.1"]
|
|
76
76
|
|
|
77
77
|
tag = "Plot"
|
|
78
78
|
|
|
@@ -303,7 +303,7 @@ class PlotlyBasic(Plotly):
|
|
|
303
303
|
|
|
304
304
|
library = "react-plotly.js@2.6.0"
|
|
305
305
|
|
|
306
|
-
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.1.
|
|
306
|
+
lib_dependencies: list[str] = ["plotly.js-basic-dist-min@3.1.1"]
|
|
307
307
|
|
|
308
308
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
309
309
|
"""Add imports for the plotly basic component.
|
|
@@ -329,7 +329,7 @@ class PlotlyCartesian(Plotly):
|
|
|
329
329
|
|
|
330
330
|
library = "react-plotly.js@2.6.0"
|
|
331
331
|
|
|
332
|
-
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.1.
|
|
332
|
+
lib_dependencies: list[str] = ["plotly.js-cartesian-dist-min@3.1.1"]
|
|
333
333
|
|
|
334
334
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
335
335
|
"""Add imports for the plotly cartesian component.
|
|
@@ -355,7 +355,7 @@ class PlotlyGeo(Plotly):
|
|
|
355
355
|
|
|
356
356
|
library = "react-plotly.js@2.6.0"
|
|
357
357
|
|
|
358
|
-
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.1.
|
|
358
|
+
lib_dependencies: list[str] = ["plotly.js-geo-dist-min@3.1.1"]
|
|
359
359
|
|
|
360
360
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
361
361
|
"""Add imports for the plotly geo component.
|
|
@@ -381,7 +381,7 @@ class PlotlyGl3d(Plotly):
|
|
|
381
381
|
|
|
382
382
|
library = "react-plotly.js@2.6.0"
|
|
383
383
|
|
|
384
|
-
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.1.
|
|
384
|
+
lib_dependencies: list[str] = ["plotly.js-gl3d-dist-min@3.1.1"]
|
|
385
385
|
|
|
386
386
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
387
387
|
"""Add imports for the plotly 3d component.
|
|
@@ -407,7 +407,7 @@ class PlotlyGl2d(Plotly):
|
|
|
407
407
|
|
|
408
408
|
library = "react-plotly.js@2.6.0"
|
|
409
409
|
|
|
410
|
-
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.1.
|
|
410
|
+
lib_dependencies: list[str] = ["plotly.js-gl2d-dist-min@3.1.1"]
|
|
411
411
|
|
|
412
412
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
413
413
|
"""Add imports for the plotly 2d component.
|
|
@@ -433,7 +433,7 @@ class PlotlyMapbox(Plotly):
|
|
|
433
433
|
|
|
434
434
|
library = "react-plotly.js@2.6.0"
|
|
435
435
|
|
|
436
|
-
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.1.
|
|
436
|
+
lib_dependencies: list[str] = ["plotly.js-mapbox-dist-min@3.1.1"]
|
|
437
437
|
|
|
438
438
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
439
439
|
"""Add imports for the plotly mapbox component.
|
|
@@ -459,7 +459,7 @@ class PlotlyFinance(Plotly):
|
|
|
459
459
|
|
|
460
460
|
library = "react-plotly.js@2.6.0"
|
|
461
461
|
|
|
462
|
-
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.1.
|
|
462
|
+
lib_dependencies: list[str] = ["plotly.js-finance-dist-min@3.1.1"]
|
|
463
463
|
|
|
464
464
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
465
465
|
"""Add imports for the plotly finance component.
|
|
@@ -485,7 +485,7 @@ class PlotlyStrict(Plotly):
|
|
|
485
485
|
|
|
486
486
|
library = "react-plotly.js@2.6.0"
|
|
487
487
|
|
|
488
|
-
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.1.
|
|
488
|
+
lib_dependencies: list[str] = ["plotly.js-strict-dist-min@3.1.1"]
|
|
489
489
|
|
|
490
490
|
def add_imports(self) -> ImportDict | list[ImportDict]:
|
|
491
491
|
"""Add imports for the plotly strict component.
|
|
@@ -7,7 +7,7 @@ from typing import Any, Literal
|
|
|
7
7
|
|
|
8
8
|
from reflex.components.component import Component, ComponentNamespace
|
|
9
9
|
from reflex.components.radix.primitives.base import RadixPrimitiveComponentWithClassName
|
|
10
|
-
from reflex.event import EventHandler
|
|
10
|
+
from reflex.event import EventHandler, passthrough_event_spec
|
|
11
11
|
from reflex.vars.base import Var
|
|
12
12
|
|
|
13
13
|
LiteralSliderOrientation = Literal["horizontal", "vertical"]
|
|
@@ -20,20 +20,6 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
|
|
|
20
20
|
library = "@radix-ui/react-slider@1.3.6"
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
def on_value_event_spec(
|
|
24
|
-
value: Var[list[int]],
|
|
25
|
-
) -> tuple[Var[list[int]]]:
|
|
26
|
-
"""Event handler spec for the value event.
|
|
27
|
-
|
|
28
|
-
Args:
|
|
29
|
-
value: The value of the event.
|
|
30
|
-
|
|
31
|
-
Returns:
|
|
32
|
-
The event handler spec.
|
|
33
|
-
"""
|
|
34
|
-
return (value,)
|
|
35
|
-
|
|
36
|
-
|
|
37
23
|
class SliderRoot(SliderComponent):
|
|
38
24
|
"""The Slider component containing all slider parts."""
|
|
39
25
|
|
|
@@ -63,10 +49,10 @@ class SliderRoot(SliderComponent):
|
|
|
63
49
|
min_steps_between_thumbs: Var[int]
|
|
64
50
|
|
|
65
51
|
# Fired when the value of a thumb changes.
|
|
66
|
-
on_value_change: EventHandler[
|
|
52
|
+
on_value_change: EventHandler[passthrough_event_spec(list[float])]
|
|
67
53
|
|
|
68
54
|
# Fired when a thumb is released.
|
|
69
|
-
on_value_commit: EventHandler[
|
|
55
|
+
on_value_commit: EventHandler[passthrough_event_spec(list[float])]
|
|
70
56
|
|
|
71
57
|
def add_style(self) -> dict[str, Any] | None:
|
|
72
58
|
"""Add style to the component.
|
|
@@ -66,8 +66,6 @@ class SliderComponent(RadixPrimitiveComponentWithClassName):
|
|
|
66
66
|
The component.
|
|
67
67
|
"""
|
|
68
68
|
|
|
69
|
-
def on_value_event_spec(value: Var[list[int]]) -> tuple[Var[list[int]]]: ...
|
|
70
|
-
|
|
71
69
|
class SliderRoot(SliderComponent):
|
|
72
70
|
def add_style(self) -> dict[str, Any] | None: ...
|
|
73
71
|
@classmethod
|
|
@@ -114,8 +112,8 @@ class SliderRoot(SliderComponent):
|
|
|
114
112
|
on_scroll: EventType[()] | None = None,
|
|
115
113
|
on_scroll_end: EventType[()] | None = None,
|
|
116
114
|
on_unmount: EventType[()] | None = None,
|
|
117
|
-
on_value_change: EventType[()] | EventType[list[
|
|
118
|
-
on_value_commit: EventType[()] | EventType[list[
|
|
115
|
+
on_value_change: EventType[()] | EventType[list[float]] | None = None,
|
|
116
|
+
on_value_commit: EventType[()] | EventType[list[float]] | None = None,
|
|
119
117
|
**props,
|
|
120
118
|
) -> SliderRoot:
|
|
121
119
|
"""Create the component.
|
|
@@ -13,9 +13,8 @@ from reflex.utils.types import typehint_issubclass
|
|
|
13
13
|
from reflex.vars.base import Var
|
|
14
14
|
|
|
15
15
|
on_value_event_spec = (
|
|
16
|
-
passthrough_event_spec(list[int | float]),
|
|
17
|
-
passthrough_event_spec(list[int]),
|
|
18
16
|
passthrough_event_spec(list[float]),
|
|
17
|
+
passthrough_event_spec(list[int]),
|
|
19
18
|
)
|
|
20
19
|
|
|
21
20
|
|
|
@@ -12,9 +12,8 @@ from reflex.event import EventType, PointerEventInfo, passthrough_event_spec
|
|
|
12
12
|
from reflex.vars.base import Var
|
|
13
13
|
|
|
14
14
|
on_value_event_spec = (
|
|
15
|
-
passthrough_event_spec(list[int | float]),
|
|
16
|
-
passthrough_event_spec(list[int]),
|
|
17
15
|
passthrough_event_spec(list[float]),
|
|
16
|
+
passthrough_event_spec(list[int]),
|
|
18
17
|
)
|
|
19
18
|
|
|
20
19
|
class Slider(RadixThemesComponent):
|
|
@@ -120,9 +119,8 @@ class Slider(RadixThemesComponent):
|
|
|
120
119
|
custom_attrs: dict[str, Var | Any] | None = None,
|
|
121
120
|
on_blur: EventType[()] | None = None,
|
|
122
121
|
on_change: EventType[()]
|
|
123
|
-
| EventType[list[
|
|
122
|
+
| EventType[list[float]]
|
|
124
123
|
| (EventType[()] | EventType[list[int]])
|
|
125
|
-
| (EventType[()] | EventType[list[float]])
|
|
126
124
|
| None = None,
|
|
127
125
|
on_click: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
128
126
|
on_context_menu: EventType[()] | EventType[PointerEventInfo] | None = None,
|
|
@@ -140,9 +138,8 @@ class Slider(RadixThemesComponent):
|
|
|
140
138
|
on_scroll_end: EventType[()] | None = None,
|
|
141
139
|
on_unmount: EventType[()] | None = None,
|
|
142
140
|
on_value_commit: EventType[()]
|
|
143
|
-
| EventType[list[
|
|
141
|
+
| EventType[list[float]]
|
|
144
142
|
| (EventType[()] | EventType[list[int]])
|
|
145
|
-
| (EventType[()] | EventType[list[float]])
|
|
146
143
|
| None = None,
|
|
147
144
|
**props,
|
|
148
145
|
) -> Slider:
|
reflex/constants/colors.py
CHANGED
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.23"
|
|
18
18
|
|
|
19
19
|
# Min Bun Version
|
|
20
20
|
MIN_VERSION = "1.2.17"
|
|
@@ -75,7 +75,7 @@ fetch-retries=0
|
|
|
75
75
|
|
|
76
76
|
|
|
77
77
|
def _determine_react_router_version() -> str:
|
|
78
|
-
default_version = "7.9.
|
|
78
|
+
default_version = "7.9.3"
|
|
79
79
|
if (version := os.getenv("REACT_ROUTER_VERSION")) and version != default_version:
|
|
80
80
|
from reflex.utils import console
|
|
81
81
|
|
|
@@ -131,7 +131,7 @@ class PackageJson(SimpleNamespace):
|
|
|
131
131
|
"react": cls._react_version,
|
|
132
132
|
"react-helmet": "6.1.0",
|
|
133
133
|
"react-dom": cls._react_version,
|
|
134
|
-
"isbot": "5.1.
|
|
134
|
+
"isbot": "5.1.31",
|
|
135
135
|
"socket.io-client": "4.8.1",
|
|
136
136
|
"universal-cookie": "7.2.2",
|
|
137
137
|
}
|
|
@@ -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.
|
|
146
|
+
"vite": "npm:rolldown-vite@7.1.13",
|
|
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.
|
|
152
|
+
"vite": "npm:rolldown-vite@7.1.13",
|
|
153
153
|
}
|
|
@@ -359,7 +359,7 @@ def _get_default_library_name_parts() -> list[str]:
|
|
|
359
359
|
"""Get the default library name. Based on the current directory name, remove any non-alphanumeric characters.
|
|
360
360
|
|
|
361
361
|
Raises:
|
|
362
|
-
|
|
362
|
+
SystemExit: If the current directory name is not suitable for python projects, and we cannot find a valid library name based off it.
|
|
363
363
|
|
|
364
364
|
Returns:
|
|
365
365
|
The parts of default library name.
|
|
@@ -377,13 +377,13 @@ def _get_default_library_name_parts() -> list[str]:
|
|
|
377
377
|
console.error(
|
|
378
378
|
f"Based on current directory name {current_dir_name}, the library name is {constants.Reflex.MODULE_NAME}. This package already exists. Please use --library-name to specify a different name."
|
|
379
379
|
)
|
|
380
|
-
raise
|
|
380
|
+
raise SystemExit(1)
|
|
381
381
|
if not parts:
|
|
382
382
|
# The folder likely has a name not suitable for python paths.
|
|
383
383
|
console.error(
|
|
384
384
|
f"Could not find a valid library name based on the current directory: got {current_dir_name}."
|
|
385
385
|
)
|
|
386
|
-
raise
|
|
386
|
+
raise SystemExit(1)
|
|
387
387
|
return parts
|
|
388
388
|
|
|
389
389
|
|
|
@@ -408,7 +408,7 @@ def _validate_library_name(library_name: str | None) -> NameVariants:
|
|
|
408
408
|
library_name: The name of the library if picked otherwise None.
|
|
409
409
|
|
|
410
410
|
Raises:
|
|
411
|
-
|
|
411
|
+
SystemExit: If the library name is not suitable for python projects.
|
|
412
412
|
|
|
413
413
|
Returns:
|
|
414
414
|
A tuple containing the various names such as package name, class name, etc., needed for the project.
|
|
@@ -419,7 +419,7 @@ def _validate_library_name(library_name: str | None) -> NameVariants:
|
|
|
419
419
|
console.error(
|
|
420
420
|
f"Please use only alphanumeric characters or dashes: got {library_name}"
|
|
421
421
|
)
|
|
422
|
-
raise
|
|
422
|
+
raise SystemExit(1)
|
|
423
423
|
|
|
424
424
|
# If not specified, use the current directory name to form the module name.
|
|
425
425
|
name_parts = (
|
|
@@ -513,13 +513,13 @@ def init(
|
|
|
513
513
|
install: Whether to install package from this local custom component in editable mode.
|
|
514
514
|
|
|
515
515
|
Raises:
|
|
516
|
-
|
|
516
|
+
SystemExit: If the pyproject.toml already exists.
|
|
517
517
|
"""
|
|
518
518
|
from reflex.utils import exec
|
|
519
519
|
|
|
520
520
|
if CustomComponents.PYPROJECT_TOML.exists():
|
|
521
521
|
console.error(f"A {CustomComponents.PYPROJECT_TOML} already exists. Aborting.")
|
|
522
|
-
|
|
522
|
+
raise SystemExit(1)
|
|
523
523
|
|
|
524
524
|
# Show system info.
|
|
525
525
|
exec.output_system_info()
|
|
@@ -544,7 +544,7 @@ def init(
|
|
|
544
544
|
if _pip_install_on_demand(package_name=".", install_args=["-e"]):
|
|
545
545
|
console.info(f"Package {package_name} installed!")
|
|
546
546
|
else:
|
|
547
|
-
raise
|
|
547
|
+
raise SystemExit(1)
|
|
548
548
|
|
|
549
549
|
console.print("[bold]Custom component initialized successfully!")
|
|
550
550
|
console.rule("[bold]Project Summary")
|
|
@@ -627,7 +627,7 @@ def _run_build():
|
|
|
627
627
|
"""Run the build command.
|
|
628
628
|
|
|
629
629
|
Raises:
|
|
630
|
-
|
|
630
|
+
SystemExit: If the build fails.
|
|
631
631
|
"""
|
|
632
632
|
console.print("Building custom component...")
|
|
633
633
|
|
|
@@ -637,7 +637,7 @@ def _run_build():
|
|
|
637
637
|
if _run_commands_in_subprocess(cmds):
|
|
638
638
|
console.info("Custom component built successfully!")
|
|
639
639
|
else:
|
|
640
|
-
raise
|
|
640
|
+
raise SystemExit(1)
|
|
641
641
|
|
|
642
642
|
|
|
643
643
|
@custom_components_cli.command(name="build")
|
|
@@ -651,7 +651,7 @@ def _collect_details_for_gallery():
|
|
|
651
651
|
"""Helper to collect details on the custom component to be included in the gallery.
|
|
652
652
|
|
|
653
653
|
Raises:
|
|
654
|
-
|
|
654
|
+
SystemExit: If pyproject.toml file is ill-formed or the request to the backend services fails.
|
|
655
655
|
"""
|
|
656
656
|
import httpx
|
|
657
657
|
from reflex_cli.utils import hosting
|
|
@@ -664,7 +664,7 @@ def _collect_details_for_gallery():
|
|
|
664
664
|
console.error(
|
|
665
665
|
"Unable to authenticate with Reflex backend services. Make sure you are logged in."
|
|
666
666
|
)
|
|
667
|
-
raise
|
|
667
|
+
raise SystemExit(1)
|
|
668
668
|
|
|
669
669
|
console.rule("[bold]Custom Component Information")
|
|
670
670
|
params = {}
|
|
@@ -694,11 +694,11 @@ def _collect_details_for_gallery():
|
|
|
694
694
|
console.error(
|
|
695
695
|
f"{package_name} is owned by another user. Unable to update the information for it."
|
|
696
696
|
)
|
|
697
|
-
raise
|
|
697
|
+
raise SystemExit(1)
|
|
698
698
|
response.raise_for_status()
|
|
699
699
|
except httpx.HTTPError as he:
|
|
700
700
|
console.error(f"Unable to complete request due to {he}.")
|
|
701
|
-
raise
|
|
701
|
+
raise SystemExit(1) from None
|
|
702
702
|
|
|
703
703
|
files = []
|
|
704
704
|
if (image_file_and_extension := _get_file_from_prompt_in_loop()) is not None:
|
|
@@ -733,7 +733,7 @@ def _collect_details_for_gallery():
|
|
|
733
733
|
|
|
734
734
|
except httpx.HTTPError as he:
|
|
735
735
|
console.error(f"Unable to complete request due to {he}.")
|
|
736
|
-
raise
|
|
736
|
+
raise SystemExit(1) from None
|
|
737
737
|
|
|
738
738
|
console.info("Custom component information successfully shared!")
|
|
739
739
|
|
|
@@ -769,7 +769,7 @@ def _get_file_from_prompt_in_loop() -> tuple[bytes, str] | None:
|
|
|
769
769
|
image_file = image_file_path.read_bytes()
|
|
770
770
|
except OSError as ose:
|
|
771
771
|
console.error(f"Unable to read the {file_extension} file due to {ose}")
|
|
772
|
-
raise
|
|
772
|
+
raise SystemExit(1) from None
|
|
773
773
|
else:
|
|
774
774
|
return image_file, file_extension
|
|
775
775
|
|
|
@@ -790,9 +790,9 @@ def install():
|
|
|
790
790
|
"""Install package from this local custom component in editable mode.
|
|
791
791
|
|
|
792
792
|
Raises:
|
|
793
|
-
|
|
793
|
+
SystemExit: If unable to install the current directory in editable mode.
|
|
794
794
|
"""
|
|
795
795
|
if _pip_install_on_demand(package_name=".", install_args=["-e"]):
|
|
796
796
|
console.info("Package installed successfully!")
|
|
797
797
|
else:
|
|
798
|
-
raise
|
|
798
|
+
raise SystemExit(1)
|
reflex/environment.py
CHANGED
|
@@ -660,6 +660,9 @@ class EnvironmentVariables:
|
|
|
660
660
|
# Whether to enable SSR for the frontend.
|
|
661
661
|
REFLEX_SSR: EnvVar[bool] = env_var(True)
|
|
662
662
|
|
|
663
|
+
# Whether to mount the compiled frontend app in the backend server in production.
|
|
664
|
+
REFLEX_MOUNT_FRONTEND_COMPILED_APP: EnvVar[bool] = env_var(False, internal=True)
|
|
665
|
+
|
|
663
666
|
|
|
664
667
|
environment = EnvironmentVariables()
|
|
665
668
|
|