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

Don't snapshot() development dependencies #1399

Merged
merged 5 commits into from
Jun 7, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@

# renv 0.18.0 (UNRELEASED)

* `snapshot()` and `status()` no longer track development dependencies.
`install()` will continue to install them (#1019).

* `dependencies()` now marks `Suggested` packages listed in `DESCRIPTION` files
as development dependencies regardless of whether or not they're a "package"
project.
Expand Down
2 changes: 1 addition & 1 deletion R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ install <- function(packages = NULL,
return(renv_pak_install(packages, libpaths, project))
}

packages <- packages %||% renv_snapshot_dependencies(project, "implicit")
packages <- packages %||% renv_snapshot_dependencies(project, include_dev = TRUE)
kevinushey marked this conversation as resolved.
Show resolved Hide resolved
if (empty(packages)) {
writef("* There are no packages to install.")
return(invisible(list()))
Expand Down
4 changes: 2 additions & 2 deletions R/snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -838,7 +838,7 @@ renv_snapshot_report_actions <- function(actions, old, new) {
}
# nocov end

renv_snapshot_dependencies <- function(project, type = NULL) {
renv_snapshot_dependencies <- function(project, type = NULL, include_dev = FALSE) {
kevinushey marked this conversation as resolved.
Show resolved Hide resolved

type <- type %||% settings$snapshot.type(project = project)

Expand Down Expand Up @@ -870,7 +870,7 @@ renv_snapshot_dependencies <- function(project, type = NULL) {
progress = FALSE,
field = "Package",
errors = errors,
dev = TRUE
dev = include_dev
kevinushey marked this conversation as resolved.
Show resolved Hide resolved
),

renv.dependencies.error = renv_dependencies_error_handler(message, errors)
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-snapshot.R
Original file line number Diff line number Diff line change
Expand Up @@ -457,3 +457,16 @@ test_that("exclude handles uninstalled packages", {
lockfile <- renv_lockfile_load(project)
expect_null(lockfile$Packages$bread)
})

test_that("snapshot doesn't include development dependencies", {

renv_tests_scope()
writeLines(c("Imports: egg", "Suggests: bread"), "DESCRIPTION")

inst <- install()
expect_named(inst, c("bread", "egg"), ignore.order = TRUE)

snap <- snapshot()
expect_named(snap$Packages, "egg")

})