Răsfoiți Sursa

add a small guardrail in pyi_generator (#4885)

Thomas Brandého 2 luni în urmă
părinte
comite
fdfad3ad45
2 a modificat fișierele cu 4 adăugiri și 3 ștergeri
  1. 1 1
      reflex/config.py
  2. 3 2
      reflex/utils/pyi_generator.py

+ 1 - 1
reflex/config.py

@@ -857,7 +857,7 @@ class Config(Base):
     # Whether the app is running in the reflex cloud environment.
     is_reflex_cloud: bool = False
 
-    # Extra overlay function to run after the app is built. Formatted such that `from path_0.path_1... import path[-1]`, and calling it with no arguments would work. For example, "reflex.components.moment.momnet".
+    # Extra overlay function to run after the app is built. Formatted such that `from path_0.path_1... import path[-1]`, and calling it with no arguments would work. For example, "reflex.components.moment.moment".
     extra_overlay_function: str | None = None
 
     def __init__(self, *args, **kwargs):

+ 3 - 2
reflex/utils/pyi_generator.py

@@ -1193,8 +1193,9 @@ class PyiGenerator:
             self._scan_files_multiprocess(file_targets)
 
         # Fix generated pyi files with ruff.
-        subprocess.run(["ruff", "format", *self.written_files])
-        subprocess.run(["ruff", "check", "--fix", *self.written_files])
+        if self.written_files:
+            subprocess.run(["ruff", "format", *self.written_files])
+            subprocess.run(["ruff", "check", "--fix", *self.written_files])
 
         # For some reason, we need to format the __init__.pyi files again after fixing...
         init_files = [f for f in self.written_files if "/__init__.pyi" in f]