Skip to content

Add option for r.packageInstall that does not use pak - #11431

Merged
juliasilge merged 6 commits into
mainfrom
option-to-turn-off-pak-for-install
Jan 27, 2026
Merged

juliasilge merged 6 commits into
mainfrom
option-to-turn-off-pak-for-install

Conversation

@juliasilge

@juliasilge juliasilge commented Jan 18, 2026 •

Copy link
Copy Markdown
Member

Addresses #2955.

This PR adds a new setting positron.r.localPackageInstallMethod that allows users to opt out of using pak for local package installation. When switched from the default, the command uses R CMD INSTALL --preclean --no-multiarch --with-keep.source . instead of pak::local_install(upgrade = FALSE).

The setting defaults to using pak, but users who have experienced issues with pak can now switch to the base R approach.

Release Notes

New Features

Bug Fixes

  • N/A

QA Notes

@:r-pkg-development
@:ark

  1. Open an R package project
  2. With default settings, when you run "Install R Package and Restart R" (Cmd+Shift+B), it should use pak
  3. Set positron.r.localPackageInstallMethod to "base" in settings
  4. Run the install command again, and it should show R CMD INSTALL output in terminal
  5. Verify R session restarts and package is loaded in both cases

@github-actions

github-actions Bot commented Jan 18, 2026 •

Copy link
Copy Markdown
Contributor

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

readme  valid tags

Comment thread extensions/positron-r/src/tasks.ts Outdated
envVars: { ... await prepCliEnvVars() }
},
{
useBaseR ? {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

If we add a lot of conditional logic here for the tasks in the future, we might want to re-organize how these are set up. I think probably better to keep it as is now?

Comment thread extensions/positron-r/package.nls.json Resolved
await app.workbench.console.waitForConsoleContents('"testfun"');
});

await test.step('Install R Package with base R and Restart R', async () => {

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This test does not actually test that the R CMD check approach is used because the text in the terminal flashes too quickly as noted above in the previous test. I think it's still worth testing that this runs without error.

@jennybc

jennybc commented Jan 19, 2026

Copy link
Copy Markdown
Member

I know this is still a draft, but I caught wind of it in my notifications and thought I'd throw this out there: this might be a good place for a more enum-like approach than a TRUE/FALSE. Basically for the reasons outlined in the link, but also that it allows the specification to be "base" or "pak" instead of "base" and "not base".

https://design.tidyverse.org/boolean-strategies.html

@juliasilge

Copy link
Copy Markdown
Member Author

@jennybc What do you think about my questions about whether to plan for this setting to only apply to r.packageInstall vs. planning for this setting to also apply to the check and test commands, in the future? If we plan to use that setting to eventually choose non-devtools, base R options for r.packageTest and r.packageCheck, what would you recommend for the enum? Something like "base" and... what?

@jennybc

jennybc commented Jan 19, 2026

Copy link
Copy Markdown
Member

I think it's fine to start with r.packageInstall and base vs. pak, since that's the only package dev move where we've really gotten feedback about this.

@juliasilge

juliasilge commented Jan 19, 2026 •

Copy link
Copy Markdown
Member Author

Unfortunately, changing an enum would be quite difficult in terms of not breaking how folks' have configured their settings, so we're likely to need to make a new second setting in that case. Which of these do you think is better in the long term?

  • Use a boolean, and extend to base R implementation for r.packageTest and r.packageCheck in the future
  • Use an enum that is "base" vs. "pak", and make a new, second setting that is "base" vs. "devtools" in the future (in which case this setting would need to be something more specific like positron.r.useBaseRForLocalPackageDevInstall or similar)
  • use an enum that is "base" vs. something else that encompasses both what we have now and what we'll likely need to do in the future (not sure what the best string would be here)

I am thinking that a true boolean is probably a better move here, given the constraints.

@jennybc

jennybc commented Jan 19, 2026

Copy link
Copy Markdown
Member

I think I was implicitly assuming the config point would be positron.r.packageInstall with values "base" or "pak".

@juliasilge
juliasilge marked this pull request as ready for review January 22, 2026 16:12
@juliasilge

Copy link
Copy Markdown
Member Author

I updated to making this setting only apply to that local package install command:

Screenshot 2026-01-22 at 9 12 24 AM

Given that this is the command that seems to have caused folks problems, I agree that it makes sense to have a separate setting just for this. I think it's likely there are many folks who need/want to use R CMD INSTALL here but still want to use devtools for the other package dev tasks.

@jennybc

jennybc commented Jan 26, 2026

Copy link
Copy Markdown
Member

As discussed in Slack, I've pushed some ideas to discuss and will now make a few comments on what I did.

);
}

type InstallMethod = 'pak' | 'base';

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.

We can't easily make this a true enum, i.e. read from the values declared in package.json.

But I like the idea of leaning harder into this being a enum.


type InstallMethod = 'pak' | 'base';

function getPackageInstallTask(installMethod: InstallMethod) {

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.

Just moved the "make the task data conditionally" dance into its own little helper.

Comment on lines +116 to +117
? data.shellArgs
: ['--quiet', '--no-restore', '--no-save', '-e', { value: data.rcode, quoting: vscode.ShellQuoting.Strong }];

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.

(Re-)unified package install task with its buddies, so that the rmarkdown render task on Windows remains the only special case.

"r.configuration.symbols.includeAssignmentsInBlocks.description": "Controls whether assigned objects inside `{}` blocks are included as document symbols, in addition to top-level assignments. Reopen files or restart the server for the setting to take effect.",
"r.configuration.workspaceSymbols.includeCommentSections.description": "Controls whether comment sections like `# My section ---` are included as workspace symbols.",
"r.configuration.autoConvertFilePaths.description": "Automatically convert file paths when pasting files from file manager into R scripts. Converts backslashes (\\) to forward slashes (/), adds quotes, and formats multiple files as R vectors.",
"r.configuration.localPackageInstallMethod.description": "How to install the local R package project. When set to `pak`, uses `pak::local_install()`. When set to `base`, uses `R CMD INSTALL`.",

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 name feels more like an enum (vs. a boolean). Also tweaked the description.

@juliasilge

Copy link
Copy Markdown
Member Author

Thanks so much!

@juliasilge
juliasilge merged commit 91ce8b6 into main Jan 27, 2026
@juliasilge
juliasilge deleted the option-to-turn-off-pak-for-install branch January 27, 2026 03:13
@github-actions github-actions Bot locked and limited conversation to collaborators Jan 27, 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.

2 participants