You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After supporting pip install mesop (#41), one of the issues with running Mesop on pip is that it doesn't support hot reload. Right now, Mesop's hot reload mechanism relies on ibazel which injects the livereload script and sends a rebuild event.
Questions:
How do we trigger a rebuild? Whenever an app file changes. This isn't going to be as good as ibazel where there's a proper dependency graph. We will do a simple heuristic if any file within a directory or sub-directory of the main module is changed, then we will reload everything. This is the same heuristic used inside
Doesn't seem to be heavily relying on third-party python modules
Home-grown
Basically create a while loop which checks file modified time.
last_modified=os.path.getmtime(module_path)
whileTrue:
# Get the current modification timecurrent_modified=os.path.getmtime(module_path)
# Compare the current modification time with the last modification timeifcurrent_modified!=last_modified:
# Update the last modification timelast_modified=current_modifiedmodule=read_module(module_path)
ifmoduleisnotNone:
try:
runtime.set_module(module)
runtime.reload_all_sessions()
exceptExceptionase:
runtime.log(
pb.ServerLog(
message=f"Hot reload error: Module '{module_path}' has {e}.\n${traceback.format_exc()}",
level=pb.ServerLog.ERROR,
)
)
# Wait for 1 second before checking againawaitasyncio.sleep(1)
The text was updated successfully, but these errors were encountered:
After supporting
pip install mesop
(#41), one of the issues with running Mesop on pip is that it doesn't support hot reload. Right now, Mesop's hot reload mechanism relies on ibazel which injects the livereload script and sends a rebuild event.Questions:
mesop/mesop/cli/execute_module.py
Line 44 in 541dcd4
Tasks:
mesop run foo.py
Prior Art
Streamlit
Gradio
Home-grown
Basically create a while loop which checks file modified time.
The text was updated successfully, but these errors were encountered: