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

Close 1239: More devtools and usethis commands for R package development #1242

Open
wants to merge 13 commits into
base: master
Choose a base branch
from

Conversation

jooyoungseo
Copy link
Contributor

What problem did you solve?

I have added the following commands which are frequently used for R package developpment:

  • devtools::dev_mode()

  • devtools::spell_check()

  • devtools::check_rhub()

  • devtools::check_win_devel()

  • devtools::release()

  • usethis::use_version()

  • usethis::use_cran_comments()

  • usethis::use_news_md()

  • usethis::use_git()

  • usethis::use_github()

  • pkgdown::build_site()

I did not use task because these commands require interaction.

  • [ ]

(If you have)Screenshot

N/A

(If you do not have screenshot) How can I check this pull request?

In the command palette, use the following commands:

  • r.devMode
  • r.spellCheck
  • r.checkRhub
  • r.checkWinDevel
  • r.release
  • r.useVersion
  • r.useCranComments
  • r.useNewsMd
  • r.useGit
  • r.useGitHub
  • r.pkgdownBuildSite

@ManuelHentschel
Copy link
Member

I agree that these are useful functions to have available, but I'm not sure this is the best way to implement them. If I'm not mistaken, most (or all) of these commands are independent of the current R session and should therefore better be run in a separate process, not the user's R terminal. Furthermore, users might want to customize the specific commands being run by passing arguments to the functions called.

A more intuitive way to implement this behaviour would be the vscode tasks API, e.g. as follows:

{
  "type": "R",
  "code": [
    "devtools::install(quick=TRUE, upgrade=FALSE, keepSource=TRUE)"
  ],
  "group": "build",
  "problemMatcher": [],
  "label": "R: Install"
}

@jooyoungseo
Copy link
Contributor Author

Thanks for the suggestions. These commands that I am adding here require interactions. For example, devtools::release() asks a series of questions and users need to interactively and manually respond. Does task job allow these kinds of interactions?

@renkun-ken
Copy link
Member

Is there a criterion that determines which one goes into the list of commands while others don't?

@ManuelHentschel
Copy link
Member

Thanks for the suggestions. These commands that I am adding here require interactions. For example, devtools::release() asks a series of questions and users need to interactively and manually respond. Does task job allow these kinds of interactions?

In general, tasks can be interactive. To check this, you can try e.g. the following task definition (requires the github cli installed, but that can be replaced by any other interactive command).

{
  "type": "shell",
  "label": "test",
  "command": "gh repo create"
}

Implementing this for R commands could be a bit more difficult, since R usually goes into non-interactive mode if you call it using e.g. R -e ..., but should be possible.

@ManuelHentschel
Copy link
Member

@jooyoungseo I implemented a proof of concept for interactive R tasks in #1267. Please let me know if this works to run the tasks you have in mind.

@jooyoungseo
Copy link
Contributor Author

Thanks for the task implementation, @ManuelHentschel ! It looks good to me. However, we may want to keep devtools::dev_mode() in current R session following its design principle so that users can toggle on and off the dev_mode.

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.

None yet

3 participants