reflex 0.6.8a2__py3-none-any.whl → 0.7.0__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 (247) hide show
  1. reflex/.templates/jinja/custom_components/pyproject.toml.jinja2 +1 -1
  2. reflex/.templates/jinja/web/pages/_app.js.jinja2 +7 -7
  3. reflex/.templates/jinja/web/pages/utils.js.jinja2 +3 -3
  4. reflex/.templates/web/components/reflex/radix_themes_color_mode_provider.js +1 -4
  5. reflex/.templates/web/utils/state.js +65 -36
  6. reflex/__init__.py +4 -17
  7. reflex/__init__.pyi +1 -2
  8. reflex/app.py +286 -129
  9. reflex/app_mixins/lifespan.py +9 -9
  10. reflex/app_mixins/middleware.py +6 -6
  11. reflex/app_module_for_backend.py +3 -7
  12. reflex/base.py +7 -7
  13. reflex/compiler/compiler.py +8 -0
  14. reflex/compiler/utils.py +57 -18
  15. reflex/components/base/app_wrap.pyi +16 -16
  16. reflex/components/base/bare.py +1 -1
  17. reflex/components/base/body.pyi +16 -16
  18. reflex/components/base/document.pyi +76 -76
  19. reflex/components/base/error_boundary.py +2 -1
  20. reflex/components/base/error_boundary.pyi +19 -22
  21. reflex/components/base/fragment.pyi +16 -16
  22. reflex/components/base/head.pyi +31 -31
  23. reflex/components/base/link.pyi +31 -31
  24. reflex/components/base/meta.py +2 -2
  25. reflex/components/base/meta.pyi +61 -61
  26. reflex/components/base/script.pyi +19 -19
  27. reflex/components/base/strict_mode.py +10 -0
  28. reflex/components/base/strict_mode.pyi +57 -0
  29. reflex/components/component.py +38 -77
  30. reflex/components/core/banner.py +159 -4
  31. reflex/components/core/banner.pyi +162 -76
  32. reflex/components/core/breakpoints.py +3 -1
  33. reflex/components/core/client_side_routing.py +1 -1
  34. reflex/components/core/client_side_routing.pyi +32 -32
  35. reflex/components/core/clipboard.pyi +17 -20
  36. reflex/components/core/cond.py +9 -10
  37. reflex/components/core/debounce.py +1 -1
  38. reflex/components/core/debounce.pyi +17 -17
  39. reflex/components/core/foreach.py +28 -3
  40. reflex/components/core/html.py +1 -1
  41. reflex/components/core/html.pyi +16 -16
  42. reflex/components/core/match.py +5 -5
  43. reflex/components/core/sticky.py +134 -0
  44. reflex/components/core/sticky.pyi +449 -0
  45. reflex/components/core/upload.py +2 -2
  46. reflex/components/core/upload.pyi +80 -88
  47. reflex/components/datadisplay/code.py +5 -14
  48. reflex/components/datadisplay/code.pyi +31 -31
  49. reflex/components/datadisplay/dataeditor.py +7 -4
  50. reflex/components/datadisplay/dataeditor.pyi +40 -54
  51. reflex/components/datadisplay/logo.py +13 -8
  52. reflex/components/datadisplay/shiki_code_block.py +14 -9
  53. reflex/components/datadisplay/shiki_code_block.pyi +46 -46
  54. reflex/components/dynamic.py +22 -3
  55. reflex/components/el/constants/reflex.py +1 -1
  56. reflex/components/el/element.py +1 -1
  57. reflex/components/el/element.pyi +16 -16
  58. reflex/components/el/elements/base.pyi +16 -16
  59. reflex/components/el/elements/forms.py +4 -4
  60. reflex/components/el/elements/forms.pyi +224 -258
  61. reflex/components/el/elements/inline.pyi +421 -421
  62. reflex/components/el/elements/media.pyi +376 -376
  63. reflex/components/el/elements/metadata.pyi +91 -91
  64. reflex/components/el/elements/other.pyi +106 -106
  65. reflex/components/el/elements/scripts.pyi +46 -46
  66. reflex/components/el/elements/sectioning.pyi +226 -226
  67. reflex/components/el/elements/tables.pyi +151 -151
  68. reflex/components/el/elements/typography.pyi +226 -226
  69. reflex/components/gridjs/datatable.pyi +31 -31
  70. reflex/components/lucide/icon.py +46 -8
  71. reflex/components/lucide/icon.pyi +85 -31
  72. reflex/components/markdown/markdown.py +10 -8
  73. reflex/components/markdown/markdown.pyi +16 -16
  74. reflex/components/moment/moment.py +2 -2
  75. reflex/components/moment/moment.pyi +17 -19
  76. reflex/components/next/base.pyi +16 -16
  77. reflex/components/next/image.py +16 -4
  78. reflex/components/next/image.pyi +22 -20
  79. reflex/components/next/link.py +1 -1
  80. reflex/components/next/link.pyi +16 -16
  81. reflex/components/next/video.pyi +16 -16
  82. reflex/components/plotly/__init__.py +29 -2
  83. reflex/components/plotly/plotly.py +240 -5
  84. reflex/components/plotly/plotly.pyi +799 -44
  85. reflex/components/props.py +3 -3
  86. reflex/components/radix/__init__.pyi +1 -1
  87. reflex/components/radix/primitives/accordion.py +9 -5
  88. reflex/components/radix/primitives/accordion.pyi +110 -108
  89. reflex/components/radix/primitives/base.pyi +31 -31
  90. reflex/components/radix/primitives/drawer.py +5 -2
  91. reflex/components/radix/primitives/drawer.pyi +179 -187
  92. reflex/components/radix/primitives/form.pyi +160 -172
  93. reflex/components/radix/primitives/progress.py +1 -1
  94. reflex/components/radix/primitives/progress.pyi +76 -76
  95. reflex/components/radix/primitives/slider.py +1 -1
  96. reflex/components/radix/primitives/slider.pyi +78 -82
  97. reflex/components/radix/themes/base.pyi +121 -121
  98. reflex/components/radix/themes/color_mode.py +11 -9
  99. reflex/components/radix/themes/color_mode.pyi +47 -49
  100. reflex/components/radix/themes/components/alert_dialog.py +3 -0
  101. reflex/components/radix/themes/components/alert_dialog.pyi +110 -112
  102. reflex/components/radix/themes/components/aspect_ratio.pyi +16 -16
  103. reflex/components/radix/themes/components/avatar.pyi +16 -16
  104. reflex/components/radix/themes/components/badge.pyi +16 -16
  105. reflex/components/radix/themes/components/button.pyi +16 -16
  106. reflex/components/radix/themes/components/callout.pyi +76 -76
  107. reflex/components/radix/themes/components/card.py +1 -1
  108. reflex/components/radix/themes/components/card.pyi +17 -17
  109. reflex/components/radix/themes/components/checkbox.pyi +49 -55
  110. reflex/components/radix/themes/components/checkbox_cards.pyi +31 -31
  111. reflex/components/radix/themes/components/checkbox_group.pyi +31 -31
  112. reflex/components/radix/themes/components/context_menu.py +5 -0
  113. reflex/components/radix/themes/components/context_menu.pyi +149 -155
  114. reflex/components/radix/themes/components/data_list.pyi +61 -61
  115. reflex/components/radix/themes/components/dialog.py +3 -0
  116. reflex/components/radix/themes/components/dialog.pyi +113 -117
  117. reflex/components/radix/themes/components/dropdown_menu.py +5 -0
  118. reflex/components/radix/themes/components/dropdown_menu.pyi +133 -137
  119. reflex/components/radix/themes/components/hover_card.py +3 -0
  120. reflex/components/radix/themes/components/hover_card.pyi +63 -67
  121. reflex/components/radix/themes/components/icon_button.py +2 -2
  122. reflex/components/radix/themes/components/icon_button.pyi +17 -16
  123. reflex/components/radix/themes/components/inset.pyi +16 -16
  124. reflex/components/radix/themes/components/popover.py +3 -0
  125. reflex/components/radix/themes/components/popover.pyi +68 -70
  126. reflex/components/radix/themes/components/progress.pyi +16 -16
  127. reflex/components/radix/themes/components/radio.pyi +16 -16
  128. reflex/components/radix/themes/components/radio_cards.py +2 -0
  129. reflex/components/radix/themes/components/radio_cards.pyi +32 -34
  130. reflex/components/radix/themes/components/radio_group.py +1 -1
  131. reflex/components/radix/themes/components/radio_group.pyi +62 -64
  132. reflex/components/radix/themes/components/scroll_area.pyi +16 -16
  133. reflex/components/radix/themes/components/segmented_control.pyi +32 -35
  134. reflex/components/radix/themes/components/select.py +4 -0
  135. reflex/components/radix/themes/components/select.pyi +145 -157
  136. reflex/components/radix/themes/components/separator.pyi +16 -16
  137. reflex/components/radix/themes/components/skeleton.py +3 -0
  138. reflex/components/radix/themes/components/skeleton.pyi +16 -16
  139. reflex/components/radix/themes/components/slider.pyi +22 -28
  140. reflex/components/radix/themes/components/spinner.pyi +16 -16
  141. reflex/components/radix/themes/components/switch.pyi +17 -19
  142. reflex/components/radix/themes/components/table.pyi +106 -106
  143. reflex/components/radix/themes/components/tabs.py +3 -0
  144. reflex/components/radix/themes/components/tabs.pyi +78 -82
  145. reflex/components/radix/themes/components/text_area.py +12 -0
  146. reflex/components/radix/themes/components/text_area.pyi +21 -33
  147. reflex/components/radix/themes/components/text_field.py +1 -1
  148. reflex/components/radix/themes/components/text_field.pyi +52 -80
  149. reflex/components/radix/themes/components/tooltip.py +6 -1
  150. reflex/components/radix/themes/components/tooltip.pyi +20 -21
  151. reflex/components/radix/themes/layout/__init__.pyi +1 -1
  152. reflex/components/radix/themes/layout/base.pyi +16 -16
  153. reflex/components/radix/themes/layout/box.pyi +16 -16
  154. reflex/components/radix/themes/layout/center.pyi +16 -16
  155. reflex/components/radix/themes/layout/container.pyi +16 -16
  156. reflex/components/radix/themes/layout/flex.pyi +16 -16
  157. reflex/components/radix/themes/layout/grid.pyi +16 -16
  158. reflex/components/radix/themes/layout/list.py +2 -2
  159. reflex/components/radix/themes/layout/list.pyi +76 -76
  160. reflex/components/radix/themes/layout/section.pyi +16 -16
  161. reflex/components/radix/themes/layout/spacer.pyi +16 -16
  162. reflex/components/radix/themes/layout/stack.py +2 -2
  163. reflex/components/radix/themes/layout/stack.pyi +46 -46
  164. reflex/components/radix/themes/typography/blockquote.pyi +16 -16
  165. reflex/components/radix/themes/typography/code.pyi +16 -16
  166. reflex/components/radix/themes/typography/heading.pyi +16 -16
  167. reflex/components/radix/themes/typography/link.py +1 -1
  168. reflex/components/radix/themes/typography/link.pyi +16 -16
  169. reflex/components/radix/themes/typography/text.py +2 -2
  170. reflex/components/radix/themes/typography/text.pyi +106 -106
  171. reflex/components/react_player/audio.pyi +33 -39
  172. reflex/components/react_player/react_player.py +1 -1
  173. reflex/components/react_player/react_player.pyi +32 -38
  174. reflex/components/react_player/video.pyi +33 -39
  175. reflex/components/recharts/__init__.py +2 -0
  176. reflex/components/recharts/__init__.pyi +2 -0
  177. reflex/components/recharts/cartesian.pyi +282 -282
  178. reflex/components/recharts/charts.py +15 -15
  179. reflex/components/recharts/charts.pyi +164 -164
  180. reflex/components/recharts/general.py +19 -4
  181. reflex/components/recharts/general.pyi +132 -81
  182. reflex/components/recharts/polar.py +2 -2
  183. reflex/components/recharts/polar.pyi +55 -55
  184. reflex/components/recharts/recharts.py +4 -4
  185. reflex/components/recharts/recharts.pyi +31 -31
  186. reflex/components/sonner/toast.py +15 -13
  187. reflex/components/sonner/toast.pyi +22 -22
  188. reflex/components/suneditor/editor.py +6 -4
  189. reflex/components/suneditor/editor.pyi +26 -40
  190. reflex/components/tags/iter_tag.py +3 -3
  191. reflex/components/tags/tag.py +25 -3
  192. reflex/config.py +48 -15
  193. reflex/constants/__init__.py +1 -0
  194. reflex/constants/base.py +4 -1
  195. reflex/constants/compiler.py +5 -2
  196. reflex/constants/config.py +8 -1
  197. reflex/constants/installer.py +9 -9
  198. reflex/constants/style.py +1 -1
  199. reflex/custom_components/custom_components.py +18 -10
  200. reflex/event.py +221 -231
  201. reflex/experimental/__init__.py +19 -11
  202. reflex/experimental/client_state.py +53 -28
  203. reflex/experimental/hooks.py +5 -5
  204. reflex/experimental/layout.py +8 -5
  205. reflex/experimental/layout.pyi +79 -83
  206. reflex/experimental/misc.py +3 -3
  207. reflex/istate/wrappers.py +1 -1
  208. reflex/middleware/hydrate_middleware.py +2 -2
  209. reflex/model.py +11 -6
  210. reflex/page.py +5 -5
  211. reflex/reflex.py +104 -26
  212. reflex/route.py +1 -1
  213. reflex/state.py +358 -401
  214. reflex/style.py +27 -3
  215. reflex/testing.py +29 -23
  216. reflex/utils/build.py +6 -2
  217. reflex/utils/codespaces.py +1 -4
  218. reflex/utils/compat.py +6 -5
  219. reflex/utils/console.py +71 -16
  220. reflex/utils/exceptions.py +89 -26
  221. reflex/utils/exec.py +69 -74
  222. reflex/utils/export.py +6 -1
  223. reflex/utils/format.py +8 -40
  224. reflex/utils/imports.py +5 -2
  225. reflex/utils/lazy_loader.py +7 -1
  226. reflex/utils/path_ops.py +74 -14
  227. reflex/utils/prerequisites.py +345 -68
  228. reflex/utils/processes.py +45 -32
  229. reflex/utils/pyi_generator.py +39 -33
  230. reflex/utils/registry.py +4 -4
  231. reflex/utils/serializers.py +1 -1
  232. reflex/utils/telemetry.py +5 -4
  233. reflex/utils/types.py +42 -18
  234. reflex/vars/base.py +695 -330
  235. reflex/vars/datetime.py +6 -7
  236. reflex/vars/dep_tracking.py +344 -0
  237. reflex/vars/function.py +11 -5
  238. reflex/vars/number.py +31 -43
  239. reflex/vars/object.py +74 -64
  240. reflex/vars/sequence.py +79 -67
  241. {reflex-0.6.8a2.dist-info → reflex-0.7.0.dist-info}/METADATA +7 -8
  242. reflex-0.7.0.dist-info/RECORD +401 -0
  243. {reflex-0.6.8a2.dist-info → reflex-0.7.0.dist-info}/WHEEL +1 -1
  244. reflex/experimental/assets.py +0 -37
  245. reflex-0.6.8a2.dist-info/RECORD +0 -397
  246. {reflex-0.6.8a2.dist-info → reflex-0.7.0.dist-info}/LICENSE +0 -0
  247. {reflex-0.6.8a2.dist-info → reflex-0.7.0.dist-info}/entry_points.txt +0 -0
