@@ -90,6 +90,8 @@ def _load_user_app(app_target: str) -> types.ModuleType:
9090 raise ImportError (f"Could not create spec for file: { app_path } " )
9191 module = importlib .util .module_from_spec (spec )
9292 sys .modules [spec .name ] = module
93+ if spec .loader is None :
94+ raise ImportError (f"Could not create loader for file: { app_path } " )
9395 spec .loader .exec_module (module )
9496 return module
9597 except (ImportError , FileNotFoundError , PermissionError ) as e :
@@ -145,20 +147,21 @@ def ls(app_target: str | None):
145147 If APP_TARGET is omitted, lists all flows that have a persisted
146148 setup in the backend.
147149 """
150+ persisted_flow_names = flow_names_with_setup ()
148151 if app_target :
149152 app_ref = _get_app_ref_from_specifier (app_target )
150153 _load_user_app (app_ref )
151154
152155 current_flow_names = set (flow .flow_names ())
153- persisted_flow_names = set (flow_names_with_setup ())
154156
155157 if not current_flow_names :
156158 click .echo (f"No flows are defined in '{ app_ref } '." )
157159 return
158160
159161 has_missing = False
162+ persisted_flow_names_set = set (persisted_flow_names )
160163 for name in sorted (current_flow_names ):
161- if name in persisted_flow_names :
164+ if name in persisted_flow_names_set :
162165 click .echo (name )
163166 else :
164167 click .echo (f"{ name } [+]" )
@@ -170,13 +173,11 @@ def ls(app_target: str | None):
170173 click .echo (' [+]: Flows present in the current process, but missing setup.' )
171174
172175 else :
173- persisted_flow_names = sorted (flow_names_with_setup ())
174-
175176 if not persisted_flow_names :
176177 click .echo ("No persisted flow setups found in the backend." )
177178 return
178179
179- for name in persisted_flow_names :
180+ for name in sorted ( persisted_flow_names ) :
180181 click .echo (name )
181182
182183@cli .command ()
0 commit comments