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

Include library() and require() shims in webr::shim_install() #371

Merged
merged 7 commits into from
Feb 28, 2024

Conversation

georgestagg
Copy link
Member

Shim base R library() and require() commands so that webR packages are downloaded automatically with an optional menu.

It is no longer assumed that an interactive R session will be able to show a menu() when offering to download a missing R package. Instead, this now defaults to not showing a menu, with options(webr.show_menu = TRUE) enabling the menu feature globally.

This extends the functionality of the global packageNotFoundError handler so that the same feature can be used when using evalR(). The new shims also ensure that library() and require() do not need to be called again once the package is downloaded and available.

I have retained the original global handler solution as it provides additional benefits over simply shimming library() and require(). For example, when the packageNotFoundError handler is active packages can be automatically installed on demand if functions are referred to via namespace, such as cli::cli_alert_success('The cli package works!').

The webR REPL application now enables both features, including prompting with the confirmation menu, by default.

Fixes #324, #325.

@georgestagg georgestagg merged commit 10ee705 into main Feb 28, 2024
2 checks passed
@georgestagg georgestagg deleted the shim-library branch February 28, 2024 14:25
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.

webr::global_prompt_install() not working with webR.evalR()
1 participant