Cleaning up renv usage - #112
Conversation
|
This addresses issue #74 |
b4c1f28 to
5922513
Compare
iantaylor-NOAA
left a comment
There was a problem hiding this comment.
I'm not great with renv, but this looks reasonable to me.
There was a problem hiding this comment.
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
.Rprofileto automatically sourcerenv/activate.R. - Add
renv/activate.Rautoloader (pinningrenvversion 1.2.3) andrenv/settings.json. - Add
renv/.gitignoreto preventrenv-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.
| # use start-up diagnostics if enabled | ||
| diagnostics <- Sys.getenv("RENV_STARTUP_DIAGNOSTICS", unset = "FALSE") | ||
| if (diagnostics) { |
There was a problem hiding this comment.
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.
| @@ -0,0 +1 @@ | |||
| source("renv/activate.R") | |||
There was a problem hiding this comment.
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.
|
@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. |
What is the feature?
renvis 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?
renvprofiles so that there is only one version of therenvlockfile.Does the PR impact any other area of the project, maybe another repo?