RatMinimal web framework

Hot reload

Save a file and the browser updates. The watcher sees every .rat, .css, .js, .py, image, font, and JSON file under the project; a 50ms debounce combines a burst of saves into one event; the SSE stream at /__rat__/events tells subscribers to reload.

What gets watched

Every project directory the loader reads

The watcher tracks every directory the site loader walks, plus the root configuration files. Editing any of these triggers a reload; editing files outside the tracked set (build artifacts, temp files, the .venv directory) is silently ignored.

pages/      pups/       api/        data/
styles/     public/     lang/
main.rat    settings.rat    settings.json

Python edits restart the Tail worker

Saving a .py file respawns the subprocess

A lang/python/*.py change is treated specially: the Tail worker for Python is closed and the registry entry cleared, so the next page render respawns it with the new imports. No rat start restart needed.

# before edit
# lang/python/ml.py
def predict(x): return x * 2

# save with a change:
def predict(x): return x * 3

# next request to a page that calls ml.predict()
# gets the new behaviour automatically

Opt out per build

settings.rat hot_reload flag

Hot reload is on by default in dev. To turn it off (for production builds, or a dev session you want to keep quiet), set hot_reload: false. Pair it with the [] mode flag so only the prod path is affected.

# settings.rat
> [@dev] server
hot_reload: true

> [@prod] server
hot_reload: false

See also Settings · CLI · Tail (Python)