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

renv::init ignores interactive snapshot type #1613

Closed
cstepper opened this issue Jul 28, 2023 · 1 comment
Closed

renv::init ignores interactive snapshot type #1613

cstepper opened this issue Jul 28, 2023 · 1 comment
Labels
activate/init/load 🥾 bug an unexpected problem or unintended behavior

Comments

@cstepper
Copy link
Contributor

Hi,

we're trying to use the renv::init function using the explicit snapshot type (only capturing the dependencies as declared in the DESCRIPTION).
It looks like the snapshot type is ignored when submitted interactively as opposed to setting it in advance.


Our workflow was as follows: (in a new package without any dependencies):

  1. setup a package without dependencies (using usethis::create_package())
  2. add a function using tibble package ( use_r("tibble.R")) without adding tibble as package dependency to DESCRIPTION
  3. run renv::init() interactively
renv::init()
#> This project contains a DESCRIPTION file.
#> Which files should renv use for dependency discovery in this project? 
#>   
#> 1: Use only the DESCRIPTION file. (explicit mode)
#> 2: Use all files in this project. (implicit mode)
#> 
#> Selection: 1
#> 
#> - Using 'explicit' snapshot type. Please see `?renv::snapshot` for more details.
#> 
#> - Linking packages into the project library ... Done!
#>   The following package(s) will be updated in the lockfile:
#>   
#>   # CRAN -----------------------------------------------------------------------
#> - cli         [* -> 3.6.1]
#> - glue        [* -> 1.6.2]
#> - lifecycle   [* -> 1.0.3]
#> - magrittr    [* -> 2.0.3]
#> - renv        [* -> 1.0.0]
#> - rlang       [* -> 1.1.1]
#> - vctrs       [* -> 0.6.3]
#> 
#> # RSPM -----------------------------------------------------------------------
#> - fansi       [* -> 1.0.4]
#> - pillar      [* -> 1.9.0]
#> - pkgconfig   [* -> 2.0.3]
#> - tibble      [* -> 3.2.1]
#> - utf8        [* -> 1.2.3]
#> 
#> The version of R recorded in the lockfile will be updated:
#>   - R           [* -> 4.3.1]
#> 
#> - Lockfile written to '~/cstepper/justfortesting/renvtestr/renv.lock'.
#> 
#> Restarting R session...
#> 
#> - Project '~/cstepper/justfortesting/renvtestr' loaded. [renv 1.0.0]

It looks like all package dependencies from tibble are written to the renv.lock (as we assume is "implicit" mode, not "explicit"). Also, in renv/settings.json snapshot type "implicit" is defined, not "explicit" as chosen interactively.

In contrast, when manually setting the type before renv::init() it seems to work as expected:

renv::settings$snapshot.type("explicit")
renv::init()
#> The following package(s) will be updated in the lockfile:
#>   
#>   # CRAN -----------------------------------------------------------------------
#> - renv   [* -> 1.0.0]
#> 
#> The version of R recorded in the lockfile will be updated:
#>   - R      [* -> 4.3.1]
#> 
#> - Lockfile written to '~/cstepper/justfortesting/renvtestr/renv.lock'.
#> 
#> Restarting R session...
#> 
#> - Project '~/cstepper/justfortesting/renvtestr' loaded. [renv 1.0.0]
#> 

Any ideas?
Thanks

@kevinushey kevinushey added bug an unexpected problem or unintended behavior activate/init/load 🥾 labels Jul 28, 2023
@kevinushey kevinushey added this to the 1.0.1 milestone Jul 28, 2023
@kevinushey
Copy link
Collaborator

Thanks for the bug report! This should now be fixed in the development version of renv.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
activate/init/load 🥾 bug an unexpected problem or unintended behavior
Projects
None yet
Development

No branches or pull requests

2 participants