Skip to content

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

Closed

Description

@rpkyle

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

Activity

  1. self-assigned this
    on Sep 3, 2019
  2. rpkyle commented on Sep 5, 2019

    @rpkyle
    ContributorAuthor

    @Stalkcomrade

  3. rpkyle commented on Sep 13, 2019

    @rpkyle
    ContributorAuthor

    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)
  4. rpkyle commented on Nov 1, 2019

    @rpkyle
    ContributorAuthor

    @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! 🙂

  5. firasm commented on Dec 3, 2019

    @firasm

    Thanks @rpkyle, just to confirm is it

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

    to get the dev version right?

  6. rpkyle commented on Dec 5, 2019

    @rpkyle
    ContributorAuthor

    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 🙂

  7. rpkyle commented on Jan 7, 2020

    @rpkyle
    ContributorAuthor

    🌶 reloading is now available in master, closing issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions