fonsp / Pluto.jl

🎈 Simple reactive notebooks for Julia
https://plutojl.org/
MIT License
4.91k stars 284 forks source link

Feature Request: Import/Export Jupyter Notebooks (.ipynb) into Pluto Notebooks #2850

Closed vivekkiran closed 3 months ago

vivekkiran commented 3 months ago

Problem Statement: Many users within the scientific computing community rely on Jupyter Notebooks for their work. The inability to directly import existing Jupyter Notebooks (.ipynb files) into Pluto Notebooks hinders the exploration of Pluto's unique reactivity and interactivity. Users are forced to manually recreate their work or forgo using Pluto altogether, limiting experimentation, adoption, and collaboration opportunities.

Proposed Solution: Implement a feature to allow the direct import of Jupyter Notebook (.ipynb) files into Pluto Notebooks.

Ideally, the import process would:

Alternatives: External conversion tools exist but are often unreliable and don't fully capture Pluto's reactive nature. Some online tools attempt Jupyter to Pluto conversion, but they're often unreliable and don't handle the reactive nature of Pluto correctly. Manual re-creation: This is incredibly time-consuming and prone to errors.

Additional Context: Enabling the import of Jupyter Notebooks would significantly benefit the Pluto Notebook community: Lower Barrier to Entry: Scientists and developers with existing Jupyter Notebooks could easily evaluate Pluto's advantages saving days/weeks of potential rework.

Streamlined Collaboration: Teams could more easily mix and match both Jupyter and Pluto Notebooks, depending on their specific task and preferences.

Acknowledgement: I understand this feature may pose technical challenges due to the underlying differences between Jupyter and Pluto. Nonetheless, even a partial import/export solution that handles basic code conversion would be a tremendous step forward.

ctrekker commented 3 months ago

Something like this would undoubtedly be very valuable, but it should go in its own package. Things like converting Markdown cells andn integrating PythonCall / RCall are pretty much already done and should work in Pluto already. Addressing cell dependencies is the hard part - for example, what should we do with the following Jupyter notebook? Cell 1:

x = [1]

Cell 2:

last(x)

Cell 3:

push!(x, 2)

This a highly simplified example, but in general it's not immediately obvious how this code should be translated into a reactive environment. In many cases a conversion process that guarentees a topological ordering that reproduces the original ordering of Jupyter notebooks would produce a converted Pluto notebook that isn't so useful (all code in only a few cells, for example). There are absolutely ways to do it, but it's complicated and certainly belongs in its own package that uses something like PlutoDependencyExplorer.