Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need to implement hot reloading support in Dash for R #125

Closed
rpkyle opened this issue Sep 3, 2019 · 6 comments
Closed

Need to implement hot reloading support in Dash for R #125

rpkyle opened this issue Sep 3, 2019 · 6 comments
Assignees
Labels
enhancement feature request Community request for a package enhancement

Comments

@rpkyle
Copy link
Contributor

rpkyle commented Sep 3, 2019

Dash for Python offers a lovely "hot-reloading" feature, as described in plotly/dash#66, plotly/dash#362, and plotly/dash-renderer#73. Supporting this as in the Python implementation would require

  • creating a hash at app initialization, and regenerating it on file change
  • adding a route to serve the hash
  • front-end hot reloading
  • back-end hot reloading (reload the app by restarting the fiery session)
  • adding parameters for the dev tools UI: dev_tools_hot_reload, dev_tools_hot_reload_interval, dev_tools_hot_reload_watch_interval, dev_tools_silence_routes_logging

On the Python side, we use the Flask debug reloader to reset the hash. fiery doesn't have native support for something like this feature, but it does allow "Custom Events" which can be manipulated to serve a similar purpose.

State-preserving hot reloading would be really nice to have, as noted in plotly/dash#460, but it has not been implemented in Dash for Python yet either.

@alexcjohnson

@rpkyle
Copy link
Contributor Author

rpkyle commented Sep 5, 2019

@Stalkcomrade

@rpkyle rpkyle added the feature request Community request for a package enhancement label Sep 5, 2019
@rpkyle
Copy link
Contributor Author

rpkyle commented Sep 13, 2019

Following discussions with @alexcjohnson, the PR to address this issue may be split into two parts:

  • Part I: basic support (ensure backend functionality is working)
  • Part II: full parity with Python implementation

Right now the following elements are working in some capacity:

  • tracking file changes
  • storing and generating the hash for the frontend
  • routing for the reload hash, and returning modified file list
  • cleaning up the logs using a custom logger so that _reload-hash chatter is omitted from logs and support for dev_tools_silence_routes_logging is possible
  • enabling restarts of the fiery server, for full reloading of the app (e.g. if app.R is modified, or non-CSS files are added)

@rpkyle
Copy link
Contributor Author

rpkyle commented Nov 1, 2019

@StalkComrade This feature is ready for use and available in the dev branch if you'd like to test it out before the next version of the package is released! 🙂

@firasm
Copy link

firasm commented Dec 3, 2019

Thanks @rpkyle, just to confirm is it

library(devtools)
install_github("plotly/DashR", branch = "dev")

to get the dev version right?

@rpkyle
Copy link
Contributor Author

rpkyle commented Dec 5, 2019

Thanks @rpkyle, just to confirm is it

library(devtools)
install_github("plotly/DashR", branch = "dev")

to get the dev version right?

Hi @firasm ! Apologies for not catching this question sooner, but yes, that's the right branch -- I'd suggest installing with the lines

library(devtools)
install_github("plotly/dashR", ref="dev")

The next release is imminent, and hopefully you'll be able to obtain the package from CRAN in the very near future. For now, ☝️ will do the trick 🙂

@rpkyle
Copy link
Contributor Author

rpkyle commented Jan 7, 2020

🌶 reloading is now available in master, closing issue.

@rpkyle rpkyle closed this as completed Jan 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement feature request Community request for a package enhancement
Projects
None yet
Development

No branches or pull requests

2 participants