Hello all, sometimes I use Julia and Python notebooks in VS Code. I would like to have another extension like “notebook.ijl” to discriminate respect to the Python notebooks (.ipynb), and also respect to common “.jl” files.
Do you know any method from Julia or external (bash) to accomplish that?
Thank you very much in advance.
Jupyter nowadays supports over 100 programming languages, but they are all stored in the same format and processed by the same tools, so it makes sense to have a single file extension for all of them.
You can easily detect the language for any given .ipynb
file by parsing the JSON and looking for the language_info
field in the metadata
.
If you had to pick a language-specific file extension, I would use .py.ipynb
, .jl.ipynb
, etcetera. That way all of the tools will continue to work.
I use the Jupytext
extension. The extension allows you to use the language common files (.jl
, .py
, etc…) as they were notebooks. The metadata and cell separators are added to the files as comments in the written language. I sincerely prefer this way, as I can just run the Julia script to re-generate many plots and tables without needing to have Jupyter working (in case it breaks, or if I prefer putting the script in a Makefile for a paper, etc…).
Note that you can do this anyway with NBInclude,jl (which can also convert .ipynb
files to .jl
).
Yes, but keeping the notebooks as .jl
files also helps to see the diff in Git, so I still prefer keeping them as .jl
and making Jupyter to work with them, than keeping them as .ipynb
and making Julia able to call them.
Thank you for your reply and suggestions. Well, I see that the python ending in “.ipynb” is hard to avoid. Regards!
Thank you for your idea. I searched for Jupytext extension and it requires VS Code Insider version. Have you tried it in the stable VS Code version? Regards!
No? I am confused, Jupytext is a Jupyter extension, you run Jupyter inside VS Code? I do not use VS Code, I use Jupyter and Vim (separatedly).
According to this page, Jupytext extension is not supported in the stable version of VS Code. Thanks, I will check this periodically, in case it becomes supported.