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

use_targets() should assert {rstudioapi} namespace #836

Closed
7 tasks done
pat-s opened this issue May 7, 2022 · 1 comment
Closed
7 tasks done

use_targets() should assert {rstudioapi} namespace #836

pat-s opened this issue May 7, 2022 · 1 comment

Comments

@pat-s
Copy link
Member

pat-s commented May 7, 2022

Prework

  • Read and agree to the code of conduct and contributing guidelines.
  • Confirm that your issue is a genuine bug in the targets package itself and not a user error, known limitation, or issue from another package that targets depends on. For example, if you get errors running tar_make_clustermq(), try isolating the problem in a reproducible example that runs clustermq and not targets. And for miscellaneous troubleshooting, please post to discussions instead of issues.
  • If there is already a relevant issue, whether open or closed, comment on the existing thread instead of posting a new issue.
  • Using targets::tar_reprex(), reprex::reprex(), or similar, post a minimal reproducible example like this one so the maintainer can troubleshoot the problems you identify. A reproducible example is:
    • Runnable: post enough R code and data so any onlooker can create the error on their own computer.
    • Minimal: reduce runtime wherever possible and remove complicated details that are irrelevant to the issue at hand.
    • Readable: format your code according to the tidyverse style guide.

Description

When using targets::use_targets() in a fresh {renv} project, {rstudioapi} namespace is not available.
AFAICS this only suppressed the final file opening of _targets.R in the editor but wanted to report it anyhow.

Reproducible example

> targets::use_targets()
✖ Install packages {{future}}, {{future.callr}}, and {{future.batchtools}} to allow use_targets() to configure tar_make_future() options.Writing file "_targets.R".Writing file "run.R".Writing file "run.sh".Modify '_targets.R'
Error in loadNamespace(x) : there is no package calledrstudioapi

Expected result

Functionality is skipped without throwing an error or a warning is issued similar to the ones about the future pkgs.

Diagnostic information

targets 0.12.0

@wlandau
Copy link
Member

wlandau commented May 8, 2022

I agree that the outcome is not desirable for the user, but I would prefer not to have targets get involved directly. use_targets() is simply calling usethis::edit_file(), the latter of which requires rstudioapi when invoked inside RStudio. Maybe the default behavior of usethis::edit_file() should be to fall back on its current behavior for terminal sessions: to open the user's default text editor. But this is outside the scope of targets.

@wlandau wlandau closed this as completed May 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants