@@ -141,7 +141,7 @@ def _find_pids_on_port(port):
141141def stop_servers ():
142142 """Stop all running servers"""
143143 print ("🛑 Stopping servers..." )
144- backend_pids = find_pids_by_pattern ("pyrit.cli .pyrit_backend" )
144+ backend_pids = find_pids_by_pattern ("pyrit.backend .pyrit_backend" )
145145 frontend_pids = find_pids_by_pattern ("node.*vite" )
146146 # Also find any parent dev.py processes (detached wrappers)
147147 wrapper_pids = find_pids_by_pattern ("frontend/dev.py" )
@@ -163,6 +163,10 @@ def start_backend(*, config_file: str | None = None, initializers: list[str] | N
163163 Configuration (initializers, database, env files) is read automatically
164164 from ~/.pyrit/.pyrit_conf by the pyrit_backend CLI via ConfigurationLoader,
165165 unless overridden with *config_file*.
166+
167+ When *initializers* is supplied without a *config_file*, a tiny temporary
168+ runtime config is written to forward those names — ``pyrit_backend`` only
169+ accepts ``--config-file`` now (no ``--initializers`` flag).
166170 """
167171 print ("🚀 Starting backend on port 8000..." )
168172
@@ -178,20 +182,30 @@ def start_backend(*, config_file: str | None = None, initializers: list[str] | N
178182 cmd = [
179183 sys .executable ,
180184 "-m" ,
181- "pyrit.cli .pyrit_backend" ,
185+ "pyrit.backend .pyrit_backend" ,
182186 "--host" ,
183187 "localhost" ,
184188 "--port" ,
185189 "8000" ,
186190 "--log-level" ,
187191 "info" ,
188192 ]
189- if config_file :
190- cmd .extend (["--config-file" , config_file ])
191193
192- # Add initializers if specified
193- if initializers :
194- cmd .extend (["--initializers" ] + initializers )
194+ # Resolve config-file: explicit wins; otherwise synthesize one from initializers.
195+ effective_config_file = config_file
196+ if effective_config_file is None and initializers :
197+ import tempfile
198+
199+ fd , synthesized_path = tempfile .mkstemp (suffix = ".yaml" , prefix = "pyrit_dev_" , text = True )
200+ with os .fdopen (fd , "w" ) as synthesized :
201+ synthesized .write ("initializers:\n " )
202+ for name in initializers :
203+ synthesized .write (f" - { name } \n " )
204+ effective_config_file = synthesized_path
205+ print (f" Wrote initializer overrides to { effective_config_file } " )
206+
207+ if effective_config_file :
208+ cmd .extend (["--config-file" , effective_config_file ])
195209
196210 # Pipe stdout/stderr so dev.py controls output ordering
197211 return subprocess .Popen (cmd , env = env , stdout = subprocess .PIPE , stderr = subprocess .STDOUT )
@@ -456,7 +470,7 @@ def main():
456470 elif command == "backend" :
457471 print ("🚀 Starting backend only..." )
458472 # Kill stale backend processes
459- stale = find_pids_by_pattern ("pyrit.cli .pyrit_backend" )
473+ stale = find_pids_by_pattern ("pyrit.backend .pyrit_backend" )
460474 if stale :
461475 print (f" Killing stale backend PIDs: { stale } " )
462476 kill_pids (stale )
0 commit comments