Interactive Commands¶
Control Pyreload while it's running using interactive keyboard commands.
Available Commands¶
While Pyreload is monitoring your application, press:
r- Manually restart your applicationq- Quit Pyreloadh- Show help with available commandsc- Clear the console output
Usage Examples¶
Manual Restart¶
Press r to force a restart without waiting for file changes:
[pyreload] watching: src/**/*.py
[pyreload] starting: python app.py
Application started on port 8000
r <-- Press 'r'
[pyreload] restarting due to manual trigger
[pyreload] stopping: python app.py
[pyreload] starting: python app.py
Application started on port 8000
Clean Exit¶
Press q to stop both Pyreload and your application:
[pyreload] watching: src/**/*.py
[pyreload] starting: python app.py
Application started on port 8000
q <-- Press 'q'
[pyreload] received quit signal
[pyreload] stopping: python app.py
[pyreload] exiting
Clear Screen¶
Press c to clear console output:
[pyreload] watching: src/**/*.py
[lots of output...]
c <-- Press 'c'
[screen cleared]
[pyreload] watching: src/**/*.py
Non-Interactive Mode¶
To disable interactive commands (useful in CI/CD or containers):
Signal Handling¶
Pyreload responds to system signals:
SIGINT (Ctrl+C)¶
Gracefully stops the application and exits:
SIGTERM¶
Gracefully stops the application and exits (sent by system shutdown):
SIGHUP¶
Restarts the application without exiting Pyreload:
Programmatic Control¶
Using Process Signals¶
Send signals to control Pyreload programmatically:
# Find Pyreload process
ps aux | grep pyreload
# Send restart signal
kill -HUP <pid>
# Send stop signal
kill -TERM <pid>
Example Script¶
#!/bin/bash
# restart-app.sh
PYRELOAD_PID=$(pgrep -f "pyreload app.py")
if [ -n "$PYRELOAD_PID" ]; then
kill -HUP $PYRELOAD_PID
echo "Sent restart signal to Pyreload (PID: $PYRELOAD_PID)"
else
echo "Pyreload is not running"
fi
Best Practices¶
- Use
rfor testing: Quickly test changes without modifying files - Use
qfor clean shutdown: Ensures proper cleanup - Use
cfor readability: Clear cluttered output during development - Disable interactive in CI: Use
--no-interactivein automated environments
Troubleshooting¶
Commands Not Responding¶
If interactive commands don't work:
-
Check if stdin is available:
-
Ensure terminal is in interactive mode:
-
Use verbose mode to debug:
Signal Not Received¶
If signals don't work:
-
Verify Pyreload is running:
-
Check process permissions:
-
Use correct signal names: