-
Notifications
You must be signed in to change notification settings - Fork 92
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
Add a setting to specify default repositories #5547
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Leaving two comments this PR inspired. About to try this out locally.
const env = <Record<string, string>>{ | ||
'RUST_BACKTRACE': '1', | ||
'RUST_LOG': logLevelForeign + ',ark=' + logLevel, | ||
'R_HOME': rHomePath, | ||
...userEnv | ||
}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor observation: we are using a little interface for env vars elsewhere in positron-r (but I don't think this matters that much and I see this code pre-existed, it's just moving in this PR):
positron/extensions/positron-r/src/session.ts
Lines 30 to 32 in 1492e58
export interface EnvVar { | |
[key: string]: string; | |
} |
export async function prepCliEnvVars(session?: RSession): Promise<EnvVar> { |
positron/extensions/positron-r/src/session.ts
Line 927 in 1492e58
export async function getEnvVars(envVars: string[], session?: RSession): Promise<EnvVar[]> { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good observation! Indeed I didn't touch this (just moved it to keep the file from becoming too unwieldy) but that'd be an improvement.
"r.configuration.taskHyperlinks.description": "Turn on experimental support for hyperlinks in package development tasks", | ||
"r.configuration.defaultRepositories.description": "The default repositories to use for R package installation, if no repository is otherwise specified in R startup scripts (restart Positron to apply).\n\nThe default repositories will be set as the `repos` option in R.", | ||
"r.configuration.defaultRepositories.auto.description": "Automatically choose a default repository, or use a repos.conf file if it exists.", | ||
"r.configuration.defaultRepositories.rstudio.description": "Use the RStudio CRAN mirror (cran.rstudio.com)", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking this chance to have a side discussion:
In my .Rprofile
, I have
...
repos = c(
P3M = "https://p3m.dev/cran/latest",
CRAN = "https://cloud.r-project.org"
)
...
In terms of what we feature, is there a reason to push cran.rstudio.com over cloud.r-project.org? I guess I've implicitly preferred the latter from some super vague reasons around rstudio->posit rebrand and avoiding overt branding.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we necessarily want to push cran.rstudio.com (Posit also sponsors cloud.r-project.org
), I just used it to match ark's existing behavior. Might be worth providing a cloud.r-project.org
option too, let's see what folks say.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I played around with this, with an appropriate ark version, and all seems well. I can switch between the different enum values and I can also use a repos.conf
file with "auto".
This change adds a new setting that allows end users to select the default repository used in R sessions. Prior to the change, we always used
cran.rstudio.com
if no other repository was set; this remains the default, but now there are several other choices:For compatibility with shared RStudio configurations, the
auto
setting also checks for arepos.conf
file in well-known XDG locations. You can read more about the expected format of this file here: https://solutions.posit.co/envs-pkgs/rsw_defaults/#repos.confAddresses #5509
Note
This change depends on a change from
ark
(posit-dev/ark#645) and should not be merged until that change is.QA Notes
.Rprofile
orRprofile.site
.repos.conf
can be placed in~/Library/Preferences/positron/repos.conf
.