reflex 0.4.5a1__py3-none-any.whl → 0.4.5a2__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 CHANGED
@@ -77,7 +77,7 @@ from reflex.state import (
77
77
  code_uses_state_contexts,
78
78
  )
79
79
  from reflex.utils import console, exceptions, format, prerequisites, types
80
- from reflex.utils.exec import is_testing_env
80
+ from reflex.utils.exec import is_testing_env, should_skip_compile
81
81
  from reflex.utils.imports import ImportVar
82
82
 
83
83
  # Define custom types.
@@ -672,7 +672,7 @@ class App(Base):
672
672
  Whether the app should be compiled.
673
673
  """
674
674
  # Check the environment variable.
675
- if os.environ.get(constants.SKIP_COMPILE_ENV_VAR) == "yes":
675
+ if should_skip_compile():
676
676
  return False
677
677
 
678
678
  # Check the nocompile file.
@@ -181,6 +181,9 @@ class HighLevelSelect(SelectRoot):
181
181
  # The radius of the select.
182
182
  radius: Var[LiteralRadius]
183
183
 
184
+ # The width of the select.
185
+ width: Var[str]
186
+
184
187
  # The positioning mode to use. Default is "item-aligned".
185
188
  position: Var[Literal["item-aligned", "popper"]]
186
189
 
@@ -203,7 +206,7 @@ class HighLevelSelect(SelectRoot):
203
206
 
204
207
  trigger_props = {
205
208
  prop: props.pop(prop)
206
- for prop in ["placeholder", "variant", "radius"]
209
+ for prop in ["placeholder", "variant", "radius", "width", "flex_shrink"]
207
210
  if prop in props
208
211
  }
209
212
 
@@ -863,6 +863,7 @@ class HighLevelSelect(SelectRoot):
863
863
  Literal["none", "small", "medium", "large", "full"],
864
864
  ]
865
865
  ] = None,
866
+ width: Optional[Union[Var[str], str]] = None,
866
867
  position: Optional[
867
868
  Union[
868
869
  Var[Literal["item-aligned", "popper"]],
@@ -949,6 +950,7 @@ class HighLevelSelect(SelectRoot):
949
950
  high_contrast: Whether to render the select with higher contrast color against background.
950
951
  variant: The variant of the select.
951
952
  radius: The radius of the select.
953
+ width: The width of the select.
952
954
  position: The positioning mode to use. Default is "item-aligned".
953
955
  size: The size of the select: "1" | "2" | "3"
954
956
  default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select.
@@ -1061,6 +1063,7 @@ class Select(ComponentNamespace):
1061
1063
  Literal["none", "small", "medium", "large", "full"],
1062
1064
  ]
1063
1065
  ] = None,
1066
+ width: Optional[Union[Var[str], str]] = None,
1064
1067
  position: Optional[
1065
1068
  Union[
1066
1069
  Var[Literal["item-aligned", "popper"]],
@@ -1147,6 +1150,7 @@ class Select(ComponentNamespace):
1147
1150
  high_contrast: Whether to render the select with higher contrast color against background.
1148
1151
  variant: The variant of the select.
1149
1152
  radius: The radius of the select.
1153
+ width: The width of the select.
1150
1154
  position: The positioning mode to use. Default is "item-aligned".
1151
1155
  size: The size of the select: "1" | "2" | "3"
1152
1156
  default_value: The value of the select when initially rendered. Use when you do not need to control the state of the select.
reflex/utils/exec.py CHANGED
@@ -307,3 +307,12 @@ def is_prod_mode() -> bool:
307
307
  constants.Env.DEV.value,
308
308
  )
309
309
  return current_mode == constants.Env.PROD.value
310
+
311
+
312
+ def should_skip_compile() -> bool:
313
+ """Whether the app should skip compile.
314
+
315
+ Returns:
316
+ True if the app should skip compile.
317
+ """
318
+ return os.environ.get(constants.SKIP_COMPILE_ENV_VAR) == "yes"
@@ -448,7 +448,7 @@ def get_project_hash(raise_on_fail: bool = False) -> int | None:
448
448
  # Open and read the file
449
449
  with open(constants.Reflex.JSON, "r") as file:
450
450
  data = json.load(file)
451
- return data["project_hash"]
451
+ return data.get("project_hash")
452
452
 
453
453
 
454
454
  def initialize_web_directory():
reflex/utils/telemetry.py CHANGED
@@ -11,6 +11,7 @@ import psutil
11
11
 
12
12
  from reflex import constants
13
13
  from reflex.utils import console
14
+ from reflex.utils.exec import should_skip_compile
14
15
  from reflex.utils.prerequisites import ensure_reflex_installation_id, get_project_hash
15
16
 
16
17
  POSTHOG_API_URL: str = "https://app.posthog.com/capture/"
@@ -64,6 +65,22 @@ def get_memory() -> int:
64
65
  return 0
65
66
 
66
67
 
68
+ def _raise_on_missing_project_hash() -> bool:
69
+ """Check if an error should be raised when project hash is missing.
70
+
71
+ When running reflex with --backend-only, or doing database migration
72
+ operations, there is no requirement for a .web directory, so the reflex.json
73
+ file may not exist, and this should not be considered an error.
74
+
75
+ Returns:
76
+ False when compilation should be skipped (i.e. no .web directory is required).
77
+ Otherwise return True.
78
+ """
79
+ if should_skip_compile():
80
+ return False
81
+ return True
82
+
83
+
67
84
  def _prepare_event(event: str) -> dict:
68
85
  """Prepare the event to be sent to the PostHog server.
