Skip to content

Use devtools::install() instead of pak - #13643

Merged
jennybc merged 2 commits into
mainfrom
devtools-install
May 22, 2026
Merged

jennybc merged 2 commits into
mainfrom
devtools-install

Conversation

@jennybc

@jennybc jennybc commented May 19, 2026 •

Copy link
Copy Markdown
Member

Closes #11875
Closes #1733

@:r-pkg-development

When working in an R package, the R: Install R Package and Restart R gesture now defaults to devtools::install(build = FALSE), instead of pak::local_install(upgrade = FALSE). The rationale for this switch is laid out in the issue.

This also affects the positron.r.localPackageInstallMethod configuration point, where devtools replaces pak.

Release Notes

New Features

  • R: Install R Package and Restart R now defaults to devtools::install(build = FALSE), instead of pak::local_install(upgrade = FALSE). The values of the positron.r.localPackageInstallMethod setting can now be "devtools" or "base".

Bug Fixes

  • N/A

Validation Steps

  • Open a workspace in Positron that is also an R package.
  • Make sure you've got devtools >= 2.5.2.
  • Make sure you don't have positron.r.localPackageInstallMethod configured in settings.json.
  • Do R: Install R Package and Restart R. In the terminal that fulfills this, you should see invocation of devtools::install(build = FALSE):
Executing task: '/Library/Frameworks/R.framework/Versions/4.5-arm64/Resources/bin/R' --quiet --no-restore --no-save -e 'devtools::install(build = FALSE)'

For discussion:

Should we put a minimum version on devtools, in order to get new, desirable behaviour of devtools::install()? It seems too strong a requirement and yet people will not have the experience we really want for them if they have older devtools.

It feels like the "devtools vs. base" question is bigger than just how to wire up R: Install R Package and Restart R. Are we going to deal with this more holistically? Recall that RStudio has a project-level setting for "Use devtools package functions if available".

Here are all the package dev commands:

Command Display name Backed by
r.packageLoad Load R Package devtools::load_all() — hardcoded
r.packageBuild Build R Package devtools::build() — hardcoded
r.packageInstall Install R Package and Restart R devtools::install(build = FALSE) or R CMD INSTALL — configurable (this PR)
r.packageTest Test R Package in Terminal devtools::test() — hardcoded (task)
r.packageTestExplorer Test R Package in Test Explorer runs testthat via test explorer, which also uses devtools/testthat
r.packageCheck Check R Package devtools::check() — hardcoded (task)
r.packageDocument Document R Package devtools::document() — hardcoded

Are we going to offer devtools vs base for others? In the abstract, it feels like we should. But here in reality it doesn't really make sense. Making this sort of thing clearcut and easier is precisely why devtools & friends exist! Only a couple of these even have a clearcut definition for a base implementation.

Related: the idea of making it possible for an advanced and opinionated user to take full control of these gestures: #3242.

@github-actions

github-actions Bot commented May 19, 2026 •

Copy link
Copy Markdown
Contributor

E2E Tests 🚀
This PR will run tests tagged with: @:critical @:r-pkg-development

readme  valid tags

@jennybc
jennybc marked this pull request as ready for review May 19, 2026 21:40
@jennybc
jennybc requested a review from juliasilge May 21, 2026 15:55
juliasilge
juliasilge previously approved these changes May 22, 2026

@juliasilge juliasilge left a comment •

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This is working great!

If someone happens to have explicitly put "positron.r.localPackageInstallMethod": "pak" in their settings (which would be weird, but possible), they have a good and appropriate experience. It uses the new default and they get this diagnostic if they go to settings.json to help them update:

Image

I do think we need to update some of the @:r-pkg-development tests and to run them here. It looks like the "R - Verify can open, test, check, install, and restart package" test needs some updates. No need for a further review once those tests are updated and passing!

Looking into the question of "how do I know devtools is available? how did we know pak was available before?" lead to me open #13721
@jennybc

jennybc commented May 22, 2026

Copy link
Copy Markdown
Member Author

I ran just the R package dev e2e tests via workflow dispatch: https://github.com/posit-dev/positron/actions/runs/26307201347/job/77446878272, which passed.

As they did in the larger e2e test run.

@jennybc
jennybc merged commit a991e89 into main May 22, 2026
27 checks passed
@jennybc
jennybc deleted the devtools-install branch May 22, 2026 19:50
@github-actions github-actions Bot locked and limited conversation to collaborators May 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Use devtools::install() for "R: Install R Package and Restart R" devtools::install() (CMD + SHIFT + B) and keep_sources problem

2 participants