fonsp/PlutoUtils.jl

Export to a clean .jl file

Samyak2 opened this issue ยท 9 comments

Pluto notebooks are already .jl files, but they have comments that may seem foreign to those who haven't used Pluto.jl.

A script to export Pluto notebooks to clean .jl files would be useful in sharing these with other people or platforms (outside of VCS).

(I had the need for a clean jl file while doing the Julia exercises at Exercism)

I want to work on this issue, but I have no idea how to start xD.

Do I wait for the notebook conversion scripts to be added before working on this?

Great that you're willing to share your learnings ๐Ÿ‘

Comments & guids are placeholders needed by Pluto to keep track of code. If by "clean" .jl files means removing comments it would be basically be square one for loading back into Pluto if thats needed later, losing the benefits it provides.

Since you brought it up, notebook conversion is a more common usecase, which might interest you.

Also, no need to wait for anything, just share the pull request

fonsp commented

@shashankp You mixed up the two repositories

fixed it ๐Ÿ˜…

@shashankp you're right, it would lose all benefits of Pluto and the only usecase I have for now is Exercism (which I linked in the original comment).

I wasn't sure how to structure the code since there's no script in the repo yet (the jupyter conversion script is in TODO) to get ideas from/base it on.

Since .ipynb is essentially json, you could create a new script, include JSON.jl parse .ipynb to extract code snippets and write it to a .jl file.

fonsp commented

@Samyak2 you're right, if you wait a little for the other scripts, you will have a better sense of what the code should look like.