posit-dev / r-shinylive

https://posit-dev.github.io/r-shinylive/
Other
151 stars 16 forks source link

Detect which packages are used. Automatically install them via `{webr}` #16

Closed schloerke closed 11 months ago

schloerke commented 11 months ago

If renv::dependencies("path/to/app") can be used to detect dependencies, then we can preload app dependencies for users.

There should not be a requirement for users to call webr::install("FOO") to load a precompiled FOO package.

coatless commented 11 months ago

@schloerke this should be handled by an internal webR API calling R code. I mocked up something for library()/require() c.f. https://github.com/r-wasm/webr/issues/280

georgestagg commented 11 months ago

I think (where possible) I would lean towards using the tools that already exist in renv for discovering dependencies, rather than replicating the work in webR.

I am currently working on the next iteration of the webR package building process, and investigating Emscripten's FS.mount() API. In principle I think it should be possible to pre-build a Wasm filesystem image containing an R library (defined by renv, or a package list, or similar) ready to pre-load into the environment for a given shinylive/webR app.

This should have the additional benefit of being much quicker than downloading, decompressing, and writing many packages from the public package repo to the virtual disk.

schloerke commented 11 months ago

r-shinylive seems like the wrong place to do this.

Seems like it needs to be run in the shinylive R process if the feature is enabled.

schloerke commented 11 months ago

Bug fixed in https://github.com/posit-dev/shinylive/pull/68

Shinylive asset support updated in #21

Closing