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

voila.json file is not taken into account #1468

Closed
djangoliv opened this issue May 7, 2024 · 7 comments · Fixed by #1470
Closed

voila.json file is not taken into account #1468

djangoliv opened this issue May 7, 2024 · 7 comments · Fixed by #1470
Labels
bug Something isn't working

Comments

@djangoliv
Copy link
Contributor

The doc say:
The easiest way to change these settings is to provide a file named voila.json in the same folder containing the notebooks.

But I notice that it is especially necessary to launch "voila" from the directory containing the voila.json file.

If you have the directory $HOME/app which contains index.ipynb and voila.json:

cd $HOME/app
voila index.ipynb   # works

cd /tmp
voila $HOME/app/index/ipynb  # doesn't work (the config file is not taken into account)

therefore the documentation is false.
But, it would be better to correct the code so that the documentation becomes valid.
Even better, an option to indicate where the configuration file is located at launch.

Regards

@djangoliv djangoliv added the bug Something isn't working label May 7, 2024
@trungleduc
Copy link
Member

Thanks for reporting the issue. It's more of a documentation issue since the current behavior is consistent with other Jupyter applications.
A PR fixing this is very welcome!

@djangoliv
Copy link
Contributor Author

Thanks for your response @trungleduc .

I understand the point of view, but on the other hand I think it would really be better to consider the voila.json file if it is next to the notebook. It would allow

  • to have a complete directory representing an application (with its dependencies and its configuration)
    and more important:
  • to take into account the configuration in the case of the jupyterlab extension (jupyterlab-preview). Indeed, in the current state of affairs I don't see how to add a template (like flex or vuetify-default) when launching the extension.

Here a screenshot with @voila-dashboards/jupyterlab-preview (the voila.json is not taken into account)

image

Here the voila launch in the directory (the voila.json is taken into account)

image

@trungleduc
Copy link
Member

Hi @djangoliv, for the second point, I'm working on fixing #1397 in #1469 and supporting voila.json or voila.py in the preview extension is a by-product of this PR

@djangoliv
Copy link
Contributor Author

ok thank you very much for these links and information.

But, in this case, we are going to read the configuration file which is located near the notebook ?

@trungleduc
Copy link
Member

It will be the same behavior as voila, i.e. il will look for the config file in the current working directory and all jupyter paths

config_file_paths = [os.getcwd(), *jupyter_config_path()]

trungleduc pushed a commit that referenced this issue May 14, 2024
fix #1468

Co-authored-by: Olivier Giorgis <ogiorgis@logilab.fr>
@djangoliv
Copy link
Contributor Author

Thank you very much for all this time @trungleduc .

I still mention my use case which motivated me to open this issue to share.

I'm building a sort of app library.
Several examples accessible from the same instance of jupyterlab (each example in its dedicated directory).
Some of these examples depend on different templates (flex, voila-vuetify, ...) and/or different kernels.

Unfortunately, in the current state, I will not be able to keep a different configuration for each example in a simple way. I imagine I will have to overwrite the configuration file before running each example.

I will continue to look for a simple solution.

Regards

@trungleduc
Copy link
Member

Both template and kernel can be set in the notebook's metadata, and voila will read the config in each notebook, e.g. https://voila.readthedocs.io/en/stable/customize.html#controlling-the-nbconvert-template

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants