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

@@ -568,17 +568,15 @@ 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 = Path(constants.Dirs.WEB, constants.Next.CONFIG_FILE)
571
+ next_config_file = os.path.join(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
- # 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)
577
+ with open(next_config_file, "w") as file:
578
+ file.write(next_config)
579
+ file.write("\n")
582
580
 
583
581
 
584
582
  def _update_next_config(
reflex/utils/processes.py CHANGED
@@ -202,19 +202,13 @@ def run_concurrently(*fns: Union[Callable, Tuple]) -> None:
202
202
  pass
203
203
 
204
204
 
205
- def stream_logs(
206
- message: str,
207
- process: subprocess.Popen,
208
- progress=None,
209
- suppress_errors: bool = False,
210
- ):
205
+ def stream_logs(message: str, process: subprocess.Popen, progress=None):
211
206
  """Stream the logs for a process.
212
207
 
213
208
  Args:
214
209
  message: The message to display.
215
210
  process: The process.
216
211
  progress: The ongoing progress bar if one is being used.
217
- suppress_errors: If True, do not exit if errors are encountered (for fallback).
218
212
 
219
213
  Yields:
220
214
  The lines of the process output.
@@ -238,7 +232,7 @@ def stream_logs(
238
232
  # Windows uvicorn bug
239
233
  # https://github.com/reflex-dev/reflex/issues/2335
240
234
  accepted_return_codes = [0, -2, 15] if constants.IS_WINDOWS else [0, -2]
241
- if process.returncode not in accepted_return_codes and not suppress_errors:
235
+ if process.returncode not in accepted_return_codes:
242
236
  console.error(f"{message} failed with exit code {process.returncode}")
243
237
  for line in logs:
244
238
  console.error(line, end="")
@@ -257,16 +251,15 @@ def show_logs(message: str, process: subprocess.Popen):
257
251
  pass
258
252
 
259
253
 
260
- def show_status(message: str, process: subprocess.Popen, suppress_errors: bool = False):
254
+ def show_status(message: str, process: subprocess.Popen):
261
255
  """Show the status of a process.
262
256
 
263
257
  Args:
264
258
  message: The initial message to display.
265
259
  process: The process.
266
- suppress_errors: If True, do not exit if errors are encountered (for fallback).
267
260
  """
268
261
  with console.status(message) as status:
269
- for line in stream_logs(message, process, suppress_errors=suppress_errors):
262
+ for line in stream_logs(message, process):
270
263
  status.update(f"{message} {line}")
271
264
 
272
265
 
@@ -305,22 +298,29 @@ def run_process_with_fallback(args, *, show_status_message, fallback=None, **kwa
305
298
  fallback: The fallback command to run.
306
299
  kwargs: Kwargs to pass to new_process function.
307
300
  """
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
+
308
325
  process = new_process(args, **kwargs)
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
- )
326
+ execute_process(process)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: reflex
3
- Version: 0.4.8
3
+ Version: 0.4.8a1
4
4
  Summary: Web apps in pure Python.
5
5
  Home-page: https://reflex.dev
6
6
  License: Apache-2.0
@@ -15,7 +15,6 @@ Classifier: Programming Language :: Python :: 3.8
15
15
  Classifier: Programming Language :: Python :: 3.9
16
16
  Classifier: Programming Language :: Python :: 3.10
17
17
  Classifier: Programming Language :: Python :: 3.11
18
- Classifier: Programming Language :: Python :: 3.12
19
18
  Requires-Dist: alembic (>=1.11.1,<2.0)
20
19
  Requires-Dist: build (>=1.0.3,<2.0)
21
20
  Requires-Dist: charset-normalizer (>=3.3.2,<4.0)
@@ -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=vMn1NnoDR-Xc8AsK1YM2f1gqxH_i8PxwfFp7r82sVkw,47173
499
- reflex/utils/processes.py,sha256=GHkDmGjRHz6xIC4KbNM6GIRzf5jfI60NbOGGV4KQwAI,10032
498
+ reflex/utils/prerequisites.py,sha256=ERmHwkvnnnbe1igdx9zCTa1ppNuVyv9nOK7PMMLmhFc,46993
499
+ reflex/utils/processes.py,sha256=Nzn0ihAhWySRxNC9kegOOSIWGinS6ar3YzgFLauV20k,10050
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.8.dist-info/LICENSE,sha256=dw3zLrp9f5ObD7kqS32vWfhcImfO52PMmRqvtxq_YEE,11358
508
- reflex-0.4.8.dist-info/METADATA,sha256=Y89LUexDTFEhY3UfKHUTq3i8penGRq_QPKhOgGIWfPM,11813
509
- reflex-0.4.8.dist-info/WHEEL,sha256=FMvqSimYX_P7y0a7UY-_Mc83r5zkBZsCYPm7Lr0Bsq4,88
510
- reflex-0.4.8.dist-info/entry_points.txt,sha256=H1Z5Yat_xJfy0dRT1Frk2PkO_p41Xy7fCKlj4FcdL9o,44
511
- reflex-0.4.8.dist-info/RECORD,,
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,,
@@ -1,4 +1,4 @@
1
1
  Wheel-Version: 1.0
2
- Generator: poetry-core 1.8.1
2
+ Generator: poetry-core 1.6.1
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any