@@ -1152,11 +1152,12 @@ def _validate_var_dependencies(self, state: type[BaseState] | None = None) -> No
11521152 for substate in state .class_subclasses :
11531153 self ._validate_var_dependencies (substate )
11541154
1155- def _compile (self , export : bool = False ):
1155+ def _compile (self , export : bool = False , dry_run : bool = False ):
11561156 """Compile the app and output it to the pages folder.
11571157
11581158 Args:
11591159 export: Whether to compile the app for export.
1160+ dry_run: Whether to compile the app without saving it.
11601161
11611162 Raises:
11621163 ReflexRuntimeError: When any page uses state, but no rx.State subclass is defined.
@@ -1170,7 +1171,7 @@ def get_compilation_time() -> str:
11701171
11711172 should_compile = self ._should_compile ()
11721173 backend_dir = prerequisites .get_backend_dir ()
1173- if not should_compile and backend_dir .exists ():
1174+ if not dry_run and not should_compile and backend_dir .exists ():
11741175 stateful_pages_marker = backend_dir / constants .Dirs .STATEFUL_PAGES
11751176 if stateful_pages_marker .exists ():
11761177 with stateful_pages_marker .open ("r" ) as f :
@@ -1205,7 +1206,7 @@ def get_compilation_time() -> str:
12051206 if config .react_strict_mode :
12061207 app_wrappers [(200 , "StrictMode" )] = StrictMode .create ()
12071208
1208- if not should_compile :
1209+ if not should_compile and not dry_run :
12091210 with console .timing ("Evaluate Pages (Backend)" ):
12101211 for route in self ._unevaluated_pages :
12111212 console .debug (f"Evaluating page: { route } " )
@@ -1358,7 +1359,7 @@ def memoized_toast_provider():
13581359
13591360 # Copy the assets.
13601361 assets_src = Path .cwd () / constants .Dirs .APP_ASSETS
1361- if assets_src .is_dir ():
1362+ if assets_src .is_dir () and not dry_run :
13621363 with console .timing ("Copy assets" ):
13631364 path_ops .update_directory_tree (
13641365 src = assets_src ,
@@ -1444,6 +1445,9 @@ def _submit_work(fn: Callable[..., tuple[str, str]], *args, **kwargs):
14441445 progress .advance (task )
14451446 progress .stop ()
14461447
1448+ if dry_run :
1449+ return
1450+
14471451 # Install frontend packages.
14481452 with console .timing ("Install Frontend Packages" ):
14491453 self ._get_frontend_packages (all_imports )
0 commit comments