reflex 0.7.0a4__py3-none-any.whl → 0.7.0a5__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
@@ -1023,7 +1023,7 @@ class App(MiddlewareMixin, LifespanMixin):
1023
1023
  self._validate_var_dependencies()
1024
1024
  self._setup_overlay_component()
1025
1025
  self._setup_error_boundary()
1026
- if config.show_built_with_reflex:
1026
+ if is_prod_mode() and config.show_built_with_reflex:
1027
1027
  self._setup_sticky_badge()
1028
1028
 
1029
1029
  progress.advance(task)
@@ -2,14 +2,12 @@
2
2
 
3
3
  from reflex.components.component import ComponentNamespace
4
4
  from reflex.components.core.colors import color
5
- from reflex.components.core.cond import color_mode_cond, cond
6
- from reflex.components.core.responsive import tablet_and_desktop
5
+ from reflex.components.core.cond import color_mode_cond
6
+ from reflex.components.core.responsive import desktop_only
7
7
  from reflex.components.el.elements.inline import A
8
8
  from reflex.components.el.elements.media import Path, Rect, Svg
9
9
  from reflex.components.radix.themes.typography.text import Text
10
- from reflex.experimental.client_state import ClientStateVar
11
10
  from reflex.style import Style
12
- from reflex.vars.base import Var, VarData
13
11
 
14
12
 
15
13
  class StickyLogo(Svg):
@@ -87,7 +85,7 @@ class StickyBadge(A):
87
85
  """
88
86
  return super().create(
89
87
  StickyLogo.create(),
90
- tablet_and_desktop(StickyLabel.create()),
88
+ desktop_only(StickyLabel.create()),
91
89
  href="https://reflex.dev",
92
90
  target="_blank",
93
91
  width="auto",
@@ -102,36 +100,12 @@ class StickyBadge(A):
102
100
  Returns:
103
101
  The style of the component.
104
102
  """
