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

prefer RSCONNECT_PACKRAT over rsconnect.packrat #937

Merged
merged 4 commits into from
Jul 28, 2023

Conversation

aronatkins
Copy link
Contributor

Environment variables are visible in the RStudio IDE R session used for push-button deployment. Not all R options are mirrored into that session.

These settings indicate that packrat should be used, even in the presence of an renv.lock. When using packrat, the renv directory and renv.lock file are removed from the bundle directory, as would happen prior to rsconnect 1.0.0.

Fixes #935
Fixes #936

# Unset any existing options before testing.
Sys.unset("RSCONNECT_PACKRAT")
options(reconnect.packrat = NULL)

# Use packrat; applies to push-button and console deploys.
# Ignores renv.lock if it exists.
Sys.setenv(RSCONNECT_PACKRAT = "TRUE")

# Use packrat; applies to console deploys only. Discouraged.
# Ignores renv.lock if it exists.
options(rsconnect.packrat = TRUE)

# If both are set, the environment variable setting wins.
# This example will use renv because RSCONNECT_PACKRAT is set.
Sys.setenv(RSCONNECT_PACKRAT = "FALSE")
options(rsconnect.packrat = TRUE)

Environment variables are visible in the RStudio IDE R session used for
push-button deployment. Not all R options are mirrored into that session.

These settings indicate that packrat should be used, even in the presence
of an renv.lock. When using packrat, the renv directory and renv.lock file
are removed from the bundle directory, as would happen prior to rsconnect 1.0.0.

Fixes #935
Fixes #936
@aronatkins aronatkins requested a review from hadley July 27, 2023 16:12
# stripping packrat and renv commands from .Rprofile. Returns the path to the
# temporary directory.
bundleAppDir <- function(appDir, appFiles, appPrimaryDoc = NULL, verbose = FALSE) {
# those files to a new temporary directory. Performs some small modifications
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adjusted indentation and spelling.

R/bundlePackage.R Outdated Show resolved Hide resolved
R/utils.R Outdated Show resolved Hide resolved
tests/testthat/test-bundlePackage.R Show resolved Hide resolved
@aronatkins aronatkins merged commit 2f07fde into main Jul 28, 2023
@aronatkins aronatkins deleted the aron-packrat-fallback branch July 28, 2023 13:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

rsconnect.packrat does not bypass renv.lock use rsconnect.packrat does not apply to push-button deployment
2 participants