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

Feat support py files via jupytext #328

Conversation

maartenbreddels
Copy link
Member

This partly solves #107 because jupytext works with jupyter server out of the box, so we can do:

$ jupytext --to py notebooks/basics.ipynb
$ jupyter server --ServerApp.token='' --ServerApp.open_browser=False
$ open http://localhost:8889/voila/render/notebooks/basics.py

And it just works.
For voila standalone support we just have to wait for #270 and get this for free.

If we don't want to wait for this we could add cmd line option to voila to force it to use jupytext, e.g.:

$ voila --VoilaApp.force_jupytext

Another option would be to support py files natively out of the box (I'll do a separate PR for that).

@@ -16,7 +16,7 @@
# if the directory above us contains the following paths, it means we are installed in dev mode (pip install -e .)
DEV_MODE = os.path.exists(os.path.join(ROOT, '../setup.py')) and os.path.exists(os.path.join(ROOT, '../share'))

notebook_path_regex = r'(.*\.ipynb)'
notebook_path_regex = r'(.*\.(?:ipynb|py))'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wondering if we could get support for other languages for free here (Julia, R and so on)?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Indeed, I've added julia in #330, because I could test it. I didn't feel comfortable adding more. I also wonder if we should have a .* regex?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This regex was added because voila could only handle .ipynb files.

But if scripts (in different languages) are going to be supported, it probably make sense to switch back to .*. Otherwise we would have to maintain a white list of supported extensions.

@maartenbreddels
Copy link
Member Author

My preference now is to rely on #330 (merge that PR, close this PR), and document that you can use jupytext instead.

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

Successfully merging this pull request may close these issues.

2 participants