reflex/vars/sequence.py CHANGED
@@ -6,7 +6,6 @@ import dataclasses
6
6
  import inspect
7
7
  import json
8
8
  import re
9
- import sys
10
9
  import typing
11
10
  from typing import (
12
11
  TYPE_CHECKING,
@@ -15,7 +14,7 @@ from typing import (
15
14
  List,
16
15
  Literal,
17
16
  NoReturn,
18
- Set,
17
+ Sequence,
19
18
  Tuple,
20
19
  Type,
21
20
  Union,
@@ -54,8 +53,11 @@ from .number import (
54
53
  )
55
54
 
56
55
  if TYPE_CHECKING:
56
+ from .base import BASE_TYPE, DATACLASS_TYPE, SQLA_TYPE
57
+ from .function import FunctionVar
57
58
  from .object import ObjectVar
58
59
 
60
+
59
61
  STRING_TYPE = TypeVar("STRING_TYPE", default=str)
60
62
 
61
63
 
@@ -66,7 +68,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
66
68
  def __add__(self, other: StringVar | str) -> ConcatVarOperation: ...
67
69
 
68
70
  @overload
69
- def __add__(self, other: NoReturn) -> NoReturn: ...
71
+ def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
70
72
 
71
73
  def __add__(self, other: Any) -> ConcatVarOperation:
72
74
  """Concatenate two strings.
@@ -86,7 +88,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
86
88
  def __radd__(self, other: StringVar | str) -> ConcatVarOperation: ...
87
89
 
88
90
  @overload
89
- def __radd__(self, other: NoReturn) -> NoReturn: ...
91
+ def __radd__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
90
92
 
91
93
  def __radd__(self, other: Any) -> ConcatVarOperation:
92
94
  """Concatenate two strings.
@@ -106,7 +108,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
106
108
  def __mul__(self, other: NumberVar | int) -> StringVar: ...
107
109
 
108
110
  @overload
109
- def __mul__(self, other: NoReturn) -> NoReturn: ...
111
+ def __mul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
110
112
 
111
113
  def __mul__(self, other: Any) -> StringVar:
112
114
  """Multiply the sequence by a number or an integer.
@@ -126,7 +128,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
126
128
  def __rmul__(self, other: NumberVar | int) -> StringVar: ...
127
129
 
128
130
  @overload
129
- def __rmul__(self, other: NoReturn) -> NoReturn: ...
131
+ def __rmul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
130
132
 
131
133
  def __rmul__(self, other: Any) -> StringVar:
132
134
  """Multiply the sequence by a number or an integer.
@@ -211,7 +213,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
211
213
  ) -> BooleanVar: ...
212
214
 
213
215
  @overload
214
- def contains(
216
+ def contains( # pyright: ignore [reportOverlappingOverload]
215
217
  self, other: NoReturn, field: StringVar | str | None = None
216
218
  ) -> NoReturn: ...
217
219
 
@@ -237,7 +239,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
237
239
  def split(self, separator: StringVar | str = "") -> ArrayVar[List[str]]: ...
238
240
 
239
241
  @overload
240
- def split(self, separator: NoReturn) -> NoReturn: ...
242
+ def split(self, separator: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
241
243
 
242
244
  def split(self, separator: Any = "") -> ArrayVar[List[str]]:
243
245
  """Split the string.
@@ -256,7 +258,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
256
258
  def startswith(self, prefix: StringVar | str) -> BooleanVar: ...
257
259
 
258
260
  @overload
259
- def startswith(self, prefix: NoReturn) -> NoReturn: ...
261
+ def startswith(self, prefix: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
260
262
 
261
263
  def startswith(self, prefix: Any) -> BooleanVar:
262
264
  """Check if the string starts with a prefix.
@@ -275,7 +277,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
275
277
  def endswith(self, suffix: StringVar | str) -> BooleanVar: ...
276
278
 
277
279
  @overload
278
- def endswith(self, suffix: NoReturn) -> NoReturn: ...
280
+ def endswith(self, suffix: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
279
281
 
280
282
  def endswith(self, suffix: Any) -> BooleanVar:
281
283
  """Check if the string ends with a suffix.
@@ -294,7 +296,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
294
296
  def __lt__(self, other: StringVar | str) -> BooleanVar: ...
295
297
 
296
298
  @overload
297
- def __lt__(self, other: NoReturn) -> NoReturn: ...
299
+ def __lt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
298
300
 
299
301
  def __lt__(self, other: Any):
300
302
  """Check if the string is less than another string.
@@ -314,7 +316,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
314
316
  def __gt__(self, other: StringVar | str) -> BooleanVar: ...
315
317
 
316
318
  @overload
317
- def __gt__(self, other: NoReturn) -> NoReturn: ...
319
+ def __gt__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
318
320
 
319
321
  def __gt__(self, other: Any):
320
322
  """Check if the string is greater than another string.
@@ -334,7 +336,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
334
336
  def __le__(self, other: StringVar | str) -> BooleanVar: ...
335
337
 
336
338
  @overload
337
- def __le__(self, other: NoReturn) -> NoReturn: ...
339
+ def __le__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
338
340
 
339
341
  def __le__(self, other: Any):
340
342
  """Check if the string is less than or equal to another string.
@@ -354,7 +356,7 @@ class StringVar(Var[STRING_TYPE], python_types=str):
354
356
  def __ge__(self, other: StringVar | str) -> BooleanVar: ...
355
357
 
356
358
  @overload
357
- def __ge__(self, other: NoReturn) -> NoReturn: ...
359
+ def __ge__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
358
360
 
359
361
  def __ge__(self, other: Any):
360
362
  """Check if the string is greater than or equal to another string.
@@ -596,7 +598,7 @@ _decode_var_pattern = re.compile(_decode_var_pattern_re, flags=re.DOTALL)
596
598
  @dataclasses.dataclass(
597
599
  eq=False,
598
600
  frozen=True,
599
- **{"slots": True} if sys.version_info >= (3, 10) else {},
601
+ slots=True,
600
602
  )
601
603
  class LiteralStringVar(LiteralVar, StringVar[str]):
602
604
  """Base class for immutable literal string vars."""
@@ -718,7 +720,7 @@ class LiteralStringVar(LiteralVar, StringVar[str]):
718
720
  @dataclasses.dataclass(
719
721
  eq=False,
720
722
  frozen=True,
721
- **{"slots": True} if sys.version_info >= (3, 10) else {},
723
+ slots=True,
722
724
  )
723
725
  class ConcatVarOperation(CachedVarOperation, StringVar[str]):
724
726
  """Representing a concatenation of literal string vars."""
@@ -780,7 +782,7 @@ class ConcatVarOperation(CachedVarOperation, StringVar[str]):
780
782
  """Create a var from a string value.
781
783
 
782
784
  Args:
783
- value: The values to concatenate.
785
+ *value: The values to concatenate.
784
786
  _var_data: Additional hooks and imports associated with the Var.
785
787
 
786
788
  Returns:
@@ -794,7 +796,8 @@ class ConcatVarOperation(CachedVarOperation, StringVar[str]):
794
796
  )
795
797
 
796
798
 
797
- ARRAY_VAR_TYPE = TypeVar("ARRAY_VAR_TYPE", bound=Union[List, Tuple, Set])
799
+ ARRAY_VAR_TYPE = TypeVar("ARRAY_VAR_TYPE", bound=Sequence, covariant=True)
800
+ OTHER_ARRAY_VAR_TYPE = TypeVar("OTHER_ARRAY_VAR_TYPE", bound=Sequence)
798
801
 
799
802
  OTHER_TUPLE = TypeVar("OTHER_TUPLE")
800
803
 
@@ -811,7 +814,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
811
814
  def join(self, sep: StringVar | str = "") -> StringVar: ...
812
815
 
813
816
  @overload
814
- def join(self, sep: NoReturn) -> NoReturn: ...
817
+ def join(self, sep: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
815
818
 
816
819
  def join(self, sep: Any = "") -> StringVar:
817
820
  """Join the elements of the array.
@@ -858,7 +861,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
858
861
  def __add__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> ArrayVar[ARRAY_VAR_TYPE]: ...
859
862
 
860
863
  @overload
861
- def __add__(self, other: NoReturn) -> NoReturn: ...
864
+ def __add__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
862
865
 
863
866
  def __add__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]:
864
867
  """Concatenate two arrays.
@@ -887,6 +890,11 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
887
890
  i: Literal[0, -2],
888
891
  ) -> NumberVar: ...
889
892
 
893
+ @overload
894
+ def __getitem__(
895
+ self: ArrayVar[Tuple[Any, bool]], i: Literal[1, -1]
896
+ ) -> BooleanVar: ...
897
+
890
898
  @overload
891
899
  def __getitem__(
892
900
  self: (
@@ -914,7 +922,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
914
922
 
915
923
  @overload
916
924
  def __getitem__(
917
- self: ArrayVar[Tuple[Any, bool]], i: Literal[1, -1]
925
+ self: ARRAY_VAR_OF_LIST_ELEMENT[bool], i: int | NumberVar
918
926
  ) -> BooleanVar: ...
919
927
 
920
928
  @overload
@@ -932,23 +940,12 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
932
940
  self: ARRAY_VAR_OF_LIST_ELEMENT[str], i: int | NumberVar
933
941
  ) -> StringVar: ...
934
942
 
935
- @overload
936
- def __getitem__(
937
- self: ARRAY_VAR_OF_LIST_ELEMENT[bool], i: int | NumberVar
938
- ) -> BooleanVar: ...
939
-
940
943
  @overload
941
944
  def __getitem__(
942
945
  self: ARRAY_VAR_OF_LIST_ELEMENT[List[INNER_ARRAY_VAR]],
943
946
  i: int | NumberVar,
944
947
  ) -> ArrayVar[List[INNER_ARRAY_VAR]]: ...
945
948
 
946
- @overload
947
- def __getitem__(
948
- self: ARRAY_VAR_OF_LIST_ELEMENT[Set[INNER_ARRAY_VAR]],
949
- i: int | NumberVar,
950
- ) -> ArrayVar[Set[INNER_ARRAY_VAR]]: ...
951
-
952
949
  @overload
953
950
  def __getitem__(
954
951
  self: ARRAY_VAR_OF_LIST_ELEMENT[Tuple[KEY_TYPE, VALUE_TYPE]],
@@ -967,6 +964,24 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
967
964
  i: int | NumberVar,
968
965
  ) -> ObjectVar[Dict[KEY_TYPE, VALUE_TYPE]]: ...
969
966
 
967
+ @overload
968
+ def __getitem__(
969
+ self: ARRAY_VAR_OF_LIST_ELEMENT[BASE_TYPE],
970
+ i: int | NumberVar,
971
+ ) -> ObjectVar[BASE_TYPE]: ...
972
+
973
+ @overload
974
+ def __getitem__(
975
+ self: ARRAY_VAR_OF_LIST_ELEMENT[SQLA_TYPE],
976
+ i: int | NumberVar,
977
+ ) -> ObjectVar[SQLA_TYPE]: ...
978
+
979
+ @overload
980
+ def __getitem__(
981
+ self: ARRAY_VAR_OF_LIST_ELEMENT[DATACLASS_TYPE],
982
+ i: int | NumberVar,
983
+ ) -> ObjectVar[DATACLASS_TYPE]: ...
984
+
970
985
  @overload
971
986
  def __getitem__(self, i: int | NumberVar) -> Var: ...
972
987
 
@@ -987,7 +1002,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
987
1002
  raise_unsupported_operand_types("[]", (type(self), type(i)))
988
1003
  return array_item_operation(self, i)
989
1004
 
990
- def length(self) -> NumberVar:
1005
+ def length(self) -> NumberVar[int]:
991
1006
  """Get the length of the array.
992
1007
 
993
1008
  Returns:
@@ -1089,7 +1104,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
1089
1104
  def __mul__(self, other: NumberVar | int) -> ArrayVar[ARRAY_VAR_TYPE]: ...
1090
1105
 
1091
1106
  @overload
1092
- def __mul__(self, other: NoReturn) -> NoReturn: ...
1107
+ def __mul__(self, other: NoReturn) -> NoReturn: ... # pyright: ignore [reportOverlappingOverload]
1093
1108
 
1094
1109
  def __mul__(self, other: Any) -> ArrayVar[ARRAY_VAR_TYPE]:
1095
1110
  """Multiply the sequence by a number or integer.
@@ -1107,7 +1122,7 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
1107
1122
 
1108
1123
  return repeat_array_operation(self, other)
1109
1124
 
1110
- __rmul__ = __mul__ # type: ignore
1125
+ __rmul__ = __mul__
1111
1126
 
1112
1127
  @overload
1113
1128
  def __lt__(self, other: ArrayVar[ARRAY_VAR_TYPE]) -> BooleanVar: ...
@@ -1239,26 +1254,18 @@ class ArrayVar(Var[ARRAY_VAR_TYPE], python_types=(list, tuple, set)):
1239
1254
 
1240
1255
  LIST_ELEMENT = TypeVar("LIST_ELEMENT")
1241
1256
 
1242
- ARRAY_VAR_OF_LIST_ELEMENT = Union[
1243
- ArrayVar[List[LIST_ELEMENT]],
1244
- ArrayVar[Set[LIST_ELEMENT]],
1245
- ArrayVar[Tuple[LIST_ELEMENT, ...]],
1246
- ]
1257
+ ARRAY_VAR_OF_LIST_ELEMENT = ArrayVar[Sequence[LIST_ELEMENT]]
1247
1258
 
1248
1259
 
1249
1260
  @dataclasses.dataclass(
1250
1261
  eq=False,
1251
1262
  frozen=True,
1252
- **{"slots": True} if sys.version_info >= (3, 10) else {},
1263
+ slots=True,
1253
1264
  )
1254
1265
  class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
1255
1266
  """Base class for immutable literal array vars."""
1256
1267
 
1257
- _var_value: Union[
1258
- List[Union[Var, Any]],
1259
- Set[Union[Var, Any]],
1260
- Tuple[Union[Var, Any], ...],
1261
- ] = dataclasses.field(default_factory=list)
1268
+ _var_value: Sequence[Union[Var, Any]] = dataclasses.field(default=())
1262
1269
 
1263
1270
  @cached_property_no_lock
1264
1271
  def _cached_var_name(self) -> str:
@@ -1303,32 +1310,39 @@ class LiteralArrayVar(CachedVarOperation, LiteralVar, ArrayVar[ARRAY_VAR_TYPE]):
1303
1310
 
1304
1311
  Returns:
1305
1312
  The JSON representation of the var.
1313
+
1314
+ Raises:
1315
+ TypeError: If the array elements are not of type LiteralVar.
1306
1316
  """
1307
- return (
1308
- "["
1309
- + ", ".join(
1310
- [LiteralVar.create(element).json() for element in self._var_value]
1311
- )
1312
- + "]"
1313
- )
1317
+ elements = []
1318
+ for element in self._var_value:
1319
+ element_var = LiteralVar.create(element)
1320
+ if not isinstance(element_var, LiteralVar):
1321
+ raise TypeError(
1322
+ f"Array elements must be of type LiteralVar, not {type(element_var)}"
1323
+ )
1324
+ elements.append(element_var.json())
1325
+
1326
+ return "[" + ", ".join(elements) + "]"
1314
1327
 
1315
1328
  @classmethod
1316
1329
  def create(
1317
1330
  cls,
1318
- value: ARRAY_VAR_TYPE,
1319
- _var_type: Type[ARRAY_VAR_TYPE] | None = None,
1331
+ value: OTHER_ARRAY_VAR_TYPE,
1332
+ _var_type: Type[OTHER_ARRAY_VAR_TYPE] | None = None,
1320
1333
  _var_data: VarData | None = None,
1321
- ) -> LiteralArrayVar[ARRAY_VAR_TYPE]:
1334
+ ) -> LiteralArrayVar[OTHER_ARRAY_VAR_TYPE]:
1322
1335
  """Create a var from a string value.
1323
1336
 
1324
1337
  Args:
1325
1338
  value: The value to create the var from.
1339
+ _var_type: The type of the var.
1326
1340
  _var_data: Additional hooks and imports associated with the Var.
1327
1341
 
1328
1342
  Returns:
1329
1343
  The var.
1330
1344
  """
1331
- return cls(
1345
+ return LiteralArrayVar(
1332
1346
  _js_expr="",
1333
1347
  _var_type=figure_out_type(value) if _var_type is None else _var_type,
1334
1348
  _var_data=_var_data,
@@ -1355,7 +1369,7 @@ def string_split_operation(string: StringVar[Any], sep: StringVar | str = ""):
1355
1369
  @dataclasses.dataclass(
1356
1370
  eq=False,
1357
1371
  frozen=True,
1358
- **{"slots": True} if sys.version_info >= (3, 10) else {},
1372
+ slots=True,
1359
1373
  )
1360
1374
  class ArraySliceOperation(CachedVarOperation, ArrayVar):
1361
1375
  """Base class for immutable string vars that are the result of a string slice operation."""
@@ -1592,7 +1606,7 @@ def array_range_operation(
1592
1606
  The range of numbers.
1593
1607
  """
1594
1608
  return var_operation_return(
1595
- js_expression=f"Array.from({{ length: ({stop!s} - {start!s}) / {step!s} }}, (_, i) => {start!s} + i * {step!s})",
1609
+ js_expression=f"Array.from({{ length: Math.ceil(({stop!s} - {start!s}) / {step!s}) }}, (_, i) => {start!s} + i * {step!s})",
1596
1610
  var_type=List[int],
1597
1611
  )
1598
1612
 
@@ -1618,7 +1632,9 @@ def array_contains_field_operation(
1618
1632
 
1619
1633
 
1620
1634
  @var_operation
1621
- def array_contains_operation(haystack: ArrayVar, needle: Any | Var):
1635
+ def array_contains_operation(
1636
+ haystack: ArrayVar, needle: Any | Var
1637
+ ) -> CustomVarOperationReturn[bool]:
1622
1638
  """Check if an array contains an element.
1623
1639
 
1624
1640
  Args:
@@ -1653,15 +1669,11 @@ def repeat_array_operation(
1653
1669
  )
1654
1670
 
1655
1671
 
1656
- if TYPE_CHECKING:
1657
- from .function import FunctionVar
1658
-
1659
-
1660
1672
  @var_operation
1661
1673
  def map_array_operation(
1662
1674
  array: ArrayVar[ARRAY_VAR_TYPE],
1663
1675
  function: FunctionVar,
1664
- ):
1676
+ ) -> CustomVarOperationReturn[List[Any]]:
1665
1677
  """Map a function over an array.
1666
1678
 
1667
1679
  Args:
@@ -1691,7 +1703,7 @@ def array_concat_operation(
1691
1703
  """
1692
1704
  return var_operation_return(
1693
1705
  js_expression=f"[...{lhs}, ...{rhs}]",
1694
- var_type=Union[lhs._var_type, rhs._var_type],
1706
+ var_type=Union[lhs._var_type, rhs._var_type], # pyright: ignore [reportArgumentType]
1695
1707
  )
1696
1708
 
1697
1709
 
@@ -1702,7 +1714,7 @@ class ColorVar(StringVar[Color], python_types=Color):
1702
1714
  @dataclasses.dataclass(
1703
1715
  eq=False,
1704
1716
  frozen=True,
1705
- **{"slots": True} if sys.version_info >= (3, 10) else {},
1717
+ slots=True,
1706
1718
  )
1707
1719
  class LiteralColorVar(CachedVarOperation, LiteralVar, ColorVar):
1708
1720
  """Base class for immutable literal color vars."""
@@ -1,20 +1,19 @@
1
- Metadata-Version: 2.1
1
+ Metadata-Version: 2.3
2
2
  Name: reflex
3
- Version: 0.6.8a2
3
+ Version: 0.7.0
4
4
  Summary: Web apps in pure Python.
5
- Home-page: https://reflex.dev
6
5
  License: Apache-2.0
7
6
  Keywords: web,framework
8
7
  Author: Nikhil Rao
9
8
  Author-email: nikhil@reflex.dev
10
- Requires-Python: >=3.9,<4.0
9
+ Requires-Python: >=3.10,<4.0
11
10
  Classifier: Development Status :: 4 - Beta
12
11
  Classifier: License :: OSI Approved :: Apache Software License
13
12
  Classifier: Programming Language :: Python :: 3
14
- Classifier: Programming Language :: Python :: 3.9
15
13
  Classifier: Programming Language :: Python :: 3.10
16
14
  Classifier: Programming Language :: Python :: 3.11
17
15
  Classifier: Programming Language :: Python :: 3.12
16
+ Classifier: Programming Language :: Python :: 3.13
18
17
  Requires-Dist: alembic (>=1.11.1,<2.0)
19
18
  Requires-Dist: build (>=1.0.3,<2.0)
20
19
  Requires-Dist: charset-normalizer (>=3.3.2,<4.0)
@@ -32,8 +31,7 @@ Requires-Dist: python-engineio (!=4.6.0)
32
31
  Requires-Dist: python-multipart (>=0.0.5,<0.1)
33
32
  Requires-Dist: python-socketio (>=5.7.0,<6.0)
34
33
  Requires-Dist: redis (>=4.3.5,<6.0)
35
- Requires-Dist: reflex-chakra (>=0.6.0)
36
- Requires-Dist: reflex-hosting-cli (>=0.1.29,<2.0)
34
+ Requires-Dist: reflex-hosting-cli (>=0.1.29)
37
35
  Requires-Dist: rich (>=13.0.0,<14.0)
38
36
  Requires-Dist: setuptools (>=75.0)
39
37
  Requires-Dist: sqlmodel (>=0.0.14,<0.1)
@@ -47,6 +45,7 @@ Requires-Dist: wheel (>=0.42.0,<1.0)
47
45
  Requires-Dist: wrapt (>=1.11.0,<2.0) ; python_version < "3.11"
48
46
  Requires-Dist: wrapt (>=1.14.0,<2.0) ; python_version >= "3.11"
49
47
  Project-URL: Documentation, https://reflex.dev/docs/getting-started/introduction
48
+ Project-URL: Homepage, https://reflex.dev
50
49
  Project-URL: Repository, https://github.com/reflex-dev/reflex
51
50
  Description-Content-Type: text/markdown
52
51
 
@@ -86,7 +85,7 @@ See our [architecture page](https://reflex.dev/blog/2024-03-21-reflex-architectu
86
85
 
87
86
  ## ⚙️ Installation
88
87
 
89
- Open a terminal and run (Requires Python 3.9+):
88
+ Open a terminal and run (Requires Python 3.10+):
90
89
 
91
90
  ```bash
92
91
  pip install reflex