S
smisk

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.enabled

If True when calling smisk.util.main.Main.run(), an Autoreloader monitor is started automatically.

smisk.autoreload.match

A regular expression string used to filter which files are watched. Defaults to watching all .py files.

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:

__init__(frequency=1, match=None)
Parametersfrequency (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.