JuliaInterop / JuliaCall

Embed Julia in R
https://non-contradiction.github.io/JuliaCall/index.html
Other
269 stars 35 forks source link

Update / remove usage of opts_current$set as it errors with knitr 1.44 and breaks using JuliaCall with plots #209

Closed cderv closed 1 hour ago

cderv commented 1 year ago

Hi,

TL;DR

knitr 1.44 has a change that make JuliaCall throw an error and not work when there is plots. An update should be done so that JuliaCall does correctly call knitr internal feature.

Details

It seems you are using opts_current$set for one feature https://github.com/Non-Contradiction/JuliaCall/blob/c05473bea78a0197c639f7e82ab1c6f2e943e1cc/R/RMarkdown.R#L56C1-L60

opts_current was always an object maint to be read-only - in knitr 1.44 it was enforce by throwing an error. This was announced in https://yihui.org/en/2023/09/knitr-1-44/

Since it seems it was in fact really used by some package author, there is a mechanism to unlock the environment and allow modification. This aims to be an escape hatch until package author can implement there feature without this opts_current$set This is described in the blog post.

I'll try to do a PR with at least the escape hatch, but possibly it would be good later on to change the usage.

Related discussion

cderv commented 1 year ago

Update on this: With next knitr 1.45, there should not be an error anymore with it as we whitelisted JuliaCall temporarily waiting for #210 to be dealt with.