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

Automatic R package download does not work with custom repositories #125

Open
georgestagg opened this issue Apr 22, 2024 · 0 comments
Open

Comments

@georgestagg
Copy link
Collaborator

See discussion in r-wasm/actions#18 for details.

The issue is that at app startup renv searches for packages inside the Shinylive app. Then, we then download each of them from the default webR binary repository. However, we might not want to download all packages from the default repo -- we might want to load them from a personal repo built with r-wasm/actions, R Universe, or somewhere else entirely.

The relevant R code:

# Uniquely install packages with webr
unique_pkgs <- unique(renv::dependencies(appDir, quiet = TRUE)$Package)
lapply(unique_pkgs, function(pkg_name) {
if (isTRUE(.webr_pkg_cache[[pkg_name]])) return()
has_pkg <- nzchar(system.file(package = pkg_name))
.webr_pkg_cache[[pkg_name]] <<- has_pkg
if (!has_pkg) {
webr::install(pkg_name)
}
})

We should have some way to signal to Shinylive that we have a package from a custom repository we want to load. Some immediate options come to mind, in order of my personal preference.

  1. Setup a new user library at startup so that webr::install() has priority over packages that are downloaded automatically.
  2. Somehow allow for defining a custom repository list for the automatic package download system.
  3. Document that automatic packages can be removed with webr::unmount() (P.S. Should we shim remove.packages() to do this in any case?)

Note: This issue should not affect Python apps. R apps deployed with shinylive::export() will be unaffected going forward, since in a future releases of r-shinylive the shinylive::export() function will gather the package references for packages installed on the local machine and deploy them directly with the app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant