-
Notifications
You must be signed in to change notification settings - Fork 129
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
Disabling autoload required with shiny 1.5.0 #468
Comments
You're completely right that this should be done when the user has shiny > 1.5.0 installed (just as the new version of the modules, #455). Would you draft a PR for this options disabling? Thanks |
@ColinFay, sure happy to draft a PR! |
Ok, so I think it's safe to assume that an R session / project will contain one golem app and there is very small chance that one would need to either use this option or not—as soon as you are in a golem app, this options should be turned off. So I suppose changing this option in |
@ColinFay, sorry for the long absence (hectic times over the last months)... I can finally get back to this pretty soon |
I still don't have a perfect answer for this one. The only sane way I was able to think of was creating a .Rprofile with each golem project, containing Basically the idea would be to do
With any project. Any opinion on that? |
I like the
Le me try to collect my current understanding of the issue in view of possible alternatives.
In other words, we indeed have these two alternatives:
We seem to have a good preference for (2). Since the issue is limited to the RSConnect or shinyapps.io, I guess this could be done by the corresponding One final consideration. As mentioned in the top comment, autoload does not make much sense for packages, in particular since the source files under |
I think your diagnosis is correct @riccardoporreca As I see it, that would probably make sense to have a .Rprofile in every For your other question (about ignoring if there is a NAMESPACE), I'm all in favor of asking. Wanna open an issue on the |
@ColinFay, about creating the .Rprofile for every I will open an issue in |
I think I'll go for a default I'll take care of implementing that, thank you @riccardoporreca for your help! |
Close via #574 Thanks again @riccardoporreca for all your help on that. |
We will still source the global RProfile if it exists
I'd strongly discourage using a project |
Hey @hadley, Thanks for the feedback. The way I went was to set the .Rprofile as :
Allowing the user .Rprofile to be sourced too :) |
We have gone down this path in the past and have never managed to get 100% correct behaviour in all cases. I’d not recommend it. |
Yeah I don't fully enjoy it either, but the Any other idea to make this work smoothly? I suppose we could have this file added only when creating the deployment for RStudio products (this issue seems to arise only in that case : as long as we keep the package load and launch system, it will work. |
Ok after giving it some thoughts and an internal discussion with @VincentGuyader, I've switched to adding a function called This function is called whenever an RStudio deployment file is created. |
* Via `golem::add_shinyappsio_file()`, see <ThinkR-open/golem#468 (comment)>. shinyapps.io log: ``` Warning in loadSupport(appDir, renv = sharedEnv, globalrenv = NULL) : Loading R/ subdirectory for Shiny application, but this directory appears to contain an R package. Sourcing files in R/ may cause unexpected behavior. ``` Note that the warning is still present, after the change, but is a false-positive, see rstudio/shiny#3355
* To avoid R CMD build complaining about invalid file name, see <ThinkR-open/golem#468 (comment)>. * Via `usethis::use_build_ignore("R/_disable_autoload.R")`
With the recent release of shiny version 1.5.0, autoload (rstudio/shiny#2659, rstudio/shiny#2547) is enabled by default (
?shiny::loadSupport
).golem::add_rstudioconnect_file()
and friends).R/
to be sourced, which is unnecessary and potentially breaking if the code assumes objects imported from other packages through the NAMESPACE.See miraisolutions/Covid19@984ecc5 miraisolutions/Covid19#116 for a concrete such example.
The issue can be reproduced locally (with shiny 1.5.0) with a minimal example as follows
Autoloading should be disabled by including the special file
R/_disable_autoload.R
when usinggolem::add_rstudioconnect_file()
and friends (if not even done upongolem::create_golem()
), perhaps with some informative content like in miraisolutions/Covid19@984ecc5.The text was updated successfully, but these errors were encountered: