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

Install missing packages in a local library #262

Closed
wants to merge 5 commits into from

Conversation

maurolepore
Copy link
Collaborator

@maurolepore maurolepore commented Dec 13, 2024

@maurolepore maurolepore changed the title Install required packages Install missing packages Dec 13, 2024
Copy link
Collaborator Author

@maurolepore maurolepore left a comment

Choose a reason for hiding this comment

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

(outdated)

@maurolepore maurolepore marked this pull request as ready for review December 13, 2024 12:39
Copy link
Collaborator Author

@maurolepore maurolepore left a comment

Choose a reason for hiding this comment

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

(outdated)

@maurolepore maurolepore marked this pull request as draft December 13, 2024 13:52
@maurolepore maurolepore changed the title Install missing packages Install missing packages in a local library Dec 13, 2024
Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I didn't sort to keep the diff easier to read. Happy to sort it though.

Copy link
Collaborator Author

@maurolepore maurolepore left a comment

Choose a reason for hiding this comment

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

🤞 😄

Comment on lines 48 to +75
You need:

* the package {dverse} to <u>d</u>ocument your uni<u>verse</u>,
* each package in the toy 'admiralverse' to access the documentation metadata,
* {dplyr} to manipulate the output of {dverse}, and
* {DT} to create a searchable table.

```{r dependencies}
#| echo: false
#| message: false

# Ensure the packages used here are installed; else install them in a local
# library to avoid forcing new dependencies in the system of the blog
# administrators

local_library <- tempfile()
dir.create(local_library)
# https://adv-r.hadley.nz/functions.html#on-exit
on.exit(unlink(local_library), add = TRUE, after = FALSE)

.libPaths(c(.libPaths(), local_library))

if (!requireNamespace("pak", quietly = TRUE)) {
install.packages("pak", lib = local_library)
}
# The cache is smart. It won't re-install what's already available
pak::pak(c("dverse", admiralverse, "dplyr", "DT"), lib = local_library)
```
Copy link
Collaborator Author

@maurolepore maurolepore Dec 13, 2024

Choose a reason for hiding this comment

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

Here I ensure that the packages I need are installed; else I install them in a local library to be polite -- I want to avoid forcing new dependencies in your system.

Let me know if you do prefer me to install them at a more general level, maybe in the Dockerfile?

Copy link
Collaborator

Choose a reason for hiding this comment

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

We install them as part of a workflow - I have added them now and so can close this PR :) blog is live!

@maurolepore maurolepore marked this pull request as ready for review December 13, 2024 13:58
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.

2 participants