WatchReloader
faststream.cli.supervisors.watchfiles.WatchReloader #
WatchReloader(target: DecoratedCallable, args: Tuple[Any, ...], reload_dirs: Sequence[Union[Path, str]], reload_delay: float = 0.3, extra_extensions: Sequence[str] = ())
Bases: BaseReload
A class to reload a target function when files in specified directories change.
Initialize a WatchFilesReloader object.
PARAMETER | DESCRIPTION |
---|---|
target | the function to be reloaded
|
args | arguments to be passed to the target function
|
reload_dirs | directories to watch for file changes
|
reload_delay | delay in seconds between each check for file changes DEFAULT: |
extra_extensions | A sequence of extra extensions to include. |
RETURNS | DESCRIPTION |
---|---|
None | None. |
Source code in faststream/cli/supervisors/watchfiles.py
watcher instance-attribute
#
watcher = watch(*reload_dirs, step=int(reload_delay * 1000), watch_filter=ExtendedFilter(extra_extensions=extra_extensions), stop_event=should_exit, yield_on_timeout=True)
restart #
run #
should_restart #
should_restart() -> bool