yihui / knitr

A general-purpose tool for dynamic report generation in R
https://yihui.org/knitr/
2.36k stars 873 forks source link

R minimum version update regarding `evaluate` dependency #2351

Open ygeunkim opened 2 weeks ago

ygeunkim commented 2 weeks ago

Hello,

The current minimum R version of knitr is R (>= 3.3.0). However, I noticed that the evaluate package imported by knitr requires R ( >=4.0.0) as of its latest version (0.24.0). Is there any plan to update the minimum R version requirement to ensure compatibility with the latest version, even though knitr does not yet use the new feature of evaluate v0.24.0?


By filing an issue to this repo, I promise that

I understand that my issue may be closed if I don't fulfill my promises.

cderv commented 2 weeks ago

Sure we can update the requirement I believe.

I am curious: Is this just feedback based on noticing evaluate change or does this difference in requirement creates some "bad" situations somewhere ?

Just for my knowledge to be more aware of those changes in the future.

Thanks

ygeunkim commented 2 weeks ago

@cderv I encountered this issue when running package check actions for 3.6 on Windows. My package imports knitr but uses R minimum version 3.6.

Version notation does not make things impossible, but I think documenting the version update might be good for package developers. If it is updated, packages depending on knitr can update the information accordingly.

Thanks!

ygeunkim commented 2 weeks ago

I checked my package metadata again, and found that I was using knitr as Suggests. So I think _R_CHECK_FORCE_SUGGESTS_: false can fix my specific issue. Alternatively, I could handle my GitHub check issue by adding an environment variable for the evaluate package version as follows.

- name: Determine evaluate package version on Windows
  if: runner.os == 'Windows'
  run: |
    if ($Env:MATRIX_CONFIG_R -lt "4.0.0") {
      echo "EVALUATE_PKG=evaluate@0.23" >> $Env:GITHUB_ENV
    } else {
      echo "EVALUATE_PKG=evaluate" >> $Env:GITHUB_ENV
    }
  shell: pwsh

- name: Determine evaluate package version on non-Windows
  if: runner.os != 'Windows'
  run: |
    if [ "${{ matrix.config.r }}" \< "4.0.0" ]; then
      echo "EVALUATE_PKG=evaluate@0.23" >> $GITHUB_ENV
    else
      echo "EVALUATE_PKG=evaluate" >> $GITHUB_ENV
     fi
  shell: bash

- uses: r-lib/actions/setup-r-dependencies@v2
  with:
    extra-packages: any::rcmdcheck, ${{ env.EVALUATE_PKG }}
    needs: check

Thanks!

cderv commented 2 weeks ago

I'll reopen because it would probably be good for us to update the requirement as evaluate is a hard dependency of knitr.

For your usage of checks in CI for you package, here is what we do https://github.com/yihui/knitr/blob/e1edd34f4149d996efce5cf539e781eda6e3b86a/.github/workflows/R-CMD-check.yaml#L73-L77

As you can see we use a specific notation supported by pak package so that it will install a dependency only when some R version is used. We did that because some of our suggest dependencies were already depending on R 4.0.0 at the time, while knitr was still testing on 3.6.

This could help maybe.

Anyhow, thanks for the feedback