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

General Issue: create_blogpost.R checks for and installs packages #245

Open
bms63 opened this issue Oct 30, 2024 · 9 comments
Open

General Issue: create_blogpost.R checks for and installs packages #245

bms63 opened this issue Oct 30, 2024 · 9 comments

Comments

@bms63
Copy link
Collaborator

bms63 commented Oct 30, 2024

Background Information

@StefanThoma and @manciniedoardo what do you all think about check and installing packages when you create a blog post. could just be another helper file that create_blogpost calls??

packages to install

image

Helper program to check and install packages

check_and_install <- function(packages) {
for (package in packages) {
if (!require(package, character.only = TRUE)) {
install.packages(package, dependencies = TRUE)
library(package, character.only = TRUE)
} else {
message(paste(package, "already installed"))
}
}
message("Let's program some ADaMs!")
}

Use the function

check_and_install(c(
packages here...
))

@manciniedoardo
Copy link
Collaborator

sounds like a great idea @bms63 !

@bms63
Copy link
Collaborator Author

bms63 commented Oct 30, 2024

god...teal has so many dependencies...

@StefanThoma
Copy link
Collaborator

Why not renv?

@bms63
Copy link
Collaborator Author

bms63 commented Oct 30, 2024

I am always weary of renv it made working on admiral unnecessarily challenging for new folks.

having just installed teal and mirai and I wondering if there is a way to not have to install them for new posters - just takes forever. guess the docker image could be handy????

@StefanThoma
Copy link
Collaborator

I wonder if there is a way where only a select few blogposts render, plus the new one?
That way they can test their blog, and when uploaded everything renders.

@manciniedoardo
Copy link
Collaborator

Yeah I always temporarily delete ~40 posts to render the website!

@bms63
Copy link
Collaborator Author

bms63 commented Oct 31, 2024

This is sort of a tough one.

@cicdguy and @pawelru any recommendations?

We grew too big and have way too many blog posts! Installing all the packages takes some time and rendering all the posts take some time. This is a "beginner" blog and want to keep it simple/low barrier for folks wanting to come and write a post so some solutions (e.g. Docker) might be beyond our base.

Any ideas on how we can keep the barriers low for beginners and keep things minimal for us?

@pawelru
Copy link
Collaborator

pawelru commented Oct 31, 2024

I see two options: r-lib/actions/setup-r-dependencies OR r-lib/actions/setup-renv

r-lib/actions/setup-r-dependencies:

  • this requires a DESCRIPTION file to read the dependencies from. You might create a dummy DESC file - it does not have to become a package. We are currently doing this trick in pharmaverse/examples. Please have a look at its DESCRIPTION file and how the action look like and its results.
  • this is super fast because it is using PPM and install from binaries (instead of from source) plus it has in-build caching. Once downloaded, it would stay in cache and you won't repeat the download (unless there is a new version or cache removed). Have a look at the latest result here - ℹ No downloads are needed.

r-lib/actions/setup-renv:
This unfortunately I have never used so can't share my experience. I just know that it exists.

By any means - I do not recommend to maintain a list of packages with its dependencies (!). Some of those packages are still under development and the dependencies are in scope of a change. Let it be identified automatically. There are tools for that. And let it be a low maintenance thing from our side. (That's for mirai package discussed here - you should not care about that :) )
The list you showed is of good size to be putted in the dummy DESC file. I have all the positive experience with setup-r-dependencies so I would suggest this.

@bms63
Copy link
Collaborator Author

bms63 commented Nov 1, 2024

Thanks @pawelru - I agree we should move to a package-like structure and take advantage of some of these r-libs actions.

I am also interested in making blog contributors have a really easy time writing a post and looking at ways to help minimize setup and headaches for them. I am assuming a completely newb-like person here!

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

No branches or pull requests

4 participants