To set a custom voila template, there are two options:
use the voila_configuration args:
voila --template=my-template
set the name of the template in the notebook metadata:
{
"voila" : {
"template" : "my_template"
}
}
However, I have found that when I set the template in the notebook metadata, the template_dirs variable doesn't take these changes into account, instead, it uses the voila_configuration args, which causes the start method diverges because it ends up using two different paths.
Apparently, this bug mainly affects the static_paths, causing 404 errors in templates that uses them. I suspect it might also cause other, less noticible issues.
Reproduce
create a simple notebook and set any other default template, for example: classic.
Second log, (which is created by nbconvert and reads the notebook):
Expected behavior
The template should work when it is set in the notebook metadata.
Solution
If there's no time to address this error, I could open a PR but I would need some guidance, I think we could read the notebook in the setup_template_dirs (as a json file) and use the template name?
Description
To set a custom
voila
template, there are two options:voila_configuration
args:voila --template=my-template
However, I have found that when I set the template in the notebook metadata, the
template_dirs
variable doesn't take these changes into account, instead, it uses thevoila_configuration
args, which causes thestart
method diverges because it ends up using two different paths.see (https://github.com/voila-dashboards/voila/blob/7596c4f930caf4fc2d89ba63b1096046adf9fe0e/voila/app.py#L541)
Apparently, this bug mainly affects the
static_paths
, causing 404 errors in templates that uses them. I suspect it might also cause other, less noticible issues.Reproduce
classic
.voila --debug test.ipynb
First log shows "using![image](https://github.com/voila-dashboards/voila/assets/12363250/93e7826c-4121-424b-a833-be5ce046a156)
lab
template)Second log, (which is created by nbconvert and reads the notebook):
Expected behavior
The template should work when it is set in the notebook metadata.
Solution
If there's no time to address this error, I could open a PR but I would need some guidance, I think we could read the notebook in the
setup_template_dirs
(as a json file) and use the template name?