Jump to content

GSoC/2019/StatusReports/NikitaSirgienko

From KDE Community Wiki

Implement the import/export of Jupyter notebooks in Cantor

Cantor is a KDE application providing a graphical interface to different open-source computer algebra systems and programming languages, like Octave, Maxima, Julia, Python etc. The main idea of this application is to provide one single, common and user-friendly interface for different systems instead of providing different GUIs for different systems. There is another project following this idea - the project “Jupyter”. As a result of its very big popularity, user base and the community around this project, there is a lot of content available for this project created and contributed by users from different scientific and educational areas.

At the moment, Cantor has its own format for projects. Though this format is good enough to manage Cantor projects, there is not a lot of content created and published by Cantor users. Furthermore, sharing of the content stored in Cantor’s native format requires the availability of Cantor on the target system, which is available for linux only at the moment. This all complicates the attempts to make Cantor more popular and known to a broader user base.

The goal of this project is add possibility to read and write Jupyter notebooks files (.ipynb) to Cantor, because it will addresses the problems described above.

Project mentor: Alexander Semke

Summary

Done

  1. the scope for mandatory features described in the project proposal was fully realized
  2. the biggest part of optional features was finalized
  3. some other new features were added to Cantor which were needed for the realization of the project like new result types, the supported for embedded mathematical expressions and attachments in Markdown Cells, etc.
  4. the new implementation was tested and considered stable enough to be merged into master and we plan to release this with Cantor 19.12
  5. new dedicated tests were written to cover the new code and to avoid regressions in future, the testing framework was extended to handle project load and save steps

Problems and Limitations

  1. for Markdown entries containing text with images where certain alignment properties were set or after image size manipulations, the visualization of the content is not always correct which is potentially a bug in Qt
  2. because of small difference in syntax between MathJax used in Jupyter notebooks and Latex used for the actual rendering in Cantor, the rendering of embedded mathematical expressions is not always successful. At the moment Cantor shows an error message in such cases, but this message is often not very clear and helpful for the user
  3. Qt classes, without involving the full web-engine, as used by Cantor provide only a limited and basic support for HTML. More complex cases like embedded Youtube video and JavaScript don’t work at all.

Project log

Community bonding period

Planning of realization this feature (on paper), reading Jupyter and Qt documentation, collecting Jupyter notebooks for tests purpose.

Blog post about collected notebooks.

June 1 - June 21

Writing first iteration of the feature. On June 21 minimum plan realized: Cantor users can open Jupyter notebooks as easy as own Cantor format (.cws), edit them and save them as notebooks or as cantor worksheets. But converting is lossy sometimes, some Jupyter notebooks could loose some information after editing, for example Jupyter kernel metainformation (this is maximum plan - make the converting lossless).

Blog post about this period.

June 22 - July 10

Writing second iteration of the feature. This iteration have been solving different problems, which weren't handeled by the first iteration and also on this iteration I have been adding support for more rarely Jupyter features (widely used features have been handeled by first iteration). I also have writed test system for bug finding and regression avoiding.

Blog post about this period.

July 10 - July 22

Adding more support for quite rarely used Jupyter features and solving problems with Markdown embedded math (math rendering performance and math searching).

Blog post about this period.

July 22 - Aug 2

Different fixes and refactoring of the code. Preparing feature branch to merging into master. Also, a big testing (70 notebooks) for garantee, that the feature is finalized and worked as expected.

Aug 2 - Aug 19

Continue refactoring and bug fixing, but on master branch and not only for this feature, because I have time for this.

Aug 19 - Aug 23

Writing blog about the period (July 22 - Aug 19) and summarize all done works for this project.

Blog post about this period and more

Links

  1. Blog
  2. Project Proposal
  3. Feature branch (already merge to master)
  4. My commits in Cantor repository