Great tool! Would be great for me and future generations to document the steps needed to add a new language.
Consider Scheme. There is a link to a live kernel here:
Details:
.ss; (often times we use two or more)Anything else one needs?
Thanks @dsblank , that's a very nice suggestion.
Well, I'm not sure the current organisation of the code is prepared for being documented... It has improved a lot with v0.6.0, but adding a new format still requires modifying the code at lots of places (latest example was Julia #56).
So I think that we should first refactor the code a bit further. There are already three more formats in the pipe, and the refactored code should allow an easier inclusion of those:
Org mode looks very interesting, and perhaps a nice way to combine jupyter notebooks and jupytext ideas in a scalable fashion.
Some other links regarding org mode and jupyter:
Hello @dsblank , I have been working on refactoring, and was able to add a new format (the double percent scripts #59). It now requires
BaseCellReader for reading cells from textBaseCellExporter for exporting cells to textformats.pyThe corresponding commit (that also includes a bit of noise, sorry) is https://github.com/mwouts/jupytext/commit/3f3a12b2a03461acd74798a736f13a06e5480831
Do you think that structure is sustainable? Would you recommend another organization? I feel recommendations on this could be very useful! Thanks.
I don't really have a feel for what this code is doing. Why does jupytext even need to be parsing the cell data? It seems that code cell data should be either sent directly to the kernel, or saved as-is in a section marked as "code cell".
@dsblank , I have just implemented the _double percent_ format for Python/Julia/R (#59). That format is interesting as it is almost language agnostic. Would you like an adaptation of that format for scheme (that's easy, I just need to replace the comment char # with the ;;...) ?
Two quick questions:
tests/notebooks directory ? (or, may I copy the Mandelbrot one?)jupytext comment the Jupyter magic commands in the resulting scheme script?The line comment per language seems like it would be something that the kernels should be able to identify. (I recommended this to jupyter core 4 years ago, but it wasn't adopted at that point).
The magics in Scheme are language agnostic: they come from Metakernel. (We could have metakernel identify the line comment character(s)).
https://github.com/Calysto/metakernel/blob/master/metakernel/magics/README.md
The current rules for Metakernel magics:
The Metakernel magics also provide the shell interaction.
The Mandelbot one is one of the most complicated, as it uses the full power of Metakernel. Feel free to use any of the notebooks from our repos. Perhaps a better representative notebook would be:
FYI, perhaps the most popular Metakernel languages are octave and matlab:
Hello @dsblank , the branch v0.7.2 has support for scheme! The resulting scripts are here (percent format, which you can open with Hydrogen) and here (light format, which has fewer explicit cell markers).
Would you like to test this and provide feedback? Currently I have implemented the support for just one comment character per script extension - for scheme I have choosen ;;. Do you think that is good enough? Would you prefer just ; ?
By the way - extending the light and percent formats for more file extensions is easier than ever before:
_SCRIPT_EXTENSIONS in languages.pytests\notebooks\ipynb_[language]test_mirror.py: one for the light format, one for the percent format... ... Which file extension do you want to do next ? 馃槃
Very cool! I will test this out!
@dsblank , I will soon review the treatment of magics in Jupytext (and possibly make it simpler, cf. #94). May I ask you two questions?
A brief documentation on how to extend the light and percent format is available in the readme in version 0.8.0. Scheme and C++ are supported already!
Well, I just noticed with #97 that the 'mirror' test was not covering properly the round trip conversion. This has been fixed in v0.8.1 which is thus the first version with proper support for C++ and Scheme.