105
- is_localhost_cs = ClientStateVar.create(
106
- "is_localhost",
107
- default=True,
108
- global_ref=False,
109
- )
110
- localhost_hostnames = Var.create(
111
- ["localhost", "127.0.0.1", "[::1]"]
112
- ).guess_type()
113
- is_localhost_expr = localhost_hostnames.contains(
114
- Var("window.location.hostname", _var_type=str).guess_type(),
115
- )
116
- check_is_localhost = Var(
117
- f"useEffect(({is_localhost_cs}) => {is_localhost_cs.set}({is_localhost_expr}), [])",
118
- _var_data=VarData(
119
- imports={"react": "useEffect"},
120
- ),
121
- )
122
- is_localhost = is_localhost_cs.value._replace(
123
- merge_var_data=VarData.merge(
124
- check_is_localhost._get_all_var_data(),
125
- VarData(hooks={str(check_is_localhost): None}),
126
- ),
127
- )
128
103
  return Style(
129
104
  {
130
105
  "position": "fixed",
131
106
  "bottom": "1rem",
132
107
  "right": "1rem",
133
- # Do not show the badge on localhost.
134
- "display": cond(is_localhost, "none", "flex"),
108
+ "display": "flex",
135
109
  "flex-direction": "row",
136
110
  "gap": "0.375rem",
137
111
  "align-items": "center",
reflex/reflex.py CHANGED
@@ -145,10 +145,7 @@ def _run(
145
145
  exec.output_system_info()
146
146
 
147
147
  # If no --frontend-only and no --backend-only, then turn on frontend and backend both
148
- if not frontend and not backend:
149
- frontend = True
150
- backend = True
151
-
148
+ frontend, backend = prerequisites.check_running_mode(frontend, backend)
152
149
  if not frontend and backend:
153
150
  _skip_compile()
154
151
 
@@ -306,10 +303,18 @@ def export(
306
303
  True, "--no-zip", help="Disable zip for backend and frontend exports."
307
304
  ),
308
305
  frontend: bool = typer.Option(
309
- True, "--backend-only", help="Export only backend.", show_default=False
306
+ False,
307
+ "--frontend-only",
308
+ help="Export only frontend.",
309
+ show_default=False,
310
+ envvar=environment.REFLEX_FRONTEND_ONLY.name,
310
311
  ),
311
312
  backend: bool = typer.Option(
312
- True, "--frontend-only", help="Export only frontend.", show_default=False
313
+ False,
314
+ "--backend-only",
315
+ help="Export only backend.",
316
+ show_default=False,
317
+ envvar=environment.REFLEX_BACKEND_ONLY.name,
313
318
  ),
314
319
  zip_dest_dir: str = typer.Option(
315
320
  str(Path.cwd()),
@@ -332,7 +337,9 @@ def export(
332
337
  from reflex.utils import export as export_utils
333
338
  from reflex.utils import prerequisites
334
339
 
335
- if prerequisites.needs_reinit(frontend=True):
340
+ frontend, backend = prerequisites.check_running_mode(frontend, backend)
341
+
342
+ if prerequisites.needs_reinit(frontend=frontend or not backend):
336
343
  _init(name=config.app_name, loglevel=loglevel)
337
344
 
338
345
  if frontend and not config.show_built_with_reflex:
reflex/utils/path_ops.py CHANGED
@@ -247,6 +247,22 @@ def find_replace(directory: str | Path, find: str, replace: str):
247
247
  filepath.write_text(text, encoding="utf-8")
248
248
 
249
249
 
250
+ def samefile(file1: Path, file2: Path) -> bool:
251
+ """Check if two files are the same.
252
+
253
+ Args:
254
+ file1: The first file.
255
+ file2: The second file.
256
+
257
+ Returns:
258
+ Whether the files are the same. If either file does not exist, returns False.
259
+ """
260
+ if file1.exists() and file2.exists():
261
+ return file1.samefile(file2)
262
+
263
+ return False
264
+
265
+
250
266
  def update_directory_tree(src: Path, dest: Path):
251
267
  """Recursively copies a directory tree from src to dest.
252
268
  Only copies files if the destination file is missing or modified earlier than the source file.
@@ -1225,6 +1225,21 @@ def install_frontend_packages(packages: set[str], config: Config):
1225
1225
  )
1226
1226
 
1227
1227
 
1228
+ def check_running_mode(frontend: bool, backend: bool) -> tuple[bool, bool]:
1229
+ """Check if the app is running in frontend or backend mode.
1230
+
1231
+ Args:
1232
+ frontend: Whether to run the frontend of the app.
1233
+ backend: Whether to run the backend of the app.
1234
+
1235
+ Returns:
1236
+ The running modes.
1237
+ """
1238
+ if not frontend and not backend:
1239
+ return True, True
1240
+ return frontend, backend
1241
+
1242
+
1228
1243
  def needs_reinit(frontend: bool = True) -> bool:
1229
1244
  """Check if an app needs to be reinitialized.
1230
1245
 
@@ -1293,10 +1308,13 @@ def validate_bun():
1293
1308
  """
1294
1309
  bun_path = path_ops.get_bun_path()
1295
1310
 
1296
- if bun_path and not bun_path.samefile(constants.Bun.DEFAULT_PATH):
1311
+ if bun_path is None:
1312
+ return
1313
+
1314
+ if not path_ops.samefile(bun_path, constants.Bun.DEFAULT_PATH):
1297
1315
  console.info(f"Using custom Bun path: {bun_path}")
1298
1316
  bun_version = get_bun_version()
1299
- if not bun_version:
1317
+ if bun_version is None:
1300
1318
  console.error(
1301
1319
  "Failed to obtain bun version. Make sure the specified bun path in your config is correct."
1302
1320
  )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.3
2
2
  Name: reflex
3
- Version: 0.7.0a4
3
+ Version: 0.7.0a5
4
4
  Summary: Web apps in pure Python.
5
5
  License: Apache-2.0
6
6
  Keywords: web,framework
@@ -40,7 +40,7 @@ reflex/__init__.py,sha256=vaj8MEv0GwrvMzAYQeayyMvRE4TuAD1Xx3pDpjiY3sA,10289
40
40
  reflex/__init__.pyi,sha256=fOSkQZ2RHNzoLXqoVy-2gC5ys45Erxia1yPp34UFk_k,11235
41
41
  reflex/__main__.py,sha256=6cVrGEyT3j3tEvlEVUatpaYfbB5EF3UVY-6vc_Z7-hw,108
42
42
  reflex/admin.py,sha256=_3pkkauMiTGJJ0kwAEBnsUWAgZZ_1WNnCaaObbhpmUI,374
43
- reflex/app.py,sha256=ANWHGuxJs2_QAOgW63_7NDo8fNlcL8AUPss3CiVJSYM,62300
43
+ reflex/app.py,sha256=Te36db1j3ocy03e1OC6De1h60vDqfHZh_wxLLFn68wk,62319
44
44
  reflex/app_mixins/__init__.py,sha256=Oegz3-gZLP9p2OAN5ALNbsgxuNQfS6lGZgQA8cc-9mQ,137
45
45
  reflex/app_mixins/lifespan.py,sha256=Xs5KiidoyO921oaBuEg7zaR8B1_SPYDZLouel6u9PRo,3298
46
46
  reflex/app_mixins/middleware.py,sha256=lB8I67SEbqcJhp3aqMLZFIZekCYKeMby-Ph2sedIYJI,3349
@@ -97,7 +97,7 @@ reflex/components/core/html.pyi,sha256=Gh5bJ3x88302rvIysfsrPb-Rc4tLmlqaDpoJYa0g4
97
97
  reflex/components/core/layout/__init__.py,sha256=znldZaj_NGt8qCZDG70GMwjMTskcvCf_2N_EjCAHwdc,30
98
98
  reflex/components/core/match.py,sha256=Dp_kAwkJwT8TvBiaLK-OwQyGl24sian8k_o7bK-P-54,9281
99
99
  reflex/components/core/responsive.py,sha256=ACZdtJ4a4F8B3dm1k8h6J2_UJx0Z5LDB7XHQ2ty4wAc,1911
100
- reflex/components/core/sticky.py,sha256=F5IFacgyadaOz4WoO6SxzdPuCWZKYb_1Qvcw6qcq0Dw,4932
100
+ reflex/components/core/sticky.py,sha256=2B3TxrwG2Rtp_lv1VkMOIF2bqSiT7qYGbqbiZiMKxKY,3856
101
101
  reflex/components/core/sticky.pyi,sha256=x2ruBp6OhVR68npFhbdtw9saH3oo6To2JvG7y8jLTY4,18947
102
102
  reflex/components/core/upload.py,sha256=0cq0HGpSsrL1mbvG1GtUCcZUnv6QJwZH1CnexnU8Jhw,11948
103
103
  reflex/components/core/upload.pyi,sha256=llY-VTV6qrbcN9csj2UAfEv_uHo3am_NJaXc9k--E1Q,15011
@@ -360,7 +360,7 @@ reflex/middleware/hydrate_middleware.py,sha256=QJBEZI-4Jtn3345WgZDQ-twIbJzfiHKvU
360
360
  reflex/middleware/middleware.py,sha256=9eASK3MrbK1AvT2Sx5GFxXNwSuNW8_LTRGvPY1JccU4,1171
361
361
  reflex/model.py,sha256=yOLkxNOgi3GY9mT2E-6rkK-uLv8Av-kYSJ7I19y9JzE,17559
362
362
  reflex/page.py,sha256=lbI5Sd4RzZadPV6cYBSNRDIlNlRwEnOv1snF2RGKH04,2392
363
- reflex/reflex.py,sha256=YZrdis1e2ubQoyZBhcAbSJePxgL4UZ1h4uzIQM6qKBE,19716
363
+ reflex/reflex.py,sha256=FBQYdPaONW3IhYBmNJ-3Etqf9tIV3x_qAwZ8qnvHJZo,19962
364
364
  reflex/route.py,sha256=nn_hJwtQdjiqH_dHXfqMGWKllnyPQZTSR-KWdHDhoOs,4210
365
365
  reflex/state.py,sha256=W6JeXxj9p5EgtpSAbnpOqTH0liOVZykzt6Nu8A10Nvw,139638
366
366
  reflex/style.py,sha256=LXQjo6YhmdqUA59dV9OUxWuScyuYEqnE0rbWYkZ_ogI,13277
@@ -377,8 +377,8 @@ reflex/utils/format.py,sha256=j56pM45c_-nq8Fnw8Q1z20Y0wFJ32fPpCPFLgH_xCQM,19876
377
377
  reflex/utils/imports.py,sha256=8lTJ8qCJlMUlQnZssOv0l2nntuTfGfLsLqkJAS5JTbA,3974
378
378
  reflex/utils/lazy_loader.py,sha256=-3DcwIqHNft2fb1ikgDYAMiEwNfbiWfrTBAf1gEVX2o,1367
379
379
  reflex/utils/net.py,sha256=0Yd9OLK8R_px2sqnqrDkTky6hYHtG2pEDvvilOjDfjc,1219
380
- reflex/utils/path_ops.py,sha256=2RBdkMmH4LKvdP0y1lTrQNqk6yw8ZHdcU7bu4N_gjVI,7135
381
- reflex/utils/prerequisites.py,sha256=19rcXlTUBhqVnYIFVnYcwgRQTie6_5lFyAU9OHVeQSA,65652
380
+ reflex/utils/path_ops.py,sha256=FjVAkILH1mN2tPeoWPNN7NTVD11DiXF4RaPGEUUNlMA,7504
381
+ reflex/utils/prerequisites.py,sha256=EWWnjJQQUBpJzBLeNj-ZQvQbQqveEVOCoQHlW-fvRqQ,66102
382
382
  reflex/utils/processes.py,sha256=h_vXmQdInVCaCQ1cGgIQd4x5CbzYRSFy6n1U4iWkMy8,13729
383
383
  reflex/utils/pyi_generator.py,sha256=6BVJ1KrLH8WvfYjBVm5-zjI6-Zdhzngp5ubkixsCIl4,41240
384
384
  reflex/utils/redir.py,sha256=bmQGAgoNWwySeLRQTpoMpmKInwIOCW77wkXT61fwcj8,1868
@@ -394,8 +394,8 @@ reflex/vars/function.py,sha256=v2W5JHgCK9Afu2mobFeoj03G6tbih1Y-wM7LQBwA9vU,14777
394
394
  reflex/vars/number.py,sha256=rVybcAoMOOFsWAbA_BZN3GVx9p4W_YPLHVYRCJqti04,27861
395
395
  reflex/vars/object.py,sha256=jfvxtrklztDtbD2zgNVNCZZE6X6HQMB6yJHPhtb0hUo,15033
396
396
  reflex/vars/sequence.py,sha256=GiSXbOIcoy7VSrecuBjbhg5G4QTjFV0Rcfn5T0EsecA,52032
397
- reflex-0.7.0a4.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
398
- reflex-0.7.0a4.dist-info/METADATA,sha256=fih2rIyNIUOKlUu7n5bmWVhNYzArcwYarcMtJ6wzFAI,12073
399
- reflex-0.7.0a4.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
400
- reflex-0.7.0a4.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
401
- reflex-0.7.0a4.dist-info/RECORD,,
397
+ reflex-0.7.0a5.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
398
+ reflex-0.7.0a5.dist-info/METADATA,sha256=Ug_nreTx9SHaLFb00XprWr03Lyn8fU_5TO6EGdtYIrk,12073
399
+ reflex-0.7.0a5.dist-info/WHEEL,sha256=IYZQI976HJqqOpQU6PHkJ8fb3tMNBFjg-Cn-pwAbaFM,88
400
+ reflex-0.7.0a5.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
401
+ reflex-0.7.0a5.dist-info/RECORD,,