watch
Class info¶
š DocStrings¶
Regenerate the site input when project sources change.
iter_watched_files
¶
iter_watched_files(settings: GeneratorSettings) -> Iterable[Path]
Yield the source files whose changes should trigger a regeneration.
That is everything in the project with a relevant suffix (Python sources, README, pyproject / mkdocs.yml, hand-written docs and templates), except the site dir, the generated config and the folders the generator writes into.
Source code in mkdocs_mknodes/generator/watch.py
regenerate_in_subprocess
¶
Return a callable running mkdocs-mknodes generate <args> in a fresh interpreter.
A fresh process makes sure changed project modules (and the build function) get re-imported and no caches survive.
Source code in mkdocs_mknodes/generator/watch.py
snapshot
¶
snapshot(settings: GeneratorSettings) -> dict[Path, int]
Return path -> mtime for all watched files.
Source code in mkdocs_mknodes/generator/watch.py
watch
¶
watch(
settings: GeneratorSettings,
regenerate: Callable[[], object],
*,
interval: float = 1.0,
should_stop: Callable[[], bool] = lambda: False
) -> None
Poll the watched files and call regenerate after changes.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
settings
|
GeneratorSettings
|
Generator settings (determine which files are watched) |
required |
regenerate
|
Callable[[], object]
|
Callable doing the regeneration |
required |
interval
|
float
|
Poll interval in seconds |
1.0
|
should_stop
|
Callable[[], bool]
|
Callable returning True when watching should end |
lambda: False
|