Skip to content

packrat (renv) dependency lookup inadvertently ignores projects in directories prefixed with /data/. #684

@jimhester

Description

@jimhester

We have a situation where our system temp directory is actually a symlink to /data/tmp, and the renv default exclusion rules cause all inferred packages to be ignored when trying to deploy content to RStudio Connect.

While in our case /data is the first directory after the root, it seems this will happen if a directory is called data anywhere in the tree. I think ideally these exclusions would match only child directories of the project root. This should be a relatively minimal example.

dir.create("data/foo", recursive = TRUE)
writeLines("library(glue)", "data/foo/test.R")
options(renv.renvignore.exclude = packrat:::ignoresForRenv(packrat:::opts$ignored.directories()))
path <- normalizePath("data/foo")
packrat:::renv$dependencies(path, root = path)
#> Finding R package dependencies ... Done!
#> [1] Source  Package Require Version Dev    
#> <0 rows> (or 0-length row.names)

Created on 2022-08-11 by the reprex package (v2.0.1)

cc @aronatkins, who I believe added this code in #647

A workaround for us is to set options(packrat.dependency.discovery.renv = FALSE), but ideally users wouldn't need to resort to this :)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions