rstudio / rsconnect

Publish Shiny Applications, RMarkdown Documents, Jupyter Notebooks, Plumber APIs, and more
http://rstudio.github.io/rsconnect/
131 stars 80 forks source link

New strategy to retrieve DESCRIPTION if project uses renv #931

Closed hadley closed 1 year ago

hadley commented 1 year ago

Previously we'd always restore the packages from the lockfile, which I had expected to be fast since I had expected the packages to be in the cache. However, this doesn't appear to always be the case, so I instead use a simpler approach where I just force the user to resolve the problem. This means that we can always use the DESCRIPTION present in the .libPaths() making the code much simpler.

Fixes #930

@edavidaja could you please confirm that this fixes your problem?

edavidaja commented 1 year ago

now it's faster to include the lockfile 😁

> bench::mark(
+         rsconnect::writeManifest(appFiles = c("index.qmd")),
+         rsconnect::writeManifest(appFiles = c("index.qmd", "renv.lock")), iterations = 3
+     )
ℹ Capturing R dependencies with renv
✔ Found 118 dependencies
ℹ Capturing R dependencies from renv.lock
✔ Found 121 dependencies
# A tibble: 2 × 13
  expression                                                       min median `itr/sec` mem_alloc `gc/sec` n_itr  n_gc total_time result memory     time       gc      
  <bch:expr>                                                     <bch> <bch:>     <dbl> <bch:byt>    <dbl> <int> <dbl>   <bch:tm> <list> <list>     <list>     <list>  
1 "rsconnect::writeManifest(appFiles = c(\"index.qmd\"))"        8.07s  8.49s     0.118     114MB    1.14      3    29      25.4s <NULL> <Rprofmem> <bench_tm> <tibble>
2 "rsconnect::writeManifest(appFiles = c(\"index.qmd\", \"renv.… 6.38s  6.49s     0.155     113MB    0.618     3    12      19.4s <NULL> <Rprofmem> <bench_tm> <tibble>

thanks!

aronatkins commented 1 year ago

Confirmed deployment for an renv project from an environment that does not have a user R library.