69
86
 
@@ -74,7 +91,7 @@ def _prepare_event(event: str) -> dict:
74
91
  The event data.
75
92
  """
76
93
  installation_id = ensure_reflex_installation_id()
77
- project_hash = get_project_hash(raise_on_fail=True)
94
+ project_hash = get_project_hash(raise_on_fail=_raise_on_missing_project_hash())
78
95
 
79
96
  if installation_id is None or project_hash is None:
80
97
  console.debug(
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reflex
3
- Version: 0.4.5a1
3
+ Version: 0.4.5a2
4
4
  Summary: Web apps in pure Python.
5
5
  Home-page: https://reflex.dev
6
6
  License: Apache-2.0
@@ -82,7 +82,7 @@ reflex/__init__.py,sha256=AWw9ICSuAvfwib_Hq_fKIxOwVZNHO5PQocFkD8c4xhY,5546
82
82
  reflex/__init__.pyi,sha256=A5ggRGTri9IVTPLZNePVWEU4ZMv1hF9UraSbY1sNfEc,7362
83
83
  reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
84
84
  reflex/admin.py,sha256=-bTxFUEoHo4X9FzmcSa6KSVVPpF7wh38lBvF67GhSvQ,373
85
- reflex/app.py,sha256=uPdS1jmESAW4rd4OVu2fL9yAmLqem-szBRdb3mjUJlM,43887
85
+ reflex/app.py,sha256=nO8dFZO-vRQgYCdgMFuFlK4vnJAxlJM-Q8AMumOSaOk,43874
86
86
  reflex/app.pyi,sha256=rbma5FRlD76JOtdFxUcWrgcVuLS47CmXivr-f8vKTbY,4928
87
87
  reflex/app_module_for_backend.py,sha256=APD4jFsG-Tfd0vZWAfsdBYj4E4PeGZjjWeOZwBfUKRM,1152
88
88
  reflex/base.py,sha256=EnYFVfXQgRcsz7JtBdfBkvxkf9msLEmt6OS-yGwcJQM,3869
@@ -390,8 +390,8 @@ reflex/components/radix/themes/components/radiogroup.pyi,sha256=4A_iObTwZH2Be9I0
390
390
  reflex/components/radix/themes/components/scroll_area.py,sha256=0Oc5K7sycSH_X8HbVI2A_FS8AddoFXcwvH_YZpsjTkc,920
391
391
  reflex/components/radix/themes/components/scroll_area.pyi,sha256=G-0BnHn0cUnP6cRYPETLaWWWU17EFjH1QVwawUEbKS0,4422
392
392
  reflex/components/radix/themes/components/scrollarea.pyi,sha256=rwOEpVI0m9gMjlSPPwOgUGc4n8tD2g5NQZ-NyvBGFWg,6513
393
- reflex/components/radix/themes/components/select.py,sha256=ygn47iervRR9LoJhwybLSJPI8gFhimbhl28kjgNe2ro,7830
394
- reflex/components/radix/themes/components/select.pyi,sha256=KzfcVTCFbqL0mLz_WjjD21kuOyCgSiLhMyHDXRbMDq4,44922
393
+ reflex/components/radix/themes/components/select.py,sha256=BFx07foqIUm_neLZwiKV6Ddr_HRLZKtklRLHyGvwEv4,7906
394
+ reflex/components/radix/themes/components/select.pyi,sha256=4JwOMhG0Cfh0tJykIEYcpUPYkrUvzTjxZV43QntGuPc,45118
395
395
  reflex/components/radix/themes/components/separator.py,sha256=si-4AZAKvjQwo6DCiHKdND7pK13vL1eWHCTO5OpIfb0,868
396
396
  reflex/components/radix/themes/components/separator.pyi,sha256=gHPRkoUJIRQXBtf6RDX7qZkxK8f1zDXddQsUT5Yg2rM,6073
397
397
  reflex/components/radix/themes/components/slider.py,sha256=cCuZuRxUi_hA86PP0YHmvbD22ezvCGcXllTn_xuQd08,3234
@@ -503,21 +503,21 @@ reflex/utils/__init__.py,sha256=y-AHKiRQAhk2oAkvn7W8cRVTZVK625ff8tTwvZtO7S4,24
503
503
  reflex/utils/build.py,sha256=9LE93QlbfTHYyQWTgGZYSXX7QGDYzuE01ttWUVw_rGQ,8573
504
504
  reflex/utils/console.py,sha256=oEEaV9oSw5B24LPEwBOGlyrk2xI91Fo-pqGEsNICrjg,4583
505
505
  reflex/utils/exceptions.py,sha256=oniHYS_c18hvwva4tvEmO33Fjmp605uFJBX4liKuqp8,504
506
- reflex/utils/exec.py,sha256=xzD-wTKmj9s9ROPWoBQQV5HnqfNVLY0d1bfB1q5cHww,9199
506
+ reflex/utils/exec.py,sha256=jQH2JxwcrJYlsMVkPyndjunJOCnU__e2-WMKk9TFuSo,9414
507
507
  reflex/utils/export.py,sha256=daLyx4W-Kjit7Wjg5Db7-yFarF8r0d2IJ8aliXLDXZo,2454
508
508
  reflex/utils/format.py,sha256=4vY7NP-f7B2euJ5F5dM3yh5SYPzCY3bVZDATG2DMaMU,22648
509
509
  reflex/utils/imports.py,sha256=yah1kSVsOyUxA0wOMxJTwcmu6xlmkLJtV_zRIhshpsA,1919
510
510
  reflex/utils/path_ops.py,sha256=Vy6fU_bXvOcCvbXdTSmeLwy_C4h9seYU-3yIrVdZEZQ,4737
511
- reflex/utils/prerequisites.py,sha256=Bu3fl2lmr5cXBfjBvIk_w5ajfCUcUaDzkr6EKLhJ68k,38426
511
+ reflex/utils/prerequisites.py,sha256=xg6uqN__z-lNuiH6ngTN2vXxDgpYCMvBwwpFLqNMMwM,38430
512
512
  reflex/utils/processes.py,sha256=u4VAlbr4OyXHURkAi7euJv7GmSQNqb5FP-wdoLOQjcg,8924
513
513
  reflex/utils/serializers.py,sha256=4LOCpri11NKVocnPb4zzgIBvW8fT-fX0h_1DIMfv5yI,8538
514
- reflex/utils/telemetry.py,sha256=jGnUXvGJa-Lj4_VONdTm1l9P4bnWyX577EMAiEG6YTI,3132
514
+ reflex/utils/telemetry.py,sha256=iQBH5gcAmMBOyGjb49yqQXJudJsG_jpxsdxW4a-Xs3g,3760
515
515
  reflex/utils/types.py,sha256=1FaFTmPmSfLuMtSLrt02np6Nyhe22n6zC0LiAznAn10,13260
516
516
  reflex/utils/watch.py,sha256=HzGrHQIZ_62Di0BO46kd2AZktNA3A6nFIBuf8c6ip30,2609
517
517
  reflex/vars.py,sha256=WSEwvRB55n9WwkZ6TEpvMPFBk-v7MaK2_Cn5quqfYJw,65958
518
518
  reflex/vars.pyi,sha256=4sZo25A0nZ5nLhZ_uUnnz8enzBddhBvGmuHZAM2JhU4,5575
519
- reflex-0.4.5a1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
520
- reflex-0.4.5a1.dist-info/METADATA,sha256=hQV7rF7vgJU0mPtTsdFUC6gcufbL6_r_wZ5OO_mUSnw,11325
521
- reflex-0.4.5a1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
522
- reflex-0.4.5a1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
523
- reflex-0.4.5a1.dist-info/RECORD,,
519
+ reflex-0.4.5a2.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
520
+ reflex-0.4.5a2.dist-info/METADATA,sha256=PanY_0lJ7Q6K5waVk1ysT3EjJAb0055Z2k4PnLvsTUo,11325
521
+ reflex-0.4.5a2.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
522
+ reflex-0.4.5a2.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
523
+ reflex-0.4.5a2.dist-info/RECORD,,