Skip to content

Commit

Permalink
renv 1.0.1 (#1639)
Browse files Browse the repository at this point in the history
* polish NEWS

* update README

* Try to make sure sandbox unlocked at end

* fixup

* version update

* use scoped sandbox consistently

* a couple more skips
  • Loading branch information
kevinushey authored Aug 10, 2023
1 parent 42c22c0 commit 5dc2fc9
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 28 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
Package: renv
Type: Package
Title: Project Environments
Version: 1.0.0.9000
Version: 1.0.1
Authors@R: c(
person("Kevin", "Ushey", role = c("aut", "cre"), email = "[email protected]",
comment = c(ORCID = "0000-0003-2880-7407")),
Expand Down
18 changes: 10 additions & 8 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@

# renv 1.1.0 (UNRELEASED)
# renv 1.0.1

* Fixed an issue where authentication headers could be duplicated when
using the `libcurl` download method. (#1605)

* `renv::use()` now defaults to setting `isolate = TRUE` when `sandbox = TRUE`.

* Fixed an issue where the renv watchdog could fail to load when not installed
into the user library. (#1617)
* Fixed an issue where the renv watchdog could fail to load, leading to slowness
in activating the sandbox on startup. (#1617)

* Fixed an issue where renv did not display warnings / errors from `renv::snapshot()`
when `options(renv.verbose = FALSE)` was set. The display of these messages
Expand All @@ -32,7 +32,7 @@
* Fixed a logic error in reading `RENV_AUTOLOAD_ENABLED`. (#1580)

* `renv::restore()` no longer runs without prompting on load if the
library is empty (#1543).
library is empty. (#1543)

* `renv::repair()` now checks for installed packages which lack a known
remote source, and updates their `DESCRIPTION` files if it can infer an
Expand All @@ -42,11 +42,11 @@
we've rolled back that change as the prompting was over-aggressive. (#1574)

* `renv::status()` now first reports on uninstalled packages, before reporting on
used <-> installed mismatches (#1538).
used <-> installed mismatches. (#1538)

* When the `RENV_STARTUP_DIAGNOSTICS` environment variable is set to `TRUE`,
`renv` now displays a short diagnostics report after a project's autoloader
has been run. This can be useful when diagnosing why `renv` is slow to load
renv now displays a short diagnostics report after a project's autoloader
has been run. This can be useful when diagnosing why renv is slow to load
in certain projects. (#1557)

* renv now ensures the sandbox is activated on load, for R processes which
Expand All @@ -64,7 +64,8 @@
* Use correct spelling of IRkernel package (#1528).

* Honor `R_LIBCURL_SSL_REVOKE_BEST_EFFORT` when using an external `curl.exe`
binary to download files (#1624)
binary to download files. (#1624)


# renv 1.0.0

Expand Down Expand Up @@ -207,6 +208,7 @@
* renv functions give a clearer error if `renv.lock` has somehow become
corrupted (#1027).


# renv 0.17.3

* Fixed an issue where `renv::install("bioc::<package>")` could fail if
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ for your R projects. Use renv to make your R projects more isolated,
portable and reproducible.

- **Isolated**: Installing a new or updated package for one project
won't break your other projects, and vice versa. That's because renv
wont break your other projects, and vice versa. Thats because renv
gives each project its own private library.
- **Portable**: Easily transport your projects from one computer to
another, even across different platforms. renv makes it easy to
Expand All @@ -42,14 +42,14 @@ install.packages("renv")
<img src="vignettes/renv.png" alt="A diagram showing the most important verbs and nouns of renv. Projects start with init(), which creates a project library using packages from the system library. snapshot() updates the lockfile using the packages installed in the project library, where restore() installs packages into the project library using the metadata from the lockfile, and status() compares the lockfile to the project library. You install and update packages from CRAN and GitHub using install() and update(), but because you'll need to do this for multiple projects, renv uses cache to make this fast." width="408" style="display: block; margin: auto;" />

Use `renv::init()` to initialize renv in a new or existing project. This
will set up up **project library**, containing all the packages you're
will set up up **project library**, containing all the packages youre
currently using. The packages (and all the metadata needed to reinstall
them) are recorded into a **lockfile**, `renv.lock`, and a `.Rprofile`
ensures that the library is used every time you open that project.

As you continue to work on your project, you will install and upgrade
packages, either using `install.packages()` and `update.packages` or
`renv::install()` and `renv::update()`. After you've confirmed your code
`renv::install()` and `renv::update()`. After youve confirmed your code
works as expected, use `renv::snapshot()` to record the packages and
their sources in the lockfile.

Expand All @@ -66,10 +66,10 @@ will help you understand the most important verbs and nouns of renv.

If you have a question about renv, please first check the
[FAQ](https://rstudio.github.io/renv/articles/faq.html) to see whether
your question has already been addressed. If it hasn't, please feel free
your question has already been addressed. If it hasnt, please feel free
to ask on the [RStudio Community forums](https://community.rstudio.com).

If you believe you've found a bug in renv, please file a bug (and, if
If you believe youve found a bug in renv, please file a bug (and, if
possible, a [reproducible example](https://reprex.tidyverse.org)) at
<https://github.com/rstudio/renv/issues>.

Expand Down
11 changes: 6 additions & 5 deletions tests/testthat.R
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@

library(testthat)
library(renv, warn.conflicts = FALSE)

if (renv:::renv_tests_supported()) {
# renv:::renv_tests_diagnostics()
test_check("renv")
} else {
message("renv does not support running tests on this platform.")
if (!renv:::renv_tests_supported()) {
message("* renv does not support running tests on this platform.")
if (!interactive()) quit(status = 0L)
}

test_check("renv")
8 changes: 8 additions & 0 deletions tests/testthat/helper-setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ renv_tests_setup <- function(scope = parent.frame()) {
# fix up the library paths if needed for testing
renv_tests_setup_libpaths(scope = scope)

# make sure we clean up sandbox on exit
renv_tests_setup_sandbox(scope = scope)

# initialize test repositories
renv_tests_setup_repos(scope = scope)

Expand Down Expand Up @@ -140,6 +143,11 @@ renv_tests_setup_libpaths <- function(scope = parent.frame()) {

}

renv_tests_setup_sandbox <- function(scope = parent.frame()) {
renv_scope_options(renv.sandbox.locking_enabled = FALSE)
defer(renv_sandbox_unlock(), scope = scope)
}

renv_tests_setup_repos <- function(scope = parent.frame()) {

# generate our dummy repository
Expand Down
6 changes: 6 additions & 0 deletions tests/testthat/test-ppm.R
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ test_that("RSPM is confirmed not supported on trusty", {
})

test_that("renv correctly detects RHEL as CentOS for RSPM", {
skip_on_cran()
skip_on_os("windows")

release <- heredoc('
NAME="Red Hat Enterprise Linux Server"
Expand All @@ -81,6 +83,8 @@ test_that("renv correctly detects RHEL as CentOS for RSPM", {
})

test_that("URLs like http://foo/bar aren't queried", {
skip_on_cran()
skip_on_os("windows")

# pretend to be Ubuntu
renv_scope_envvars(
Expand All @@ -103,6 +107,8 @@ test_that("URLs like http://foo/bar aren't queried", {
})

test_that("renv_ppm_transform() uses source URLs when appropriate", {
skip_on_cran()
skip_on_os("windows")

# pretend to be Ubuntu
renv_scope_envvars(
Expand Down
20 changes: 11 additions & 9 deletions tests/testthat/test-sandbox.R
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@ renv_scoped_sandbox <- function(scope = parent.frame()) {

old <- list(.Library.site, .Library, .libPaths())
defer(scope = scope, {
renv_binding_replace(base, ".Library.site", old[[1]])
renv_binding_replace(base, ".Library", old[[2]])
unlink(sandbox, recursive = TRUE, force = TRUE)
renv_binding_replace(base, ".Library.site", old[[1L]])
renv_binding_replace(base, ".Library", old[[2L]])
.libPaths(old[[3]])
})
}

test_that("the sandbox can be activated and deactivated", {

renv_scope_options(renv.config.sandbox.enabled = TRUE)
renv_scope_envvars(RENV_PATHS_SANDBOX = tempdir())
renv_scoped_sandbox()

# save current library paths
libpaths <- .libPaths()
Expand All @@ -37,8 +37,7 @@ test_that("the sandbox can be activated and deactivated", {

test_that("multiple attempts to activate sandbox are handled", {

renv_scope_options(renv.config.sandbox.enabled = TRUE)
renv_scope_envvars(RENV_PATHS_SANDBOX = tempdir())
renv_scoped_sandbox()

libpaths <- .libPaths()
syslib <- renv_libpaths_system()
Expand All @@ -61,7 +60,9 @@ test_that(".Library.site isn't used even when sandbox is disabled", {
skip_if(renv_platform_windows() || empty(.Library.site))

renv_scope_options(renv.config.sandbox.enabled = FALSE)
renv_scope_envvars(RENV_PATHS_SANDBOX = tempdir())

sandbox <- renv_scope_tempfile("renv-sandbox-")
renv_scope_envvars(RENV_PATHS_SANDBOX = sandbox)

sitelib <- setdiff(.Library.site, .Library)
renv_sandbox_activate()
Expand All @@ -72,8 +73,7 @@ test_that(".Library.site isn't used even when sandbox is disabled", {

test_that("renv repairs library paths on load if sandbox is active", {

renv_scope_options(renv.config.sandbox.enabled = TRUE)
renv_scope_envvars(RENV_PATHS_SANDBOX = tempdir())
renv_scoped_sandbox()

libpaths <- .libPaths()
syslib <- renv_libpaths_system()
Expand Down Expand Up @@ -116,6 +116,8 @@ test_that("multiple processes can attempt to acquire the sandbox", {
skip_on_cran()
skip_on_ci()

renv_scoped_sandbox()

# number of processes
n <- 20

Expand Down

0 comments on commit 5dc2fc9

Please sign in to comment.