Skip to content

Cleaning up renv usage - #112

Merged
MOshima-PIFSC merged 1 commit into
mainfrom
renv-cleanup
Jul 10, 2026
Merged

Cleaning up renv usage#112
MOshima-PIFSC merged 1 commit into
mainfrom
renv-cleanup

Conversation

@MOshima-PIFSC

@MOshima-PIFSC MOshima-PIFSC commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

What is the feature?

  • Simplified the way renv is used in the repo so that no matter what branch a user is on, they are using the same version of packages.

How have you implemented the solution?

  • Removed renv profiles so that there is only one version of the renv lockfile.

Does the PR impact any other area of the project, maybe another repo?

  • I removed the renv files from dev branch to avoid any conflicts there.
  • We should copy this change to the opakapaka-update branch.

@MOshima-PIFSC

Copy link
Copy Markdown
Contributor Author

This addresses issue #74

@kellijohnson-NOAA kellijohnson-NOAA linked an issue Jul 10, 2026 that may be closed by this pull request

@iantaylor-NOAA iantaylor-NOAA left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm not great with renv, but this looks reasonable to me.

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

This PR introduces a standardized renv setup intended to make R package environments reproducible across branches by enabling renv activation on project startup.

Changes:

  • Add project .Rprofile to automatically source renv/activate.R.
  • Add renv/activate.R autoloader (pinning renv version 1.2.3) and renv/settings.json.
  • Add renv/.gitignore to prevent renv-managed library/cache directories from being committed.

Reviewed changes

Copilot reviewed 4 out of 5 changed files in this pull request and generated 3 comments.

File Description
renv/settings.json Adds renv project settings for snapshotting and VCS ignore management.
renv/activate.R Adds the renv autoloader/bootstrap script to load the project environment.
renv/.gitignore Ignores renv-generated directories like library/, local/, and staging/.
.Rprofile Enables automatic renv activation by sourcing renv/activate.R at startup.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread renv/activate.R
Comment on lines +14 to +16
# use start-up diagnostics if enabled
diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE")
if (diagnostics) {

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

All of this code was populated automatically by renv when I initialized the project so I am hesitant to change it. Also when I ran a simple ifelse(diagnostics,1,0) where diagnostics <- FALSE, it output 0 with no error. I am going to ignore this suggestion for now and if there are problems later we can change it.

Comment thread .Rprofile
@@ -0,0 +1 @@
source("renv/activate.R")

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I think we are only using the CI workflows to install R dependencies in the github actions. If we don't call any renv functions within that script then maybe this won't be an issue. Again I am inclined to leave it and if there are problems later then change it.

Comment thread .Rprofile
@iantaylor-NOAA

Copy link
Copy Markdown
Contributor

@MOshima-PIFSC, I'm not familiar enough with renv to know if there's anything useful in the comments from copilot, so feel free to ignore them and just merge this PR as is, or make changes if you think there's any value.

@MOshima-PIFSC
MOshima-PIFSC merged commit be10018 into main Jul 10, 2026
2 checks passed
@MOshima-PIFSC
MOshima-PIFSC deleted the renv-cleanup branch July 10, 2026 18:43
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.

[feature:] set up renv to help with dependency management

3 participants