autoreload
Monitors Python source files and automatically reloads modules when changes are detected. Useful during development to avoid manual server restarts.
Configuration parameters
smisk.autoreload.enabledIf
Truewhen callingsmisk.util.main.Main.run(), anAutoreloadermonitor is started automatically.smisk.autoreload.matchA regular expression string used to filter which files are watched. Defaults to watching all
.pyfiles.
Classes
- class
smisk.autoreload.Autoreloader(smisk.util.threads.Monitor) -
A monitor thread that watches for file modifications and triggers reloads. Subclass of
smisk.util.threads.Monitor.On each tick, the autoreloader:
- Calls
smisk.config.Configuration.reload()onsmisk.config.config - Checks all loaded modules for source file modifications
- Triggers a process restart if changes are detected
__init__(frequency=1, match=None)-
Parameters frequency (int) — check interval in seconds
match (str) — optional regex to filter watched files run()Main monitoring loop. Called by the thread framework.
setup()Initialises the watcher state before the main loop starts.
start()Starts the background monitoring thread.
- Calls