Module h2o_wave.autoreload

Functions

add_reload_hook

def add_reload_hook(fn: Callable[[], NoneType]) ‑> NoneType

Add a function to be called before reloading the process.

Note that for open file and socket handles it is generally preferable to set the FD_CLOEXEC flag (using fcntl oros.set_inheritable) instead of using a reload hook to close them.

main

def main() ‑> NoneType

Command-line wrapper to re-run a script whenever its source changes.

Scripts may be specified by filename or module name::

python -m h2o_wave -m h2o_wave.test.runtests python -m h2o_wave h2o_wave/test/runtests.py

Running a script with this wrapper is similar to callingwait() at the end of the script, but this wrapper can catch import-time problems like syntax errors that would otherwise prevent the script from reaching its call to wait().

rerun

def rerun(code: Any, glob: Dict[str, Any], loc: Union[Mapping[str, Any], NoneType] = None) ‑> NoneType

start

def start(check_time: int = 500) ‑> NoneType

Begins watching source files for changes.

wait

def wait() ‑> NoneType

Wait for a watched file to change, then restart the process.

Intended to be used at the end of scripts like unit test runners, to run the tests again after any source file changes (but see also the command-line interface in main())

watch

def watch(filename: str) ‑> NoneType

Add a file to the watch list.

All imported modules are watched by default.