rsconnect icon indicating copy to clipboard operation
rsconnect copied to clipboard

Lint calls to .libPaths

Open aronatkins opened this issue 7 years ago • 3 comments

Deployed content is usually executed in an environment that attempts to recreate the deploying user's configuration of packages/versions/R.

Modifying .libPaths() from within a Shiny application, R Markdown document, or Plumber API is likely to use paths that are not meaningful on the server.

Warn users about this likely problem.

aronatkins avatar Mar 01 '18 16:03 aronatkins

Only need to warn if first argument (new) is not missing. Something like this:

trace(.libPaths, print = FALSE, quote({
  if (!missing(new)) {
    rlang::warn("Not a good idea on rsconnect")
  }
}))
.libPaths()
.libPaths(getwd())

hadley avatar May 01 '23 14:05 hadley

Open question: should it warn or error?

hadley avatar May 01 '23 14:05 hadley

Error feels too strong, or if it is an error, it needs to be suppressible. Folks might have some /mnt/share/R library that they conditionally add to the library path. It's not a recommended pattern, but it happens.

We might want to reiterate the same warning when running the content (this would be a Connect change).

aronatkins avatar May 01 '23 15:05 aronatkins