returnn.util.hot_reload

Hot reloading

returnn.util.hot_reload.should_use_hot_reloading(*, config: Config | None = None) bool[source]

Check if hot reloading should be used.

class returnn.util.hot_reload.ConfigHotReloader(config: Dict[str, Any])[source]

A class that can hot reload the values in a config.

property modules: List[str][source]

Get the list of modules that are relevant for hot reloading.

any_module_changed() bool[source]

Check if any of the modules have changed.

reload_changed_modules()[source]

Reload any changed modules and update the config.

user_interaction(*, return_actions: Dict[str, str] | None = None, shell_locals: Dict[str, Any] | None = None, shell_globals: Dict[str, Any] | None = None) str[source]

Interact with the user, allowing to reload modules, try again, debug, or quit.

returnn.util.hot_reload.hot_reload_config(config: Dict[str, Any])[source]

Hot reload the values in the config, i.e. if the value references a class or function, it will be reloaded from the source code.