Skip to content
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

ninja does not reset _variables.yml when switching back to e.g Python build #146

Open
matthew-brett opened this issue Oct 13, 2023 · 2 comments

Comments

@matthew-brett
Copy link
Member

I often find myself building the Python page, then building the R page, and then going back to the Python page. The profile and variable config stuff works correctly for the initial Python page build, then switching to the R build, but the switching script does not get called when switching back from the R to the Python build (I assume the same is true the other way round).

So let's say I start with:

make ninja-config
cd source

The initial build works fine:

$ ninja ../python-book/significance.html
[25/34] ../scripts/set_version.py --output=_quarto-python.yml python
Writing configuration to _quarto-python.yml...
Writing _variables.yml...
...
[34/34] quarto render significance.Rmd --no-clean --to html --profile python

All good. Switching to the R build also works fine - including the Writing configuration ... stuff to switch versions:

$ ninja ../r-book/significance.html
[1/2] ../scripts/set_version.py --output=_quarto-r.yml r
Writing configuration to _quarto-r.yml...
Writing _variables.yml...
[1/2] quarto render significance.Rmd --no-clean --to html --profile r

So far, no problem. But now, if I switch back to the Python page build:

$ touch significance.Rmd 
$ ninja ../python-book/significance.html
[1/1] quarto render significance.Rmd --no-clean --to html --profile python

Notice there is no Writing configuration ... step here - so the resulting built page uses the R variables written into _variables.yml, and because of that, the _common.R utilities will assume this is an R build, and filter out the Python blocks instead of the R blocks.

I can work round this by running:

../scripts/set_version.py --output=_quarto-python.yml python

manually, but it would be good not to have to do that. Any insights?

@stefanv
Copy link
Collaborator

stefanv commented Aug 18, 2024

@stefanv
Copy link
Collaborator

stefanv commented Aug 18, 2024

We can consider switching to meta, and putting the variables directly in the _quarto.yml?

https://quarto.org/docs/authoring/variables.html#meta

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants