How to extend hot-reload to yaml/json configuration files changes? #4603
-
First Check
Example Codefrom nicegui import ui
from omegaconf import OmegaConf
# cfg.yaml
# label: hello
cfg = OmegaConf.load("cfg.yaml")
ui.label(f"{cfg.label}")
ui.run() DescriptionIs there already a "nice" way to auto reload when the config file changes? NiceGUI Version2.14.0 Python Version3.13.2 BrowserChrome Operating SystemLinux Additional ContextNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
Hi @vanem, You can use |
Beta Was this translation helpful? Give feedback.
-
You can also use a startup task and monitor the file for change, and reload the This can avoid reloading NiceGUI, which isn't exactly fast. But, your code needs to fetch the latest |
Beta Was this translation helpful? Give feedback.
Hi @vanem,
You can use
ui.run(uvicorn_reload_includes='*.py, *.yaml')
to specify a comma-separated list of glob-patterns for the hot-reload.See https://nicegui.io/documentation/run#ui_run and https://www.uvicorn.org/settings/#reloading-with-watchfiles for more information.