reflex 0.4.7a2__py3-none-any.whl → 0.4.8__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/web/utils/state.js +7 -1
- reflex/app.py +15 -1
- reflex/compiler/utils.py +1 -1
- reflex/components/base/body.pyi +0 -3
- reflex/components/base/document.pyi +0 -15
- reflex/components/base/fragment.pyi +0 -3
- reflex/components/base/head.pyi +0 -3
- reflex/components/base/link.pyi +0 -6
- reflex/components/base/meta.pyi +0 -12
- reflex/components/chakra/base.pyi +0 -6
- reflex/components/chakra/datadisplay/badge.pyi +0 -3
- reflex/components/chakra/datadisplay/code.pyi +0 -3
- reflex/components/chakra/datadisplay/divider.pyi +0 -3
- reflex/components/chakra/datadisplay/keyboard_key.pyi +0 -3
- reflex/components/chakra/datadisplay/list.pyi +0 -3
- reflex/components/chakra/datadisplay/stat.pyi +0 -15
- reflex/components/chakra/datadisplay/table.pyi +0 -12
- reflex/components/chakra/datadisplay/tag.pyi +0 -12
- reflex/components/chakra/disclosure/accordion.pyi +0 -12
- reflex/components/chakra/disclosure/tabs.pyi +0 -12
- reflex/components/chakra/disclosure/transition.pyi +0 -18
- reflex/components/chakra/disclosure/visuallyhidden.pyi +0 -3
- reflex/components/chakra/feedback/alert.pyi +0 -9
- reflex/components/chakra/feedback/circularprogress.pyi +0 -3
- reflex/components/chakra/feedback/progress.pyi +0 -3
- reflex/components/chakra/feedback/skeleton.pyi +0 -9
- reflex/components/chakra/feedback/spinner.pyi +0 -3
- reflex/components/chakra/forms/button.pyi +0 -6
- reflex/components/chakra/forms/checkbox.pyi +0 -6
- reflex/components/chakra/forms/colormodeswitch.pyi +0 -3
- reflex/components/chakra/forms/editable.pyi +0 -12
- reflex/components/chakra/forms/form.pyi +0 -9
- reflex/components/chakra/forms/iconbutton.pyi +0 -3
- reflex/components/chakra/forms/input.pyi +0 -15
- reflex/components/chakra/forms/numberinput.pyi +0 -12
- reflex/components/chakra/forms/pininput.py +1 -1
- reflex/components/chakra/forms/pininput.pyi +1 -4
- reflex/components/chakra/forms/radio.py +1 -1
- reflex/components/chakra/forms/radio.pyi +1 -1
- reflex/components/chakra/forms/rangeslider.py +1 -1
- reflex/components/chakra/forms/rangeslider.pyi +1 -10
- reflex/components/chakra/forms/slider.pyi +0 -12
- reflex/components/chakra/forms/switch.pyi +0 -3
- reflex/components/chakra/layout/aspect_ratio.pyi +0 -3
- reflex/components/chakra/layout/box.pyi +0 -3
- reflex/components/chakra/layout/card.pyi +0 -9
- reflex/components/chakra/layout/center.pyi +0 -9
- reflex/components/chakra/layout/container.pyi +0 -3
- reflex/components/chakra/layout/flex.pyi +0 -3
- reflex/components/chakra/layout/grid.pyi +0 -9
- reflex/components/chakra/layout/spacer.pyi +0 -3
- reflex/components/chakra/layout/stack.pyi +0 -9
- reflex/components/chakra/layout/wrap.pyi +0 -3
- reflex/components/chakra/media/avatar.pyi +0 -9
- reflex/components/chakra/media/icon.pyi +0 -3
- reflex/components/chakra/navigation/breadcrumb.pyi +0 -3
- reflex/components/chakra/navigation/linkoverlay.pyi +0 -6
- reflex/components/chakra/navigation/stepper.pyi +0 -24
- reflex/components/chakra/overlay/alertdialog.pyi +0 -18
- reflex/components/chakra/overlay/drawer.pyi +0 -18
- reflex/components/chakra/overlay/menu.pyi +0 -18
- reflex/components/chakra/overlay/modal.pyi +0 -18
- reflex/components/chakra/overlay/popover.pyi +0 -24
- reflex/components/chakra/overlay/tooltip.pyi +0 -3
- reflex/components/chakra/typography/heading.pyi +0 -3
- reflex/components/chakra/typography/highlight.pyi +0 -3
- reflex/components/chakra/typography/span.pyi +0 -3
- reflex/components/chakra/typography/text.pyi +0 -3
- reflex/components/component.py +61 -22
- reflex/components/core/client_side_routing.pyi +0 -6
- reflex/components/core/upload.py +3 -1
- reflex/components/core/upload.pyi +0 -3
- reflex/components/el/element.pyi +0 -3
- reflex/components/el/elements/base.pyi +0 -3
- reflex/components/el/elements/forms.pyi +0 -39
- reflex/components/el/elements/inline.pyi +0 -84
- reflex/components/el/elements/media.pyi +0 -42
- reflex/components/el/elements/metadata.pyi +0 -15
- reflex/components/el/elements/other.pyi +0 -21
- reflex/components/el/elements/scripts.pyi +0 -9
- reflex/components/el/elements/sectioning.pyi +0 -45
- reflex/components/el/elements/tables.pyi +0 -30
- reflex/components/el/elements/typography.pyi +0 -45
- reflex/components/gridjs/datatable.pyi +0 -3
- reflex/components/lucide/icon.pyi +0 -3
- reflex/components/next/base.pyi +0 -3
- reflex/components/next/link.pyi +0 -3
- reflex/components/plotly/plotly.pyi +0 -6
- reflex/components/radix/primitives/accordion.pyi +0 -3
- reflex/components/radix/primitives/base.pyi +0 -6
- reflex/components/radix/primitives/drawer.pyi +0 -21
- reflex/components/radix/primitives/form.pyi +0 -18
- reflex/components/radix/primitives/progress.pyi +0 -9
- reflex/components/radix/primitives/slider.pyi +0 -15
- reflex/components/radix/themes/base.pyi +0 -6
- reflex/components/react_player/audio.pyi +0 -3
- reflex/components/react_player/react_player.pyi +0 -3
- reflex/components/react_player/video.pyi +0 -3
- reflex/components/recharts/cartesian.pyi +0 -57
- reflex/components/recharts/general.pyi +0 -12
- reflex/components/recharts/polar.pyi +0 -18
- reflex/components/recharts/recharts.pyi +0 -3
- reflex/constants/__init__.py +2 -0
- reflex/constants/base.py +5 -0
- reflex/constants/compiler.py +2 -0
- reflex/constants/installer.py +4 -2
- reflex/custom_components/custom_components.py +28 -34
- reflex/event.py +7 -6
- reflex/experimental/__init__.py +2 -0
- reflex/experimental/misc.py +12 -0
- reflex/model.py +1 -1
- reflex/reflex.py +0 -1
- reflex/utils/compat.py +43 -0
- reflex/utils/console.py +10 -1
- reflex/utils/export.py +1 -3
- reflex/utils/imports.py +14 -1
- reflex/utils/prerequisites.py +71 -45
- reflex/utils/processes.py +41 -4
- reflex/utils/serializers.py +14 -0
- reflex/utils/types.py +4 -3
- {reflex-0.4.7a2.dist-info → reflex-0.4.8.dist-info}/METADATA +1 -1
- {reflex-0.4.7a2.dist-info → reflex-0.4.8.dist-info}/RECORD +125 -123
- {reflex-0.4.7a2.dist-info → reflex-0.4.8.dist-info}/WHEEL +1 -1
- {reflex-0.4.7a2.dist-info → reflex-0.4.8.dist-info}/LICENSE +0 -0
- {reflex-0.4.7a2.dist-info → reflex-0.4.8.dist-info}/entry_points.txt +0 -0
|
@@ -144,9 +144,6 @@ class Axis(Recharts):
|
|
|
144
144
|
|
|
145
145
|
Returns:
|
|
146
146
|
The component.
|
|
147
|
-
|
|
148
|
-
Raises:
|
|
149
|
-
TypeError: If an invalid child is passed.
|
|
150
147
|
"""
|
|
151
148
|
...
|
|
152
149
|
|
|
@@ -267,9 +264,6 @@ class XAxis(Axis):
|
|
|
267
264
|
|
|
268
265
|
Returns:
|
|
269
266
|
The component.
|
|
270
|
-
|
|
271
|
-
Raises:
|
|
272
|
-
TypeError: If an invalid child is passed.
|
|
273
267
|
"""
|
|
274
268
|
...
|
|
275
269
|
|
|
@@ -390,9 +384,6 @@ class YAxis(Axis):
|
|
|
390
384
|
|
|
391
385
|
Returns:
|
|
392
386
|
The component.
|
|
393
|
-
|
|
394
|
-
Raises:
|
|
395
|
-
TypeError: If an invalid child is passed.
|
|
396
387
|
"""
|
|
397
388
|
...
|
|
398
389
|
|
|
@@ -518,9 +509,6 @@ class ZAxis(Recharts):
|
|
|
518
509
|
|
|
519
510
|
Returns:
|
|
520
511
|
The component.
|
|
521
|
-
|
|
522
|
-
Raises:
|
|
523
|
-
TypeError: If an invalid child is passed.
|
|
524
512
|
"""
|
|
525
513
|
...
|
|
526
514
|
|
|
@@ -578,9 +566,6 @@ class Brush(Recharts):
|
|
|
578
566
|
|
|
579
567
|
Returns:
|
|
580
568
|
The component.
|
|
581
|
-
|
|
582
|
-
Raises:
|
|
583
|
-
TypeError: If an invalid child is passed.
|
|
584
569
|
"""
|
|
585
570
|
...
|
|
586
571
|
|
|
@@ -644,9 +629,6 @@ class Cartesian(Recharts):
|
|
|
644
629
|
|
|
645
630
|
Returns:
|
|
646
631
|
The component.
|
|
647
|
-
|
|
648
|
-
Raises:
|
|
649
|
-
TypeError: If an invalid child is passed.
|
|
650
632
|
"""
|
|
651
633
|
...
|
|
652
634
|
|
|
@@ -764,9 +746,6 @@ class Area(Cartesian):
|
|
|
764
746
|
|
|
765
747
|
Returns:
|
|
766
748
|
The component.
|
|
767
|
-
|
|
768
|
-
Raises:
|
|
769
|
-
TypeError: If an invalid child is passed.
|
|
770
749
|
"""
|
|
771
750
|
...
|
|
772
751
|
|
|
@@ -845,9 +824,6 @@ class Bar(Cartesian):
|
|
|
845
824
|
|
|
846
825
|
Returns:
|
|
847
826
|
The component.
|
|
848
|
-
|
|
849
|
-
Raises:
|
|
850
|
-
TypeError: If an invalid child is passed.
|
|
851
827
|
"""
|
|
852
828
|
...
|
|
853
829
|
|
|
@@ -965,9 +941,6 @@ class Line(Cartesian):
|
|
|
965
941
|
|
|
966
942
|
Returns:
|
|
967
943
|
The component.
|
|
968
|
-
|
|
969
|
-
Raises:
|
|
970
|
-
TypeError: If an invalid child is passed.
|
|
971
944
|
"""
|
|
972
945
|
...
|
|
973
946
|
|
|
@@ -1063,9 +1036,6 @@ class Scatter(Cartesian):
|
|
|
1063
1036
|
|
|
1064
1037
|
Returns:
|
|
1065
1038
|
The component.
|
|
1066
|
-
|
|
1067
|
-
Raises:
|
|
1068
|
-
TypeError: If an invalid child is passed.
|
|
1069
1039
|
"""
|
|
1070
1040
|
...
|
|
1071
1041
|
|
|
@@ -1141,9 +1111,6 @@ class Funnel(Cartesian):
|
|
|
1141
1111
|
|
|
1142
1112
|
Returns:
|
|
1143
1113
|
The component.
|
|
1144
|
-
|
|
1145
|
-
Raises:
|
|
1146
|
-
TypeError: If an invalid child is passed.
|
|
1147
1114
|
"""
|
|
1148
1115
|
...
|
|
1149
1116
|
|
|
@@ -1232,9 +1199,6 @@ class ErrorBar(Recharts):
|
|
|
1232
1199
|
|
|
1233
1200
|
Returns:
|
|
1234
1201
|
The component.
|
|
1235
|
-
|
|
1236
|
-
Raises:
|
|
1237
|
-
TypeError: If an invalid child is passed.
|
|
1238
1202
|
"""
|
|
1239
1203
|
...
|
|
1240
1204
|
|
|
@@ -1328,9 +1292,6 @@ class Reference(Recharts):
|
|
|
1328
1292
|
|
|
1329
1293
|
Returns:
|
|
1330
1294
|
The component.
|
|
1331
|
-
|
|
1332
|
-
Raises:
|
|
1333
|
-
TypeError: If an invalid child is passed.
|
|
1334
1295
|
"""
|
|
1335
1296
|
...
|
|
1336
1297
|
|
|
@@ -1426,9 +1387,6 @@ class ReferenceLine(Reference):
|
|
|
1426
1387
|
|
|
1427
1388
|
Returns:
|
|
1428
1389
|
The component.
|
|
1429
|
-
|
|
1430
|
-
Raises:
|
|
1431
|
-
TypeError: If an invalid child is passed.
|
|
1432
1390
|
"""
|
|
1433
1391
|
...
|
|
1434
1392
|
|
|
@@ -1496,9 +1454,6 @@ class ReferenceDot(Reference):
|
|
|
1496
1454
|
|
|
1497
1455
|
Returns:
|
|
1498
1456
|
The component.
|
|
1499
|
-
|
|
1500
|
-
Raises:
|
|
1501
|
-
TypeError: If an invalid child is passed.
|
|
1502
1457
|
"""
|
|
1503
1458
|
...
|
|
1504
1459
|
|
|
@@ -1602,9 +1557,6 @@ class ReferenceArea(Recharts):
|
|
|
1602
1557
|
|
|
1603
1558
|
Returns:
|
|
1604
1559
|
The component.
|
|
1605
|
-
|
|
1606
|
-
Raises:
|
|
1607
|
-
TypeError: If an invalid child is passed.
|
|
1608
1560
|
"""
|
|
1609
1561
|
...
|
|
1610
1562
|
|
|
@@ -1689,9 +1641,6 @@ class Grid(Recharts):
|
|
|
1689
1641
|
|
|
1690
1642
|
Returns:
|
|
1691
1643
|
The component.
|
|
1692
|
-
|
|
1693
|
-
Raises:
|
|
1694
|
-
TypeError: If an invalid child is passed.
|
|
1695
1644
|
"""
|
|
1696
1645
|
...
|
|
1697
1646
|
|
|
@@ -1786,9 +1735,6 @@ class CartesianGrid(Grid):
|
|
|
1786
1735
|
|
|
1787
1736
|
Returns:
|
|
1788
1737
|
The component.
|
|
1789
|
-
|
|
1790
|
-
Raises:
|
|
1791
|
-
TypeError: If an invalid child is passed.
|
|
1792
1738
|
"""
|
|
1793
1739
|
...
|
|
1794
1740
|
|
|
@@ -1901,8 +1847,5 @@ class CartesianAxis(Grid):
|
|
|
1901
1847
|
|
|
1902
1848
|
Returns:
|
|
1903
1849
|
The component.
|
|
1904
|
-
|
|
1905
|
-
Raises:
|
|
1906
|
-
TypeError: If an invalid child is passed.
|
|
1907
1850
|
"""
|
|
1908
1851
|
...
|
|
@@ -219,9 +219,6 @@ class Legend(Recharts):
|
|
|
219
219
|
|
|
220
220
|
Returns:
|
|
221
221
|
The component.
|
|
222
|
-
|
|
223
|
-
Raises:
|
|
224
|
-
TypeError: If an invalid child is passed.
|
|
225
222
|
"""
|
|
226
223
|
...
|
|
227
224
|
|
|
@@ -314,9 +311,6 @@ class GraphingTooltip(Recharts):
|
|
|
314
311
|
|
|
315
312
|
Returns:
|
|
316
313
|
The component.
|
|
317
|
-
|
|
318
|
-
Raises:
|
|
319
|
-
TypeError: If an invalid child is passed.
|
|
320
314
|
"""
|
|
321
315
|
...
|
|
322
316
|
|
|
@@ -446,9 +440,6 @@ class Label(Recharts):
|
|
|
446
440
|
|
|
447
441
|
Returns:
|
|
448
442
|
The component.
|
|
449
|
-
|
|
450
|
-
Raises:
|
|
451
|
-
TypeError: If an invalid child is passed.
|
|
452
443
|
"""
|
|
453
444
|
...
|
|
454
445
|
|
|
@@ -580,8 +571,5 @@ class LabelList(Recharts):
|
|
|
580
571
|
|
|
581
572
|
Returns:
|
|
582
573
|
The component.
|
|
583
|
-
|
|
584
|
-
Raises:
|
|
585
|
-
TypeError: If an invalid child is passed.
|
|
586
574
|
"""
|
|
587
575
|
...
|
|
@@ -97,9 +97,6 @@ class Pie(Recharts):
|
|
|
97
97
|
|
|
98
98
|
Returns:
|
|
99
99
|
The component.
|
|
100
|
-
|
|
101
|
-
Raises:
|
|
102
|
-
TypeError: If an invalid child is passed.
|
|
103
100
|
"""
|
|
104
101
|
...
|
|
105
102
|
|
|
@@ -203,9 +200,6 @@ class Radar(Recharts):
|
|
|
203
200
|
|
|
204
201
|
Returns:
|
|
205
202
|
The component.
|
|
206
|
-
|
|
207
|
-
Raises:
|
|
208
|
-
TypeError: If an invalid child is passed.
|
|
209
203
|
"""
|
|
210
204
|
...
|
|
211
205
|
|
|
@@ -266,9 +260,6 @@ class RadialBar(Recharts):
|
|
|
266
260
|
|
|
267
261
|
Returns:
|
|
268
262
|
The component.
|
|
269
|
-
|
|
270
|
-
Raises:
|
|
271
|
-
TypeError: If an invalid child is passed.
|
|
272
263
|
"""
|
|
273
264
|
...
|
|
274
265
|
|
|
@@ -345,9 +336,6 @@ class PolarAngleAxis(Recharts):
|
|
|
345
336
|
|
|
346
337
|
Returns:
|
|
347
338
|
The component.
|
|
348
|
-
|
|
349
|
-
Raises:
|
|
350
|
-
TypeError: If an invalid child is passed.
|
|
351
339
|
"""
|
|
352
340
|
...
|
|
353
341
|
|
|
@@ -440,9 +428,6 @@ class PolarGrid(Recharts):
|
|
|
440
428
|
|
|
441
429
|
Returns:
|
|
442
430
|
The component.
|
|
443
|
-
|
|
444
|
-
Raises:
|
|
445
|
-
TypeError: If an invalid child is passed.
|
|
446
431
|
"""
|
|
447
432
|
...
|
|
448
433
|
|
|
@@ -558,8 +543,5 @@ class PolarRadiusAxis(Recharts):
|
|
|
558
543
|
|
|
559
544
|
Returns:
|
|
560
545
|
The component.
|
|
561
|
-
|
|
562
|
-
Raises:
|
|
563
|
-
TypeError: If an invalid child is passed.
|
|
564
546
|
"""
|
|
565
547
|
...
|
reflex/constants/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@ from .base import (
|
|
|
4
4
|
COOKIES,
|
|
5
5
|
ENV_MODE_ENV_VAR,
|
|
6
6
|
IS_WINDOWS,
|
|
7
|
+
IS_WINDOWS_BUN_SUPPORTED_MACHINE, # type: ignore
|
|
7
8
|
LOCAL_STORAGE,
|
|
8
9
|
POLLING_MAX_HTTP_BUFFER_SIZE,
|
|
9
10
|
PYTEST_CURRENT_TEST,
|
|
@@ -86,6 +87,7 @@ __ALL__ = [
|
|
|
86
87
|
Hooks,
|
|
87
88
|
Imports,
|
|
88
89
|
IS_WINDOWS,
|
|
90
|
+
IS_WINDOWS_BUN_SUPPORTED_MACHINE,
|
|
89
91
|
LOCAL_STORAGE,
|
|
90
92
|
LogLevel,
|
|
91
93
|
MemoizationDisposition,
|
reflex/constants/base.py
CHANGED
|
@@ -11,6 +11,11 @@ from types import SimpleNamespace
|
|
|
11
11
|
from platformdirs import PlatformDirs
|
|
12
12
|
|
|
13
13
|
IS_WINDOWS = platform.system() == "Windows"
|
|
14
|
+
# https://github.com/oven-sh/bun/blob/main/src/cli/install.ps1
|
|
15
|
+
IS_WINDOWS_BUN_SUPPORTED_MACHINE = IS_WINDOWS and platform.machine() in [
|
|
16
|
+
"AMD64",
|
|
17
|
+
"x86_64",
|
|
18
|
+
] # filter out 32 bit + ARM
|
|
14
19
|
|
|
15
20
|
|
|
16
21
|
class Dirs(SimpleNamespace):
|
reflex/constants/compiler.py
CHANGED
reflex/constants/installer.py
CHANGED
|
@@ -35,13 +35,15 @@ class Bun(SimpleNamespace):
|
|
|
35
35
|
"""Bun constants."""
|
|
36
36
|
|
|
37
37
|
# The Bun version.
|
|
38
|
-
VERSION = "1.
|
|
38
|
+
VERSION = "1.1.3"
|
|
39
39
|
# Min Bun Version
|
|
40
40
|
MIN_VERSION = "0.7.0"
|
|
41
41
|
# The directory to store the bun.
|
|
42
42
|
ROOT_PATH = os.path.join(Reflex.DIR, "bun")
|
|
43
43
|
# Default bun path.
|
|
44
|
-
DEFAULT_PATH = os.path.join(
|
|
44
|
+
DEFAULT_PATH = os.path.join(
|
|
45
|
+
ROOT_PATH, "bin", "bun" if not IS_WINDOWS else "bun.exe"
|
|
46
|
+
)
|
|
45
47
|
# URL to bun install script.
|
|
46
48
|
INSTALL_URL = "https://bun.sh/install"
|
|
47
49
|
|
|
@@ -71,6 +71,28 @@ def _create_package_config(module_name: str, package_name: str):
|
|
|
71
71
|
)
|
|
72
72
|
|
|
73
73
|
|
|
74
|
+
def _get_package_config(exit_on_fail: bool = True) -> dict:
|
|
75
|
+
"""Get the package configuration from the pyproject.toml file.
|
|
76
|
+
|
|
77
|
+
Args:
|
|
78
|
+
exit_on_fail: Whether to exit if the pyproject.toml file is not found.
|
|
79
|
+
|
|
80
|
+
Returns:
|
|
81
|
+
The package configuration.
|
|
82
|
+
|
|
83
|
+
Raises:
|
|
84
|
+
Exit: If the pyproject.toml file is not found.
|
|
85
|
+
"""
|
|
86
|
+
try:
|
|
87
|
+
with open(CustomComponents.PYPROJECT_TOML, "rb") as f:
|
|
88
|
+
return dict(tomlkit.load(f))
|
|
89
|
+
except (OSError, TOMLKitError) as ex:
|
|
90
|
+
console.error(f"Unable to read from pyproject.toml due to {ex}")
|
|
91
|
+
if exit_on_fail:
|
|
92
|
+
raise typer.Exit(code=1) from ex
|
|
93
|
+
raise
|
|
94
|
+
|
|
95
|
+
|
|
74
96
|
def _create_readme(module_name: str, package_name: str):
|
|
75
97
|
"""Create a package README file.
|
|
76
98
|
|
|
@@ -416,9 +438,7 @@ def _run_commands_in_subprocess(cmds: list[str]) -> bool:
|
|
|
416
438
|
|
|
417
439
|
def _make_pyi_files():
|
|
418
440
|
"""Create pyi files for the custom component."""
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
package_name = glob("custom_components/*.egg-info")[0].replace(".egg-info", "")
|
|
441
|
+
package_name = _get_package_config()["project"]["name"]
|
|
422
442
|
|
|
423
443
|
for dir, _, _ in os.walk(f"./{package_name}"):
|
|
424
444
|
if "__pycache__" in dir:
|
|
@@ -514,22 +534,10 @@ def _validate_credentials(
|
|
|
514
534
|
def _get_version_to_publish() -> str:
|
|
515
535
|
"""Get the version to publish from the pyproject.toml.
|
|
516
536
|
|
|
517
|
-
Raises:
|
|
518
|
-
Exit: If the version is not found in the pyproject.toml.
|
|
519
|
-
|
|
520
537
|
Returns:
|
|
521
538
|
The version to publish.
|
|
522
539
|
"""
|
|
523
|
-
|
|
524
|
-
try:
|
|
525
|
-
with open(CustomComponents.PYPROJECT_TOML, "rb") as f:
|
|
526
|
-
project_toml = tomlkit.parse(f.read())
|
|
527
|
-
return project_toml.get("project", {})["version"]
|
|
528
|
-
except (OSError, KeyError, TOMLKitError) as ex:
|
|
529
|
-
console.error(
|
|
530
|
-
f"Cannot find the version in {CustomComponents.PYPROJECT_TOML} due to {ex}"
|
|
531
|
-
)
|
|
532
|
-
raise typer.Exit(code=1) from ex
|
|
540
|
+
return _get_package_config()["project"]["version"]
|
|
533
541
|
|
|
534
542
|
|
|
535
543
|
def _ensure_dist_dir(version_to_publish: str, build: bool):
|
|
@@ -733,12 +741,7 @@ def _validate_project_info():
|
|
|
733
741
|
Raises:
|
|
734
742
|
Exit: If the pyproject.toml file is ill-formed.
|
|
735
743
|
"""
|
|
736
|
-
|
|
737
|
-
with open(CustomComponents.PYPROJECT_TOML, "rb") as f:
|
|
738
|
-
pyproject_toml = tomlkit.parse(f.read())
|
|
739
|
-
except TOMLKitError as ex:
|
|
740
|
-
console.error(f"Unable to read from pyproject.toml due to {ex}")
|
|
741
|
-
raise typer.Exit(code=1) from ex
|
|
744
|
+
pyproject_toml = _get_package_config()
|
|
742
745
|
|
|
743
746
|
try:
|
|
744
747
|
project = pyproject_toml.get("project", {})
|
|
@@ -796,7 +799,7 @@ def _validate_project_info():
|
|
|
796
799
|
with open(CustomComponents.PYPROJECT_TOML, "w") as f:
|
|
797
800
|
tomlkit.dump(pyproject_toml, f)
|
|
798
801
|
except (OSError, TOMLKitError) as ex:
|
|
799
|
-
console.error(f"Unable to
|
|
802
|
+
console.error(f"Unable to write to pyproject.toml due to {ex}")
|
|
800
803
|
raise typer.Exit(code=1) from ex
|
|
801
804
|
|
|
802
805
|
|
|
@@ -816,10 +819,8 @@ def _collect_details_for_gallery():
|
|
|
816
819
|
params = {}
|
|
817
820
|
package_name = None
|
|
818
821
|
try:
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
package_name = project_toml.get("project", {})["name"]
|
|
822
|
-
except (OSError, TOMLKitError, KeyError) as ex:
|
|
822
|
+
package_name = _get_package_config(exit_on_fail=False)["project"]["name"]
|
|
823
|
+
except (TOMLKitError, KeyError) as ex:
|
|
823
824
|
console.debug(
|
|
824
825
|
f"Unable to read from pyproject.toml in current directory due to {ex}"
|
|
825
826
|
)
|
|
@@ -850,13 +851,6 @@ def _collect_details_for_gallery():
|
|
|
850
851
|
console.error(f"Unable to complete request due to {he}.")
|
|
851
852
|
raise typer.Exit(code=1) from he
|
|
852
853
|
|
|
853
|
-
display_name = (
|
|
854
|
-
console.ask("[ Friendly display name for your component ] (enter to skip)")
|
|
855
|
-
or None
|
|
856
|
-
)
|
|
857
|
-
if display_name:
|
|
858
|
-
params["display_name"] = display_name
|
|
859
|
-
|
|
860
854
|
files = []
|
|
861
855
|
if (image_file_and_extension := _get_file_from_prompt_in_loop()) is not None:
|
|
862
856
|
files.append(
|
reflex/event.py
CHANGED
|
@@ -13,7 +13,6 @@ from typing import (
|
|
|
13
13
|
Optional,
|
|
14
14
|
Tuple,
|
|
15
15
|
Union,
|
|
16
|
-
_GenericAlias, # type: ignore
|
|
17
16
|
get_type_hints,
|
|
18
17
|
)
|
|
19
18
|
|
|
@@ -23,6 +22,11 @@ from reflex.utils import console, format
|
|
|
23
22
|
from reflex.utils.types import ArgsSpec
|
|
24
23
|
from reflex.vars import BaseVar, Var
|
|
25
24
|
|
|
25
|
+
try:
|
|
26
|
+
from typing import Annotated
|
|
27
|
+
except ImportError:
|
|
28
|
+
from typing_extensions import Annotated
|
|
29
|
+
|
|
26
30
|
|
|
27
31
|
class Event(Base):
|
|
28
32
|
"""An event that describes any state change in the app."""
|
|
@@ -118,7 +122,7 @@ class EventHandler(EventActionsMixin):
|
|
|
118
122
|
frozen = True
|
|
119
123
|
|
|
120
124
|
@classmethod
|
|
121
|
-
def __class_getitem__(cls, args_spec: str) ->
|
|
125
|
+
def __class_getitem__(cls, args_spec: str) -> Annotated:
|
|
122
126
|
"""Get a typed EventHandler.
|
|
123
127
|
|
|
124
128
|
Args:
|
|
@@ -127,10 +131,7 @@ class EventHandler(EventActionsMixin):
|
|
|
127
131
|
Returns:
|
|
128
132
|
The EventHandler class item.
|
|
129
133
|
"""
|
|
130
|
-
|
|
131
|
-
# Cannot subclass special typing classes, so we need to set the args_spec dynamically as an attribute.
|
|
132
|
-
gen.args_spec = args_spec
|
|
133
|
-
return gen
|
|
134
|
+
return Annotated[cls, args_spec]
|
|
134
135
|
|
|
135
136
|
@property
|
|
136
137
|
def is_background(self) -> bool:
|
reflex/experimental/__init__.py
CHANGED
|
@@ -4,6 +4,7 @@ from types import SimpleNamespace
|
|
|
4
4
|
|
|
5
5
|
from ..utils.console import warn
|
|
6
6
|
from . import hooks as hooks
|
|
7
|
+
from .misc import run_in_thread as run_in_thread
|
|
7
8
|
|
|
8
9
|
warn(
|
|
9
10
|
"`rx._x` contains experimental features and might be removed at any time in the future .",
|
|
@@ -11,4 +12,5 @@ warn(
|
|
|
11
12
|
|
|
12
13
|
_x = SimpleNamespace(
|
|
13
14
|
hooks=hooks,
|
|
15
|
+
run_in_thread=run_in_thread,
|
|
14
16
|
)
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"""Miscellaneous functions for the experimental package."""
|
|
2
|
+
|
|
3
|
+
import asyncio
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
async def run_in_thread(func):
|
|
7
|
+
"""Run a function in a separate thread.
|
|
8
|
+
|
|
9
|
+
Args:
|
|
10
|
+
func (callable): The function to run.
|
|
11
|
+
"""
|
|
12
|
+
await asyncio.get_event_loop().run_in_executor(None, func)
|
reflex/model.py
CHANGED
|
@@ -16,12 +16,12 @@ import alembic.script
|
|
|
16
16
|
import alembic.util
|
|
17
17
|
import sqlalchemy
|
|
18
18
|
import sqlalchemy.orm
|
|
19
|
-
import sqlmodel
|
|
20
19
|
|
|
21
20
|
from reflex import constants
|
|
22
21
|
from reflex.base import Base
|
|
23
22
|
from reflex.config import get_config
|
|
24
23
|
from reflex.utils import console
|
|
24
|
+
from reflex.utils.compat import sqlmodel
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
def get_engine(url: str | None = None):
|
reflex/reflex.py
CHANGED
reflex/utils/compat.py
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"""Compatibility hacks and helpers."""
|
|
2
|
+
|
|
3
|
+
import contextlib
|
|
4
|
+
import sys
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
@contextlib.contextmanager
|
|
8
|
+
def pydantic_v1_patch():
|
|
9
|
+
"""A context manager that patches the Pydantic module to mimic v1 behaviour.
|
|
10
|
+
|
|
11
|
+
Yields:
|
|
12
|
+
None when the Pydantic module is patched.
|
|
13
|
+
"""
|
|
14
|
+
patched_modules = [
|
|
15
|
+
"pydantic",
|
|
16
|
+
"pydantic.fields",
|
|
17
|
+
"pydantic.errors",
|
|
18
|
+
"pydantic.main",
|
|
19
|
+
]
|
|
20
|
+
originals = {module: sys.modules.get(module) for module in patched_modules}
|
|
21
|
+
try:
|
|
22
|
+
import pydantic.v1 # type: ignore
|
|
23
|
+
|
|
24
|
+
sys.modules["pydantic.fields"] = pydantic.v1.fields # type: ignore
|
|
25
|
+
sys.modules["pydantic.main"] = pydantic.v1.main # type: ignore
|
|
26
|
+
sys.modules["pydantic.errors"] = pydantic.v1.errors # type: ignore
|
|
27
|
+
sys.modules["pydantic"] = pydantic.v1
|
|
28
|
+
yield
|
|
29
|
+
except (ImportError, AttributeError):
|
|
30
|
+
# pydantic v1 is already installed
|
|
31
|
+
yield
|
|
32
|
+
finally:
|
|
33
|
+
# Restore the original Pydantic module
|
|
34
|
+
for k, original in originals.items():
|
|
35
|
+
if k in sys.modules:
|
|
36
|
+
if original:
|
|
37
|
+
sys.modules[k] = original
|
|
38
|
+
else:
|
|
39
|
+
del sys.modules[k]
|
|
40
|
+
|
|
41
|
+
|
|
42
|
+
with pydantic_v1_patch():
|
|
43
|
+
import sqlmodel as sqlmodel
|
reflex/utils/console.py
CHANGED
|
@@ -28,6 +28,15 @@ def set_log_level(log_level: LogLevel):
|
|
|
28
28
|
_LOG_LEVEL = log_level
|
|
29
29
|
|
|
30
30
|
|
|
31
|
+
def is_debug() -> bool:
|
|
32
|
+
"""Check if the log level is debug.
|
|
33
|
+
|
|
34
|
+
Returns:
|
|
35
|
+
True if the log level is debug.
|
|
36
|
+
"""
|
|
37
|
+
return _LOG_LEVEL <= LogLevel.DEBUG
|
|
38
|
+
|
|
39
|
+
|
|
31
40
|
def print(msg: str, **kwargs):
|
|
32
41
|
"""Print a message.
|
|
33
42
|
|
|
@@ -45,7 +54,7 @@ def debug(msg: str, **kwargs):
|
|
|
45
54
|
msg: The debug message.
|
|
46
55
|
kwargs: Keyword arguments to pass to the print function.
|
|
47
56
|
"""
|
|
48
|
-
if
|
|
57
|
+
if is_debug():
|
|
49
58
|
msg_ = f"[blue]Debug: {msg}[/blue]"
|
|
50
59
|
if progress := kwargs.pop("progress", None):
|
|
51
60
|
progress.console.print(msg_, **kwargs)
|
reflex/utils/export.py
CHANGED
|
@@ -50,10 +50,8 @@ def export(
|
|
|
50
50
|
console.rule("[bold]Compiling production app and preparing for export.")
|
|
51
51
|
|
|
52
52
|
if frontend:
|
|
53
|
-
# Update some parameters for export
|
|
54
|
-
prerequisites.update_next_config(export=True)
|
|
55
53
|
# Ensure module can be imported and app.compile() is called.
|
|
56
|
-
prerequisites.get_compiled_app()
|
|
54
|
+
prerequisites.get_compiled_app(export=True)
|
|
57
55
|
# Set up .web directory and install frontend dependencies.
|
|
58
56
|
build.setup_frontend(Path.cwd())
|
|
59
57
|
|
reflex/utils/imports.py
CHANGED
|
@@ -54,6 +54,10 @@ class ImportVar(Base):
|
|
|
54
54
|
# whether this import should be rendered or not
|
|
55
55
|
render: Optional[bool] = True
|
|
56
56
|
|
|
57
|
+
# whether this import package should be added to transpilePackages in next.config.js
|
|
58
|
+
# https://nextjs.org/docs/app/api-reference/next-config-js/transpilePackages
|
|
59
|
+
transpile: Optional[bool] = False
|
|
60
|
+
|
|
57
61
|
@property
|
|
58
62
|
def name(self) -> str:
|
|
59
63
|
"""The name of the import.
|
|
@@ -72,7 +76,16 @@ class ImportVar(Base):
|
|
|
72
76
|
Returns:
|
|
73
77
|
The hash of the var.
|
|
74
78
|
"""
|
|
75
|
-
return hash(
|
|
79
|
+
return hash(
|
|
80
|
+
(
|
|
81
|
+
self.tag,
|
|
82
|
+
self.is_default,
|
|
83
|
+
self.alias,
|
|
84
|
+
self.install,
|
|
85
|
+
self.render,
|
|
86
|
+
self.transpile,
|
|
87
|
+
)
|
|
88
|
+
)
|
|
76
89
|
|
|
77
90
|
|
|
78
91
|
ImportDict = Dict[str, List[ImportVar]]
|