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

preserve explicit renv dependency #916

Closed
aronatkins opened this issue Jul 18, 2023 · 3 comments · Fixed by #917
Closed

preserve explicit renv dependency #916

aronatkins opened this issue Jul 18, 2023 · 3 comments · Fixed by #917
Assignees

Comments

@aronatkins
Copy link
Contributor

Given the Shiny application

library(shiny)
library(rsconnect)

ui <- fluidPage("hello")
server <- function(input, output) {}

shinyApp(ui = ui, server = server)

The renv package is not included in the set of required packages due to:

# Don't include renv itself
if (identical(pkg$Package, "renv")) {
return(NULL)
}

packageVersion("rsconnect")
#> [1] '1.0.0'
packageVersion("renv")
#> [1] '1.0.0'
rsconnect::writeManifest()
#> ℹ Capturing R dependencies with renv
#> Warning in is.na(value): is.na() applied to non-(list or vector) of type
#> 'language'
#> Error in if (is.na(value)) default else as.logical(value): the condition has length > 1
manifest <- jsonlite::read_json("manifest.json")
manifest$packages$rsconnect$description$Imports
#> [1] "cli, curl, digest, jsonlite, lifecycle, openssl (>= 2.0.0),\npackrat (>= 0.6), renv (>= 1.0.0), rlang (>= 1.0.0), rstudioapi\n(>= 0.5), tools, yaml (>= 2.1.5)"
manifest$packages$renv
#> NULL

Created on 2023-07-18 with reprex v2.0.2

@aronatkins
Copy link
Contributor Author

Workaround: Fall back to use packrat for dependency detection (which internally uses renv::dependencies and does not have an renv dependency removed).

options(rsconnect.packrat = TRUE)

@aronatkins
Copy link
Contributor Author

This issue highlights a difference between renv and packrat: we could disable the implicit packrat dependency.

packrat::.snapshotImpl(
project = bundleDir,
snapshot.sources = FALSE,
fallback.ok = TRUE,
verbose = verbose,
implicit.packrat.dependency = FALSE
)

aronatkins added a commit that referenced this issue Jul 18, 2023
…cies

side-effect: an renv dependency is included when consuming an renv.lock, as
there is no way to distinguish between a code-dependency and
bootstrapping-dependency.

fixes #916
@aronatkins
Copy link
Contributor Author

This issue may be causing folks problems out in the wild, as reported here: https://stackoverflow.com/questions/76711093/missing-dependency-from-rsconnect-when-deploying-shinyapps/76715457#76715457

aronatkins added a commit that referenced this issue Jul 18, 2023
…cies (#917)

* use renv::dependencies rather than renv::snapshot to compute dependencies

side-effect: an renv dependency is included when consuming an renv.lock, as
there is no way to distinguish between a code-dependency and
bootstrapping-dependency.

fixes #916

* test updates showing additional renv dependency

* announce fix
@aronatkins aronatkins self-assigned this Jul 18, 2023
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

Successfully merging a pull request may close this issue.

2 participants