reflex 0.8.14a1__py3-none-any.whl → 0.8.14.post1__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/event.py CHANGED
@@ -875,7 +875,7 @@ class FileUpload:
875
875
  upload_files_context_var_data,
876
876
  )
877
877
 
878
- upload_id = self.upload_id or DEFAULT_UPLOAD_ID
878
+ upload_id = self.upload_id if self.upload_id is not None else DEFAULT_UPLOAD_ID
879
879
  spec_args = [
880
880
  (
881
881
  Var(_js_expr="files"),
@@ -236,7 +236,7 @@ class ClientStateVar(Var):
236
236
 
237
237
  setter = ArgsFunctionOperationBuilder.create(
238
238
  # remove patterns of ["*"] from the value_str using regex
239
- args_names=(re.sub(r"\[\".*\"\]", "", value_str),)
239
+ args_names=(re.sub(r"(\?\.)?\[\".*\"\]", "", value_str),)
240
240
  if value_str.startswith("_")
241
241
  else (),
242
242
  return_expr=setter.call(value_var),
@@ -29,22 +29,45 @@ def check_node_version() -> bool:
29
29
  )
30
30
 
31
31
 
32
- @once
33
- def get_node_version() -> version.Version | None:
34
- """Get the version of node.
32
+ def _get_version_of_executable(
33
+ executable_path: Path | None, version_arg: str = "--version"
34
+ ) -> version.Version | None:
35
+ """Get the version of an executable.
36
+
37
+ Args:
38
+ executable_path: The path to the executable.
39
+ version_arg: The argument to pass to the executable to get its version.
35
40
 
36
41
  Returns:
37
- The version of node.
42
+ The version of the executable.
38
43
  """
39
- node_path = path_ops.get_node_path()
40
- if node_path is None:
44
+ if executable_path is None:
41
45
  return None
42
46
  try:
43
- result = processes.new_process([node_path, "-v"], run=True)
44
- # The output will be in the form "vX.Y.Z", but version.parse() can handle it
45
- return version.parse(result.stdout)
47
+ result = processes.new_process([executable_path, version_arg], run=True)
48
+ if result.returncode != 0:
49
+ console.error(
50
+ f"Failed to run {executable_path} {version_arg} to get version. Return code: {result.returncode}. Standard error: {result.stderr!r}."
51
+ )
52
+ return None
53
+ return version.parse(result.stdout.strip())
46
54
  except (FileNotFoundError, TypeError):
47
55
  return None
56
+ except version.InvalidVersion as e:
57
+ console.warn(
58
+ f"The detected version of {executable_path} ({e.args[0]}) is not valid. Defaulting to None."
59
+ )
60
+ return None
61
+
62
+
63
+ @once
64
+ def get_node_version() -> version.Version | None:
65
+ """Get the version of node.
66
+
67
+ Returns:
68
+ The version of node.
69
+ """
70
+ return _get_version_of_executable(path_ops.get_node_path())
48
71
 
49
72
 
50
73
  def get_bun_version(bun_path: Path | None = None) -> version.Version | None:
@@ -56,20 +79,7 @@ def get_bun_version(bun_path: Path | None = None) -> version.Version | None:
56
79
  Returns:
57
80
  The version of bun.
58
81
  """
59
- bun_path = bun_path or path_ops.get_bun_path()
60
- if bun_path is None:
61
- return None
62
- try:
63
- # Run the bun -v command and capture the output
64
- result = processes.new_process([str(bun_path), "-v"], run=True)
65
- return version.parse(str(result.stdout))
66
- except FileNotFoundError:
67
- return None
68
- except version.InvalidVersion as e:
69
- console.warn(
70
- f"The detected bun version ({e.args[0]}) is not valid. Defaulting to None."
71
- )
72
- return None
82
+ return _get_version_of_executable(bun_path or path_ops.get_bun_path())
73
83
 
74
84
 
75
85
  def npm_escape_hatch() -> bool:
reflex/vars/base.py CHANGED
@@ -1135,17 +1135,14 @@ class Var(Generic[VAR_TYPE], metaclass=MetaclassVar):
1135
1135
  Returns:
1136
1136
  The reference to the var.
1137
1137
  """
1138
- from .object import ObjectVar
1139
-
1140
- refs = Var(
1141
- _js_expr="refs",
1138
+ return Var(
1139
+ _js_expr=f"refs[{Var.create(str(self))}]",
1142
1140
  _var_data=VarData(
1143
1141
  imports={
1144
1142
  f"$/{constants.Dirs.STATE_PATH}": [imports.ImportVar(tag="refs")]
1145
1143
  }
1146
1144
  ),
1147
- ).to(ObjectVar, Mapping[str, str])
1148
- return refs[LiteralVar.create(str(self))]
1145
+ ).to(str)
1149
1146
 
1150
1147
  def js_type(self) -> StringVar:
1151
1148
  """Returns the javascript type of the object.
reflex/vars/object.py CHANGED
@@ -557,9 +557,7 @@ class ObjectItemOperation(CachedVarOperation, Var):
557
557
  Returns:
558
558
  The name of the operation.
559
559
  """
560
- if types.is_optional(self._object._var_type):
561
- return f"{self._object!s}?.[{self._key!s}]"
562
- return f"{self._object!s}[{self._key!s}]"
560
+ return f"{self._object!s}?.[{self._key!s}]"
563
561
 
564
562
  @classmethod
565
563
  def create(
reflex/vars/sequence.py CHANGED
@@ -1056,7 +1056,7 @@ def string_item_operation(string: StringVar[Any], index: NumberVar | int):
1056
1056
  Returns:
1057
1057
  The item from the string.
1058
1058
  """
1059
- return var_operation_return(js_expression=f"{string}.at({index})", var_type=str)
1059
+ return var_operation_return(js_expression=f"{string}?.at?.({index})", var_type=str)
1060
1060
 
1061
1061
 
1062
1062
  @var_operation
@@ -1619,7 +1619,7 @@ def array_item_operation(array: ArrayVar, index: NumberVar | int):
1619
1619
  )
1620
1620
 
1621
1621
  return var_operation_return(
1622
- js_expression=f"{array!s}.at({index!s})",
1622
+ js_expression=f"{array!s}?.at?.({index!s})",
1623
1623
  var_type=element_type,
1624
1624
  )
1625
1625
 
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: reflex
3
- Version: 0.8.14a1
3
+ Version: 0.8.14.post1
4
4
  Summary: Web apps in pure Python.
5
5
  Project-URL: homepage, https://reflex.dev
6
6
  Project-URL: repository, https://github.com/reflex-dev/reflex
@@ -7,7 +7,7 @@ reflex/assets.py,sha256=l5O_mlrTprC0lF7Rc_McOe3a0OtSLnRdNl_PqCpDCBA,3431
7
7
  reflex/base.py,sha256=Oh664QL3fZEHErhUasFqP7fE4olYf1y-9Oj6uZI2FCU,1173
8
8
  reflex/config.py,sha256=LsHAtdH4nkSn3q_Ie-KNdOGdflLXrFICUQov29oFjVk,21229
9
9
  reflex/environment.py,sha256=USXLwLP86KKeLFvs_di4j73GsLkZ9SdQEeh-374CZH4,23854
10
- reflex/event.py,sha256=e2EIBmLF63KRw4GXSbuiQ6yDp1-YQHHIxJKenTra9vk,76223
10
+ reflex/event.py,sha256=KlNFqtJacwiPCtp7rkIlbskZqCME9RJsAHF-6pOEvwg,76255
11
11
  reflex/model.py,sha256=2QhU1TJlcDeRA23pv8usLjyDaA6FhbQRYdzsjOHzvUI,19665
12
12
  reflex/page.py,sha256=ssCbMVFuIy60vH-YhJUzN0OxzUwXFCCD3ej56dVjp3g,3525
13
13
  reflex/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
@@ -43,7 +43,7 @@ reflex/app_mixins/middleware.py,sha256=BKhe0jUFO1_TylEC48LUZyaeYyPmAYW-NV4H5Rw22
43
43
  reflex/app_mixins/mixin.py,sha256=R1YncalqDrbdPZvpKVbm72ZKmQZxYAWfuFq9JknzTqQ,305
44
44
  reflex/compiler/__init__.py,sha256=r8jqmDSFf09iV2lHlNhfc9XrTLjNxfDNwPYlxS4cmHE,27
45
45
  reflex/compiler/compiler.py,sha256=-MnavauFrb9xmePf0VsFB0vLlE6Nr5zY8x7kne2Uzvg,29156
46
- reflex/compiler/templates.py,sha256=ucfkEMOGA49ceUnL1KXDP_oHKxPrELSKWtRgtXUVHjk,20547
46
+ reflex/compiler/templates.py,sha256=UDm_3XcK9KSEws1qNzAgYgs15y-_N1LhcY1QtYOmQRw,20705
47
47
  reflex/compiler/utils.py,sha256=RmeUoZMHdIfnqPl-p0ToPgwd0FEFO5u0Xbb-J20UYdQ,19621
48
48
  reflex/components/__init__.py,sha256=eWpgWFbSQDj2TpGp6StEbxU7roQgzY7ZM0XIcIc5RE8,588
49
49
  reflex/components/__init__.pyi,sha256=7VFHtJGIjvGtD3IiPk848IPWYSCcPRT1EyPGljLhYlU,736
@@ -96,7 +96,7 @@ reflex/components/core/responsive.py,sha256=ACZdtJ4a4F8B3dm1k8h6J2_UJx0Z5LDB7XHQ
96
96
  reflex/components/core/sticky.py,sha256=2B3TxrwG2Rtp_lv1VkMOIF2bqSiT7qYGbqbiZiMKxKY,3856
97
97
  reflex/components/core/sticky.pyi,sha256=5D-yT0LYs0ewOlUlInU7KCpuz49yKK7dirysUs1C2VI,32908
98
98
  reflex/components/core/upload.py,sha256=lVEu-vZGAdZHd-tjN-w9gNDhSijLLt6Vwm3WPf77wzk,15174
99
- reflex/components/core/upload.pyi,sha256=Bc3ds_6AFu0xtk-aQYL4PXXV7TTDk7_XPW_IWKVcY5E,16409
99
+ reflex/components/core/upload.pyi,sha256=TQVUHt47YsfleD_O-gbLJMzie5slnjft-KVs_7jjRtQ,16820
100
100
  reflex/components/core/window_events.py,sha256=opbuO20zVxt252kQLk49V7cltb_Um2oh7iePeGNJ538,3355
101
101
  reflex/components/core/window_events.pyi,sha256=aTkBiAy-e9LqkQm6_apRsXXfJRdawA11cE1tQQSIy3c,3206
102
102
  reflex/components/core/layout/__init__.py,sha256=znldZaj_NGt8qCZDG70GMwjMTskcvCf_2N_EjCAHwdc,30
@@ -152,12 +152,14 @@ reflex/components/plotly/plotly.py,sha256=4PugE2Gy2x02CSz_0GbnUbuIJAfjydQoMWxv1K
152
152
  reflex/components/plotly/plotly.pyi,sha256=5Nhph2PL9eIb-Xd6CUZHQf79P-tOazy1alwRQl7CKWw,46821
153
153
  reflex/components/radix/__init__.py,sha256=fRsLvIO3MrTtPOXtmnxYDB9phvzlcbyB_utgpafYMho,474
154
154
  reflex/components/radix/__init__.pyi,sha256=ke_dGrpFMNHd3MgQ9qiStSQDlGcJ39KVSrpIxayBU3c,3927
155
- reflex/components/radix/primitives/__init__.py,sha256=R2sdZJqQCYaLScGkXnXDKAjVgV5MidceemooEUtvBt4,443
156
- reflex/components/radix/primitives/__init__.pyi,sha256=kOCtVqDuSsBt5-lCcqM-3CBJsv-QokWIfkq0_iyqVDU,413
155
+ reflex/components/radix/primitives/__init__.py,sha256=UxV6xMJ9v9i16YnxuEykG9ZchOEde2k49EVaANi4yjU,468
156
+ reflex/components/radix/primitives/__init__.pyi,sha256=_zFNy-s6B4fQxPzbxmGZNBH04X9p1jSZDdm05UMwVkE,450
157
157
  reflex/components/radix/primitives/accordion.py,sha256=yr_GtuU8cGiMyXmWXFx-Tz8P1dyz-zNTa1-bsHoME-Y,16191
158
158
  reflex/components/radix/primitives/accordion.pyi,sha256=QuAwkB02qfJs8zqHfS25tpLYCjlnenEIMH61KKI8u1Q,28219
159
- reflex/components/radix/primitives/base.py,sha256=9OvGDI1to8XL_a2hr3fNBQUwTHZBUO424ea2-UTKD18,770
160
- reflex/components/radix/primitives/base.pyi,sha256=Cv5PCGNBO-QFXvBs5E5sxIkcQUgSHHUhSxQPl64T4ZU,4635
159
+ reflex/components/radix/primitives/base.py,sha256=mXBH4Izv6g6ZLG5o0ZFNTgzropxnro0up8yRms5-6fU,1862
160
+ reflex/components/radix/primitives/base.pyi,sha256=p0x9lC9gVBZFvx-zga6x4JKOo0uqq4UIZvpKUAOnKuc,6386
161
+ reflex/components/radix/primitives/dialog.py,sha256=V72XVYAYRDubi6GD-DHRttbZ41mk1NTuR-pDNr3a-1k,5011
162
+ reflex/components/radix/primitives/dialog.pyi,sha256=AGlWKZT76zm13yWCo34IOv7f9u_UGiQp-QMFFdYs8ko,29880
161
163
  reflex/components/radix/primitives/drawer.py,sha256=9x-8chrFxAfuQ79p09aubQp-hVJqTxvIq42JVypWv4Y,8830
162
164
  reflex/components/radix/primitives/drawer.pyi,sha256=DG-Vu07qwj0utprcheNZrgGp3a3joZmXyfwlLDyFsHc,29883
163
165
  reflex/components/radix/primitives/form.py,sha256=jxCt0xZRE9Xx5tBIJNojYwyvhN631_aNdlFQSPgm2dU,4801
@@ -324,7 +326,7 @@ reflex/constants/utils.py,sha256=e1ChEvbHfmE_V2UJvCSUhD_qTVAIhEGPpRJSqdSd6PA,780
324
326
  reflex/custom_components/__init__.py,sha256=R4zsvOi4dfPmHc18KEphohXnQFBPnUCb50cMR5hSLDE,36
325
327
  reflex/custom_components/custom_components.py,sha256=z5eL7WqbU4Vx5zVRWqgYPQu05P29XFsJ48xL9OLiyRg,25355
326
328
  reflex/experimental/__init__.py,sha256=P8fe8S2e2gy2HCwHFGQzr3lPMmh7qN5Ii2e8ukoPHuQ,1664
327
- reflex/experimental/client_state.py,sha256=adITjFmvzO081yaVgne2PZpG0hc_SrJHyLLbE-zfet0,10024
329
+ reflex/experimental/client_state.py,sha256=BPVOewGjuntuRCQDJvh-Tj290iTool5IpqnYsi_czrc,10031
328
330
  reflex/experimental/hooks.py,sha256=CHYGrAE5t8riltrJmDFgJ4D2Vhmhw-y3B3MSGNlOQow,2366
329
331
  reflex/istate/__init__.py,sha256=afq_pCS5B_REC-Kl3Rbaa538uWi59xNz4INeuENcWnk,2039
330
332
  reflex/istate/data.py,sha256=8RydiarP7f5ET5a3dfGpuuXdYZ7KHEWS6aENVoxRxGc,7918
@@ -355,7 +357,7 @@ reflex/utils/export.py,sha256=dR8Q7OymxcS8PCvx5zV2kOZmjKgOmuAfKfL8XifHJd4,2907
355
357
  reflex/utils/format.py,sha256=-EC0tfx7VCIijcuJx9l-ArRnRnPKrrrW8RgsKwXIoBc,21115
356
358
  reflex/utils/frontend_skeleton.py,sha256=FqvNWclY_lRR-odjQmP-xaY3uiWVD2l5qqExt8qRzEI,8769
357
359
  reflex/utils/imports.py,sha256=SlQfMTbJasXHxrpcHdWKPWiIZ1Kn2-tulMF32_YA2ek,4262
358
- reflex/utils/js_runtimes.py,sha256=mpDJ4h22z4GorOUPNkdabv-PS7jxPm93G0dJ-H7Hzp8,13193
360
+ reflex/utils/js_runtimes.py,sha256=Xia4pIyWGwUmNnTgELm04oxVQobwdQvmK87AHTr3B1o,13542
359
361
  reflex/utils/lazy_loader.py,sha256=BiY9OvmAJDCz10qpuyTYv9duXgMFQa6RXKQmTO9hqKU,4453
360
362
  reflex/utils/misc.py,sha256=folEweZVCrhHNkkqut9KqQdTJ80HxwL_gI41m40FnNM,4592
361
363
  reflex/utils/monitoring.py,sha256=87fr9j6Y9Bvz2uF4tBxuX6CaU054h1UPx0ijcnyP_kw,5250
@@ -373,17 +375,17 @@ reflex/utils/templates.py,sha256=FWtO6kZldDK3MPj39LitPlcyWV9_Z8Ys6G9anitv94A,141
373
375
  reflex/utils/token_manager.py,sha256=ZtrYR0X8tTs8FpQHtMb09-H2V1xSoLWwVH8jW8OCrU8,7445
374
376
  reflex/utils/types.py,sha256=v2shXUDPqsgrxXDwrP9JYYgSTwZht0YjAo5c1mDDI8M,38543
375
377
  reflex/vars/__init__.py,sha256=pUzFFkY-brpEoqYHQc41VefaOdPQG6xzjer1RJy9IKo,1264
376
- reflex/vars/base.py,sha256=xqdYqsWmtN86diCB1g9Wwptczeebf1Jv1l4fxVRw30M,110394
378
+ reflex/vars/base.py,sha256=gWOVTeRVH9fheQtqJkh_GPP8F8gcdFfgJAHcZcNFn18,110306
377
379
  reflex/vars/color.py,sha256=fpc3u9_H9R_DVawKMOf3tV1NDSnOs0aPHt4k1Lyu_KY,4085
378
380
  reflex/vars/datetime.py,sha256=F2Jv_bfydipFSkIQ1F6x5MnSgFEyES9Vq5RG_uGH81E,5118
379
381
  reflex/vars/dep_tracking.py,sha256=LfDGgAGlqfC0DeiVcitRBcA1uCe1C3fNRARRekLgCz4,13738
380
382
  reflex/vars/function.py,sha256=0i-VkxHkDJmZtfQUwUfaF0rlS6WM8azjwQ8k7rEOkyk,13944
381
383
  reflex/vars/number.py,sha256=FP5Jmd8qOwZgGHUG9DSmneBB4X6bj7G8oIDYsDw_j80,28242
382
- reflex/vars/object.py,sha256=p7dyn9rD6rVJlHQ_RcDTBgsU_AlbwYklGjx1HK3XxZg,16565
383
- reflex/vars/sequence.py,sha256=fbwA7ImcPbic4NPW4Fp81ty0X7PQlr751vLvfGeST1Q,51439
384
+ reflex/vars/object.py,sha256=AMvLFWyQBMSTUzmQT30M4CDUx9ec0C87cUDV8OjoDac,16457
385
+ reflex/vars/sequence.py,sha256=JAvHmLxnT6B2AQhLx6RTodGybdhcxhJrYxUlhCklYNY,51445
384
386
  scripts/hatch_build.py,sha256=-4pxcLSFmirmujGpQX9UUxjhIC03tQ_fIQwVbHu9kc0,1861
385
- reflex-0.8.14a1.dist-info/METADATA,sha256=thlmwjYzdbkzOOg-bsaX-Sf9zLRSzXlCuKYNsO_BA8A,12336
386
- reflex-0.8.14a1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
387
- reflex-0.8.14a1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
388
- reflex-0.8.14a1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
389
- reflex-0.8.14a1.dist-info/RECORD,,
387
+ reflex-0.8.14.post1.dist-info/METADATA,sha256=zL0N6SIf4VIhGY7nyAHU2kfHBCaOw_4LwbgeEtmp8Nk,12340
388
+ reflex-0.8.14.post1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
389
+ reflex-0.8.14.post1.dist-info/entry_points.txt,sha256=Rxt4dXc7MLBNt5CSHTehVPuSe9Xqow4HLX55nD9tQQ0,45
390
+ reflex-0.8.14.post1.dist-info/licenses/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
391
+ reflex-0.8.14.post1.dist-info/RECORD,,