-
Notifications
You must be signed in to change notification settings - Fork 26
use bslib to load brand.yml files #241
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great !
I hope there will be a brand package soon:
I wonder if bslib should be an import 🤔
It will really only be used with those theme_*
function.
So I am thinking we could make the theme Suggest and add rlang::check_installed()
in each function
rlang::check_installed("bslib", "bslib is required for brand support in R", version = "0.9.0")
This trick can be used to reduce imported packages that are installed by default and not optionally. In an interactive session, this function will offer the user the opportunity to install the missing package, which is quite nice.
Usually, I try to do this when the package is used for a specific feature only, which may concern a subset of users.
I am thinking we should have done this with the specific package targeted by each function. We assume if a user was using it they would have the suggested package installed, but probably more clean to really check for it.
also rename *ggplot to *ggplot2
Good catch, bslib is suggested and not imported. I've added As we haven't released this functionality yet, I also renamed |
Thanks @cderv ! One related question I had was whether it is expected that all the Suggests will be installed whenever tests are run. I found some conflicting information like this https://www.r-bloggers.com/2017/03/suggests-depends/ I do want automated tests that install and test these (to spot API breakage), but I think we have other tests that skip themselves if a suggested package is not installed,and I’d be glad to do that if it is best practice. The smoke tests could easily do this. |
I usually follow this guideline: https://r-pkgs.org/description.html#sec-description-imports-suggests
So anything in Suggests must conditionally used.
No problem to add them to tests. All the package 'Imports + Suggests' are installed on CI. You can then use the All these precautions are usually relevant for CRAN publishing, and its automated testing. |
Use bslib to load brand.yml, so that brand palette colors are resolved, etc.
It would be even better to read the light and dark brands from the Quarto document's metadata, but we don't support that yet.