reflex 0.4.8a1__py3-none-any.whl → 0.4.8.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.

@@ -112,6 +112,7 @@ class PackageJson(SimpleNamespace):
112
112
  "next-themes": "0.2.1",
113
113
  "react": "18.2.0",
114
114
  "react-dom": "18.2.0",
115
+ "react-focus-lock": "2.11.3",
115
116
  "socket.io-client": "4.6.1",
116
117
  "universal-cookie": "4.0.4",
117
118
  }
@@ -568,15 +568,17 @@ def update_next_config(export=False, transpile_packages: Optional[List[str]] = N
568
568
  export: if the method run during reflex export.
569
569
  transpile_packages: list of packages to transpile via next.config.js.
570
570
  """
571
- next_config_file = os.path.join(constants.Dirs.WEB, constants.Next.CONFIG_FILE)
571
+ next_config_file = Path(constants.Dirs.WEB, constants.Next.CONFIG_FILE)
572
572
 
573
573
  next_config = _update_next_config(
574
574
  get_config(), export=export, transpile_packages=transpile_packages
575
575
  )
576
576
 
577
- with open(next_config_file, "w") as file:
578
- file.write(next_config)
579
- file.write("\n")
577
+ # Overwriting the next.config.js triggers a full server reload, so make sure
578
+ # there is actually a diff.
579
+ orig_next_config = next_config_file.read_text() if next_config_file.exists() else ""
580
+ if orig_next_config != next_config:
581
+ next_config_file.write_text(next_config)
580
582
 
581
583
 
582
584
  def _update_next_config(
reflex/utils/processes.py CHANGED
@@ -202,13 +202,19 @@ def run_concurrently(*fns: Union[Callable, Tuple]) -> None:
202
202
  pass
203
203
 
204
204
 
205
- def stream_logs(message: str, process: subprocess.Popen, progress=None):
205
+ def stream_logs(
206
+ message: str,
207
+ process: subprocess.Popen,
208
+ progress=None,
209
+ suppress_errors: bool = False,
210
+ ):
206
211
  """Stream the logs for a process.
207
212
 
208
213
  Args:
209
214
  message: The message to display.
210
215
  process: The process.
211
216
  progress: The ongoing progress bar if one is being used.
217
+ suppress_errors: If True, do not exit if errors are encountered (for fallback).
212
218
 
213
219
  Yields:
214
220
  The lines of the process output.
@@ -232,7 +238,7 @@ def stream_logs(message: str, process: subprocess.Popen, progress=None):
232
238
  # Windows uvicorn bug
233
239
  # https://github.com/reflex-dev/reflex/issues/2335
234
240
  accepted_return_codes = [0, -2, 15] if constants.IS_WINDOWS else [0, -2]
235
- if process.returncode not in accepted_return_codes:
241
+ if process.returncode not in accepted_return_codes and not suppress_errors:
236
242
  console.error(f"{message} failed with exit code {process.returncode}")
237
243
  for line in logs:
238
244
  console.error(line, end="")
@@ -251,15 +257,16 @@ def show_logs(message: str, process: subprocess.Popen):
251
257
  pass
252
258
 
253
259
 
254
- def show_status(message: str, process: subprocess.Popen):
260
+ def show_status(message: str, process: subprocess.Popen, suppress_errors: bool = False):
255
261
  """Show the status of a process.
256
262
 
257
263
  Args:
258
264
  message: The initial message to display.
259
265
  process: The process.
266
+ suppress_errors: If True, do not exit if errors are encountered (for fallback).
260
267
  """
261
268
  with console.status(message) as status:
262
- for line in stream_logs(message, process):
269
+ for line in stream_logs(message, process, suppress_errors=suppress_errors):
263
270
  status.update(f"{message} {line}")
264
271
 
265
272
 
@@ -298,29 +305,22 @@ def run_process_with_fallback(args, *, show_status_message, fallback=None, **kwa
298
305
  fallback: The fallback command to run.
299
306
  kwargs: Kwargs to pass to new_process function.
300
307
  """
301
-
302
- def execute_process(process):
303
- if not constants.IS_WINDOWS:
304
- show_status(show_status_message, process)
305
- else:
306
- process.wait()
307
- if process.returncode != 0:
308
- error_output = process.stderr if process.stderr else process.stdout
309
- error_message = f"Error occurred during subprocess execution: {' '.join(args)}\n{error_output.read() if error_output else ''}"
310
- # Only show error in debug mode.
311
- if console.is_debug():
312
- console.error(error_message)
313
-
314
- # retry with fallback command.
315
- fallback_args = [fallback, *args[1:]] if fallback else None
316
- console.warn(
317
- f"There was an error running command: {args}. Falling back to: {fallback_args}."
318
- )
319
- if fallback_args:
320
- process = new_process(fallback_args, **kwargs)
321
- execute_process(process)
322
- else:
323
- show_status(show_status_message, process)
324
-
325
308
  process = new_process(args, **kwargs)
326
- execute_process(process)
309
+ if fallback is None:
310
+ # No fallback given, or this _is_ the fallback command.
311
+ show_status(show_status_message, process)
312
+ else:
313
+ # Suppress errors for initial command, because we will try to fallback
314
+ show_status(show_status_message, process, suppress_errors=True)
315
+ if process.returncode != 0:
316
+ # retry with fallback command.
317
+ fallback_args = [fallback, *args[1:]]
318
+ console.warn(
319
+ f"There was an error running command: {args}. Falling back to: {fallback_args}."
320
+ )
321
+ run_process_with_fallback(
322
+ fallback_args,
323
+ show_status_message=show_status_message,
324
+ fallback=None,
325
+ **kwargs,
326
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reflex
3
- Version: 0.4.8a1
3
+ Version: 0.4.8.post1
4
4
  Summary: Web apps in pure Python.
5
5
  Home-page: https://reflex.dev
6
6
  License: Apache-2.0
@@ -466,7 +466,7 @@ reflex/constants/compiler.py,sha256=uWTC28IpBlJzh-BnO05xoiCwYQsGeXJJ3RG6UB1xZQo,
466
466
  reflex/constants/config.py,sha256=7uUypVy-ezLt3UN3jXEX1XvL3sKaCLBwnJCyYjg9erI,1331
467
467
  reflex/constants/custom_components.py,sha256=SX0SQVb-d6HJkZdezFL4UgkumyF6eJF682y4OvRUqUM,1268
468
468
  reflex/constants/event.py,sha256=7cEUTWdIhWVw7g5Bn9yTZlxNnJY5MeJL55q-vT1YOZ0,2668
469
- reflex/constants/installer.py,sha256=p0-9b57dyt1MR2fddnS2pbXYtUpRNhvGmuA0oyOHT_8,3223
469
+ reflex/constants/installer.py,sha256=4ztmgMYNUYDEEwPHu_GNTlcMoAEuJ1C4waFuhwA83rY,3261
470
470
  reflex/constants/route.py,sha256=9ydQEdlz3YwGmGMHVGz7zA-INoOLtz_xUU2S-WmhZZM,1940
471
471
  reflex/constants/style.py,sha256=gSzu0sQEQjW81PekxJnwRs7SXQQVco-LxtVjCi0IQZc,636
472
472
  reflex/custom_components/__init__.py,sha256=R4zsvOi4dfPmHc18KEphohXnQFBPnUCb50cMR5hSLDE,36
@@ -495,8 +495,8 @@ reflex/utils/export.py,sha256=UJd4BYFW9_eexhLCP4C5Ri8Cq2tWAPNVspq70lPLCyo,2270
495
495
  reflex/utils/format.py,sha256=4vY7NP-f7B2euJ5F5dM3yh5SYPzCY3bVZDATG2DMaMU,22648
496
496
  reflex/utils/imports.py,sha256=IRnSLA_LI0ougGpOT_smwVPDpfoPcC7t_tY4mnuhj6k,2277
497
497
  reflex/utils/path_ops.py,sha256=Vy6fU_bXvOcCvbXdTSmeLwy_C4h9seYU-3yIrVdZEZQ,4737
498
- reflex/utils/prerequisites.py,sha256=ERmHwkvnnnbe1igdx9zCTa1ppNuVyv9nOK7PMMLmhFc,46993
499
- reflex/utils/processes.py,sha256=Nzn0ihAhWySRxNC9kegOOSIWGinS6ar3YzgFLauV20k,10050
498
+ reflex/utils/prerequisites.py,sha256=vMn1NnoDR-Xc8AsK1YM2f1gqxH_i8PxwfFp7r82sVkw,47173
499
+ reflex/utils/processes.py,sha256=GHkDmGjRHz6xIC4KbNM6GIRzf5jfI60NbOGGV4KQwAI,10032
500
500
  reflex/utils/pyi_generator.py,sha256=VyGG0Tj3nvyBi2OQU-oscWRhJyRiYG9rUvJolKLK5Gg,27674
501
501
  reflex/utils/serializers.py,sha256=vHLJx2Dj7bcXiKp6lHkOrov1e7AbQtdT8piZq8Erh4M,8771
502
502
  reflex/utils/telemetry.py,sha256=NYAzPe7nU0EUwq2hIAByOzlie_5RhFlfHganBqG5OfA,4013
@@ -504,8 +504,8 @@ reflex/utils/types.py,sha256=QtsWi7ACjwHLfc7Wy72YU85bGUS3J-P_XlltYUAfnPk,13679
504
504
  reflex/utils/watch.py,sha256=HzGrHQIZ_62Di0BO46kd2AZktNA3A6nFIBuf8c6ip30,2609
505
505
  reflex/vars.py,sha256=mef13GC4G_Iqicliyp6k9EWGULC1p1UewgM7gJODcBw,67152
506
506
  reflex/vars.pyi,sha256=7sVCLoLg9Y7QAmXWz6FCtVmScpSV84u0yQ3ZBImb_Bk,5583
507
- reflex-0.4.8a1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
508
- reflex-0.4.8a1.dist-info/METADATA,sha256=ROLpFBI9mZT-ACH7tsY-4AkXlm8BFaZOddiqGX22nUk,11764
509
- reflex-0.4.8a1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
510
- reflex-0.4.8a1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
511
- reflex-0.4.8a1.dist-info/RECORD,,
507
+ reflex-0.4.8.post1.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
508
+ reflex-0.4.8.post1.dist-info/METADATA,sha256=3uTcZhpW4c4lQ_y2BpiKSjskc3xBnHBkRO5OXSme9ik,11768
509
+ reflex-0.4.8.post1.dist-info/WHEEL,sha256=Zb28QaM1gQi8f4VCBhsUklF61CTlNYfs9YAZn-TOGFk,88
510
+ reflex-0.4.8.post1.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
511
+ reflex-0.4.8.post1.dist-info/RECORD,,