-
-
Notifications
You must be signed in to change notification settings - Fork 769
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
Global R upgrade breaks pre-commit #3206
Comments
the fix for this would be to implement |
I saw that in |
Problem is that the virtual environment is hard to access for the end user, so if pre-commit just ran a |
Also, how to determine the environment is broken? Can we record the R version when the environment is installed and then check it's the same in |
if an environment is unhealthy pre-commit will automatically rebuild it without user intervention |
the approach the python one takes is how I'd do it for r |
search you tried in the issue tracker
break class update / 2, second upgrade
describe your issue
R is currently implemented as a second class language, i.e. global interpreter required but packages are bootstrapped by pre-commit in virtual environment with {renv}. R packages are installed for a minor version, e.g. R 4.3 and R is not referenced version-specific on the
$PATH
usually. Hence, updating R means you have to install all these packages again, otherwise your code just won't work (asR
on the$PATH
now points to the updated R version). However, pre-commit does not know you just updated R and will fail (unless you already used {renv} to update all required dependencies (e.g. for another project) and have not opted out of the {renv} cache). Currently, the clean solution seems to runpre-commit clean
(for all hooks since #2338 got rejected). I wonder if other second class languages have similar characteristics. Can pre-commit recognise that the global R version changed and then just re-install that specific environment or at least give helpful error messages?Downstream reference: lorenzwalthert/precommit#567
pre-commit --version
pre-commit 3.3.3
.pre-commit-config.yaml
~/.cache/pre-commit/pre-commit.log (if present)
spell-check..............................................................Failed
ℹ Using R 4.4.0 (lockfile was generated with R 4.3.3)
ℹ Using R 4.4.0 (lockfile was generated with R 4.3.3)
Error in loadNamespace(x) : there is no package called ‘precommit’
Calls: loadNamespace -> withRestarts -> withOneRestart -> doWithOneRestart
Execution halted
The text was updated successfully, but these errors were encountered: