Open jkrumbiegel opened 3 months ago
For the context, currently those files are claimed by Jupyter engine https://github.com/quarto-dev/quarto-cli/blob/d5edb79404188308630370617c8d7a3f14d2de33/src/execute/jupyter/jupyter.ts#L148-L151
and Julia claims no file https://github.com/quarto-dev/quarto-cli/blob/d5edb79404188308630370617c8d7a3f14d2de33/src/execute/julia.ts#L66
This is probably not clear in our doc, but as of now when using script as input to render, the engine
option in those file is not used and this is too late - the file has already been claimed by an engine.
Does Julia engine support same Percent script syntax from Jupytext ? https://jupytext.readthedocs.io/en/latest/formats-scripts.html
Currently, we do detect .py and check if it has percent syntax. If so, Jupyter engine claims it.
If the same file could also be working for Julia engine, I think we should indeed parse the file header and detect the engine: julia
specification t know which engine is claiming the file
I did not add any claimsFile
as the assumption was that the previous behavior with the jupyter backend should not be impacted. Otherwise I would've claimed normal julia codeblocks in a .qmd file as well.
Does Julia engine support same Percent script syntax from Jupytext
Yes, we do have support for that style
Thanks for the confirmation.
When we added Jupyter Percent Script support, we only associated it with the Jupyter engine, no matter is content.
So, we definitely need to adapt the claimFiles
for Jupyter so that the Julia engine can also claim the .jl
script.
I would say
.jl
file should be claimed by Julia engineengine: julia
is set in the field as we do for .qmd document. For comparaison, engine: knitr
does not support the same syntax of percent script. So any .R
file with Percent script syntax will be claimed by Jupyter and not knitr engine.
Thanks for the report !
one question, when you process such a script file, what does target.markdown
contain in the end? A markdown transformation or the original script? Or would that not be set at all in that case, because the source is not markdown
Yes it will contain a markdown transformation. We process the script in Quarto to create a Markdown version
It happens in this function https://github.com/quarto-dev/quarto-cli/blob/68cc8cb80d712022439e6460e81f31fe9c5be697/src/execute/jupyter/percent.ts#L33-L90
that we call in our jupyter engine functions producing markdown
markdownForFile
function
https://github.com/quarto-dev/quarto-cli/blob/68cc8cb80d712022439e6460e81f31fe9c5be697/src/execute/jupyter/jupyter.ts#L157-L169partitionedMarkdown
https://github.com/quarto-dev/quarto-cli/blob/68cc8cb80d712022439e6460e81f31fe9c5be697/src/execute/jupyter/jupyter.ts#L225-L233
Bug description
It appears that julia script files do not get sent to the julia engine even if specifying
engine: julia
in the frontmatter. Instead, they are run by the jupyter engine.Steps to reproduce
I tried
quarto render testfile.jl
wheretestfile.jl
had this content:Expected behavior
Julia engine would try to render this file
Actual behavior
Jupyter engine rendered the file.
Your environment
No response
Quarto check output