Skip to content

Commit

Permalink
release renv 1.0.0 (#1526)
Browse files Browse the repository at this point in the history
* polish NEWS

* Add GitHub links to DESCRIPTION

* remove MRAN; update URLs

* update copyright

* update 2023-07-06 18:51:52.609604

* try to resolve revdep check issues

* remove reference to removed vignette

* jetpack expects lockfile structure from status

* more tweaks for jetpack

* pkgdown fixups

* Update R/status.R

Co-authored-by: Hadley Wickham <[email protected]>

* tweaks + snapshot update

* update NEWS

* remove unneeded function

* Polish news

* bring back dependency inference on snapshot

---------

Co-authored-by: Hadley Wickham <[email protected]>
  • Loading branch information
kevinushey and hadley authored Jul 7, 2023
1 parent dbeacb2 commit 8f6763e
Show file tree
Hide file tree
Showing 37 changed files with 589 additions and 415 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Description: A dependency management toolkit for R. Using 'renv', you can create
a 'lockfile', and later restore your library as required. Together, these
tools can help make your projects more isolated, portable, and reproducible.
License: MIT + file LICENSE
URL: https://rstudio.github.io/renv/
URL: https://rstudio.github.io/renv/, https://github.com/rstudio/renv
BugReports: https://github.com/rstudio/renv/issues
Imports: utils
Suggests: BiocManager, cli, covr, cpp11, devtools, gitcreds, jsonlite, knitr, miniUI,
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
Copyright 2021 RStudio, PBC
Copyright 2023 Posit Software, PBC

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

Expand Down
198 changes: 97 additions & 101 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,148 +1,144 @@

# renv 0.18.0 (UNRELEASED)
# renv 1.0.0

* `renv::checkout()` gains the `actions` argument, allowing you choose whether
a lockfile is generated from the provided repositories ("snapshot"), or
whether packages are installed from the provided repositories ("restore").
## New features

* `renv::status()` gets new, more compact, display when packages have some
inconsistent combination of being installed, used, and recorded.
* New `renv::checkout()` installings the latest-available packages from a
repository. For example, `renv::checkout(date = "2023-02-08")` will install
the packages available on 2023-02-08 from the Posit
[Package Manager](https://packagemanager.rstudio.com/) repository.
The `actions` argument allows you choose whether a lockfile is generated from
the provided repositories ("snapshot"), or whether packages are installed
from the provided repositories ("restore").

* `renv::init()` now prompts the user to select a snapshot type, for projects
containing a top-level DESCRIPTION file. (#1485)
* `renv::deactivate()` gains a `clean` argument: when `TRUE` it will delete
all renv files/directories, leaving the project the way it was found.

* `renv::load()` makes the loading message a little more prominent, and we fixed a
bug that prevented out-of-sync repos from being reported.
* `renv::init()` now uses [Posit Public Package Manager](https://packagemanager.posit.co)
by default, for new projects where the repositories have not already been
configured externally. See the options `renv.config.ppm.enabled`,
`renv.config.ppm.default`, and `renv.config.ppm.url` in `?config` for more
details (#430).

* `renv::dependencies()` now discovers R dependencies inside jupyter notebooks (#929).
* `renv::lockfile_create()`, `renv::lockfile_read()`, `renv::lockfile_write()`
and `renv::lockfile_modify()` provide a small family of functions for
interacting with renv lockfiles programmatically (#1438).

* `renv::install(type = "source")` now ensures source repositories are used
in projects using [PPM](https://packagemanager.posit.co/). (#927)

* `renv::restore()` now emits an error if called in a project that
does not contain a lockfile. (#1474)
* Handling of development dependencies has been refined. `renv::snapshot()`
and `renv::status()` no longer track development dependencies, while
`install()` continues to install them (#1019). `Suggested` packages listed in
`DESCRIPTION` files are declared as development dependencies regardless of
whether or not they're a "package" project.

* If `renv::config$user.profile()` is `TRUE`, the packages it uses are now included
in the development dependencies, which means that they will be installed
by `install()` but not recorded in the snapshot.
* MRAN integration is now disabled by default, pending the upcoming shutdown
of Microsoft's MRAN service. Users who require binaries of older R packages
on Windows + macOS can consider using the instance of CRAN mirrored by the
[Posit Public Package Manager](https://packagemanager.posit.co) (#1343).

* renv now attempts to infer remote dependencies for GitHub packages that
appear to be installed from sources; that is, for packages without a
recognizable remote source encoded in its DESCRIPTION file. (#841)
## Bug fixes and minor improvements

* `renv::load()` gives a more informative message if a lockfile is present but
no packages are installed (#353).
* Development versions of renv are now tracked using the Git SHA of the
current commit, rather than a version number that's incremented on every
change (#1327). This shouldn't have any user facing impact, but makes
renv maintenance a little easier.

* renv now provides a small family of functions for interacting with renv
lockfiles -- see `?lockfile` for more details. (#1438)
* Fixed an issue causing "restarting interrupted promise evaluation" warnings
to be displayed when querying available packages failed. (#1260)

* renv now activates the Bioconductor repositories when installing a package
from a remote (e.g. GitHub) which declares a Bioconductor dependency (via
a non-empty 'biocViews' field). (#934)
* `renv::activate()` uses a three option menu that hopefully make your choices
more clear (#1372).

* renv no longer attempts to query package repositories when checking
if a project is synchronized on startup. (#812)
* `renv::dependencies()` now discovers R package dependencies inside Jupyter
notebooks (#929).

* `renv::update()` can now update packages installed from GitLab (#136) and
BitBucket (#1194).
* `renv::dependencies()` includes packages used by user profile (`~/.Rprofile`)
if `renv::config$user.profile()` is `TRUE`. They are set as development
dependencies, which means that they will be installed by `install()` but not
recorded in the snapshot.

* `renv::snapshot()` now standardises pak metadata so CRAN packages installed via
pak look the same as CRAN packages installed with renv or `install.packages()`
(#1239).

* `renv::install()` now keeps source when installing packages from source (#522).
* `renv::dependencies()` only extracts dependencies from text in YAML
headers that looks like valid R code (#1288).

* `renv::install()` now validates that binary packages can be loaded after
installation, in a manner similar to source packages. (#1275)
* `renv::dependencies()` no longer treats `box::use(module/file)` as using
package `module` (#1377).

* `renv::snapshot()` and `renv::status()` no longer track development dependencies.
`install()` will continue to install them (#1019).
* `renv::init()` now prompts the user to select a snapshot type if the project
contains a top-level DESCRIPTION file (#1485).

* `renv::install()` respects the project snapshot type, if set.
* `renv::install(type = "source")` now ensures source repositories are used
in projects using [PPM](https://packagemanager.posit.co/). (#927)

* `renv::dependencies()` now marks `Suggested` packages listed in `DESCRIPTION` files
as development dependencies regardless of whether or not they're a "package"
project.
* `renv::install()` activates Bioconductor repositories when installing a
package from a remote (e.g. GitHub) which declares a Bioconductor dependency
(via a non-empty 'biocViews' field) (#934).

* `renv::settings$package.dependency.fields()` now only affects packages installed
directly by the user, not downstream dependencies of those packages.
* `renv::install()` respects the project snapshot type, if set.

* Fixed an issue where `renv::snapshot(exclude = <...>)` could warn when
attempting to exclude a package which was not already installed. (#1396)
* `renv::install()` now keeps source when installing packages from source (#522).

* If `renv::snapshot()` finds missing packages, a new prompt allows you to
install them before continuing (#1198).
* `renv::install()` now validates that binary packages can be loaded after
installation, in a manner similar to source packages (#1275).

* When prompting to activate a project, you now get three options that hopefully
make your choices more clear.

* `renv::dependencies()` no longer treats `box::use(module/file)` as using
package `module` (#1377).
* `renv::install()` now supports Bioconductor remotes of the form
`bioc::<BiocVersion>/<Package>`, for installing packages from
a particular version of Bioconductor. Aliases like 'release' and
'devel' are also supported (#1195).

* `renv::install()` now requires interactive confirmation that you want to
install packages (#587).

* Fixed an issue where `renv::restore()` could fail to restore packages
downloaded and installed from [r-universe](https://r-universe.dev/). (#1359)
* `renv::load()` gives a more informative message if a lockfile is present but
no packages are installed (#353).

* `renv::deactivate()` gains a `clean` argument: when `TRUE` it will delete
all renv files/directories, leaving the project the way it was found.
* `renv::load()` no longer attempts to query package repositories when checking
if a project is synchronized (#812).

* `renv::status()` now works more like `renv::restore()` when package versions
are different (#675).
* `renv::load()` no longer duplicates entries on the `PATH` environment variable
(#1095).

* renv functions give a clearer error if `renv.lock` has somehow become
corrupted (#1027).
* `renv::restore()` can now use `pak::pkg_install()` to install packages
when `pak` integration is enabled. Set `RENV_CONFIG_PAK_ENABLED = TRUE`
in your project's `.Renviron` if you'd like to opt-in to this behavior.
Note that this requires a nightly build of `pak` (>= 0.4.0-9000);
see https://pak.r-lib.org/dev/reference/install.html for more details.

* `renv::restore()` now emits an error if called within a project that
does not contain a lockfile (#1474).

* `renv::init()` now uses [Posit Public Package Manager](https://packagemanager.posit.co)
by default, for new projects where the repositories have not already been
configured externally. See the options `renv.config.ppm.enabled`,
`renv.config.ppm.default`, and `renv.config.ppm.url` in `?config` for more
details. (#430)
* `renv::restore()` correctly restores packages downloaded and installed
from [r-universe](https://r-universe.dev/) (#1359).

* MRAN integration is now disabled by default, pending the upcoming shutdown
of Microsoft's MRAN service. Users who require binaries of older R packages
on Windows + macOS can consider using the instance of CRAN mirrored by the
[Posit Public Package Manager](https://packagemanager.posit.co) (#1343).
* `renv::snapshot()` now standardises pak metadata so CRAN packages installed via
pak look the same as CRAN packages installed with renv or `install.packages()`
(#1239).

* `renv::dependencies()` only extracts dependencies from text in YAML
headers that looks like valid R code (#1288).
* If `renv::snapshot()` finds missing packages, a new prompt allows you to
install them before continuing (#1198).

* `renv::snapshot()` no longer requires confirmation when writing the first
snapshot, since that's an action that can easily be undone (by deleting
`renv.lock`) (#1281).

* `renv::snapshot()` now shows if the R version changes, even if no packages
* `renv::snapshot()` reports if the R version changes, even if no packages
change (#962).

* Development versions of renv are now tracked using the Git SHA of the
current commit, rather than a version number that's incremented on every
change (#1327). This shouldn't have any user facing impact, but makes
renv maintenance a little easier.
* `renv::snapshot(exclude = <...>)` no longer warns when attempting to exclude
a package that is not installed (#1396).

* Fixed an issue causing "restarting interrupted promise evaluation" warnings
to be displayed when querying available packages failed. (#1260)
* `renv::status()` now uses a more compact display when packages have some
inconsistent combination of being installed, used, and recorded.

* `renv::load()` no longer duplicates entries on the `PATH` environment variable
(#1095).
* `renv::status()` now works more like `renv::restore()` when package versions
are different (#675).

* renv gains a new function `renv::checkout()`, for installing the
latest-available packages from a repository. For example, one can
use `renv::checkout(date = "2023-02-08")` to install the packages available
on 2023-02-08 from the Posit [Package Manager](https://packagemanager.rstudio.com/)
repository.

* `renv::install()` now supports Bioconductor remotes of the form
`bioc::<BiocVersion>/<Package>`, for installing packages from
a particular version of Bioconductor. Aliases like 'release' and
'devel' are also supported. (#1195)
* `renv::update()` can now update packages installed from GitLab (#136) and
BitBucket (#1194).

* `renv::restore()` can now use `pak::pkg_install()` to install packages
when `pak` integration is enabled. Set `RENV_CONFIG_PAK_ENABLED = TRUE`
in your project's `.Renviron` if you'd like to opt-in to this behavior.
Note that this requires a nightly build of `pak` (>= 0.4.0-9000);
see https://pak.r-lib.org/dev/reference/install.html for more details.

* `renv::settings$package.dependency.fields()` now only affects packages
installed directly by the user, not downstream dependencies of those packages.

* renv functions give a clearer error if `renv.lock` has somehow become
corrupted (#1027).

# renv 0.17.3

Expand Down
2 changes: 1 addition & 1 deletion R/activate.R
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ renv_activate_impl <- function(project,
renv_imbue_self(project)

# restart session if requested
if (restart && !renv_tests_running())
if (restart && !is_testing())
return(renv_restart_request(project, reason = "renv activated"))

if (renv_rstudio_available())
Expand Down
6 changes: 3 additions & 3 deletions R/cache.R
Original file line number Diff line number Diff line change
Expand Up @@ -114,11 +114,11 @@ renv_cache_synchronize <- function(record, linkable = FALSE) {
if (!file.exists(path))
return(FALSE)

# bail if the package source is unknown (assume that packages with an
# unknown source are not cacheable)
# bail if the package source is unknown
# (packages with an unknown source are not cacheable)
desc <- renv_description_read(path)
source <- renv_snapshot_description_source(desc)
if (identical(source, list(Source = "Unknown")))
if (identical(source, list(Source = "unknown")))
return(FALSE)

# bail if record not cacheable
Expand Down
9 changes: 9 additions & 0 deletions R/config-defaults.R
Original file line number Diff line number Diff line change
Expand Up @@ -303,6 +303,15 @@ config <- list(
)
},

snapshot.inference = function(..., default = TRUE) {
renv_config_get(
name = "snapshot.inference",
type = "logical[1]",
default = default,
args = list(...)
)
},

snapshot.validate = function(..., default = TRUE) {
renv_config_get(
name = "snapshot.validate",
Expand Down
25 changes: 16 additions & 9 deletions R/dependencies.R
Original file line number Diff line number Diff line change
Expand Up @@ -504,7 +504,7 @@ renv_dependencies_discover_preflight <- function(paths, errors) {
"A large number of files (%i in total) have been discovered.",
"It may take renv a long time to crawl these files for dependencies.",
"Consider using .renvignore to ignore irrelevant files.",
"See `?dependencies` for more information.",
"See `?renv::dependencies` for more information.",
"Set `options(renv.config.dependencies.limit = Inf)` to disable this warning.",
""
)
Expand Down Expand Up @@ -723,7 +723,7 @@ renv_dependencies_discover_rmd_yaml_header <- function(path, mode) {
# check for parameterized documents
status <- catch(renv_dependencies_discover_rmd_yaml_header_params(yaml, deps))
if (inherits(status, "error"))
renv_error_report(status)
renv_dependencies_error_push(path, status)

# get list of dependencies
packages <- deps$data()
Expand Down Expand Up @@ -1634,19 +1634,26 @@ renv_dependencies_scope <- function(root = NULL, scope = parent.frame()) {
defer(the$dependencies_state <- NULL, scope = scope)
}

renv_dependencies_error_push <- function(path = NULL, error = NULL) {

state <- renv_dependencies_state()
if (is.null(state))
return()

path <- path %||% state$path
problem <- list(file = path, error = error)
state$problems$push(problem)

}

renv_dependencies_error <- function(path, error = NULL, packages = NULL) {

# if no error, return early
if (is.null(error))
return(renv_dependencies_list(path, packages))

# check for missing state (e.g. if internal method called directly)
state <- renv_dependencies_state()
if (!is.null(state)) {
path <- path %||% state$path
problem <- list(file = path, error = error)
state$problems$push(problem)
}
# push the error report
renv_dependencies_error_push(path, error)

# return dependency list
renv_dependencies_list(path, packages)
Expand Down
2 changes: 1 addition & 1 deletion R/download.R
Original file line number Diff line number Diff line change
Expand Up @@ -655,7 +655,7 @@ renv_download_report <- function(elapsed, file) {
return()

info <- renv_file_info(file)
size <- if (renv_tests_running())
size <- if (is_testing())
"XXXX bytes"
else
structure(info$size, class = "object_size")
Expand Down
5 changes: 0 additions & 5 deletions R/errors.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,3 @@ renv_error_tag <- function(e) {
renv_error_handler_call <- function() {
as.call(list(renv_error_handler))
}

renv_error_report <- function(error = NULL) {
if (renv_tests_running() && inherits(error, "error"))
stop(error)
}
6 changes: 4 additions & 2 deletions R/init.R
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,13 @@ init <- function(project = NULL,
renv_init_settings(project, settings)

# for bare inits, just activate the project
if (bare)
if (bare) {
renv_imbue_impl(project)
return(renv_init_fini(project, profile, restart))
}

# compute and cache dependencies to (a) reveal problems early and (b) compute once
deps <- renv_snapshot_dependencies(project, dev = TRUE)
deps <- renv_snapshot_dependencies(project, type = type, dev = TRUE)

# determine appropriate action
action <- renv_init_action(project, library, lockfile, bioconductor)
Expand Down
4 changes: 4 additions & 0 deletions R/install.R
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ install <- function(packages = NULL,
packages <- unique(c(packages, bioc))
}

# don't update renv unless it was explicitly requested
if (!"renv" %in% names(remotes))
packages <- setdiff(packages, "renv")

# start building a list of records; they should be resolved this priority:
#
# 1. explicit requests from the user
Expand Down
Loading

0 comments on commit 8f6763e

Please sign in to comment.