top | item 17950230

Jupytext: Jupyter notebooks as Python scripts

151 points| JA7Cal | 7 years ago |github.com | reply

41 comments

order
[+] Grumbledour|7 years ago|reply
This seems neat, but also a bit strange. Are Jupyter notebooks so prevalent that it makes sense to ghave an exporter that makes them into markdown and back again? I mean, I always thought this workflow was neat, but isn't one of the selling points of jupyter the WYSIWYG Interface? And if you like working in code, would it not be easier to create a markdown extension for embedded code (Or does something like this already exist?) and create editor plugins or command line tools to render said document or provide a live preview?

Personally, I totally want that functionality but don't want to mess with running jupyter kernels or using my browser to work in my notebook. So where is my markdown with embedded code WYSIWYG editor that saves into plain text files? ;-)

[+] stochastic_monk|7 years ago|reply
As an academic, ipython notebooks are becoming the lingua franca of reproducible research. I don’t like it or them, but they’re excellent for didactic purposes. Extracting the code from the markdown is very helpful for me, as I prefer working directly with it most of the time.
[+] mic47|7 years ago|reply
1 thing. Code review. Even thou notebooks are not meant for production code, it's good to check them into repository to document what you did (let's ignore out of order computation and other horrors), and get feedback on your code / experiment.

Right now, ipython notebook is stored as json, where code is list of json strings (so that you have it line by line).

Additionally, the "WYSIWYG Interface" is horrible in comparison to vim, emacs, idea, pycharm or whatever you are using. What I like about notebooks is being able to present things as experiment: this is the code, and there are the outputs. "WYSIWYG Interface" is good if you want to tweak few things, or if you are starting out.

[+] dec0dedab0de|7 years ago|reply
The Python script can be opened with PyCharm

This is going to be a bit pedantic, but for anyone that doesn't realize. Pycharm can already open ipynb files, and it will connect to a running notebook. I don't do it very often, usually just to quickly find my way around some library code.

This project looks great though. I will likely use it, as I tend to use Jupyter to work out code before copying it over to my main project.

[+] Seanny123|7 years ago|reply
In my personal experience, PyCharm really mangles Jupyter Notebooks. Has it gotten to better recently?
[+] thomasfedb|7 years ago|reply
This is really cool stuff. Editing notebooks in the browser is pretty good, but it can't (yet) match the experience of a well configured (and extended) text editor.
[+] hcrisp|7 years ago|reply
Could this be the answer to "I don't like notebooks" [0]? Or does calling scripts from within a notebook still do horrible things to the managed state?

[0] https://news.ycombinator.com/item?id=17856700

[+] zimablue|7 years ago|reply
I've never thought this criticism was that relevant. Notebooks have been incredibly successful, and if it's possible to call your code in the wrong order and create a mess, it's probably a problem with your code not your coding environment. The more functional your code, the less of a problem jupyter notebooks are. They encourage better code not worse imo.
[+] misnome|7 years ago|reply
I think this partially matches the parts of the criticism about writing a book, and how the notebook is unsuitable - mainly thinking along similar lines to writing software tutorials pages that are fully testable.

After seeing that post I had a look around for something a little like this and found Pweave http://mpastell.com/pweave/ which seems to approach the problem from the inverse direction direction, but I think I'd rather have something like this where the code is marked up and runnable as normal code but transformable into formatted documentation.

This seems like a reasonable match, but it looks like it's explicitly tied to notebooks and I'm not completely sold on the overloading of plain comments for markup purposes. Still, probably a good step.

[+] enriquto|7 years ago|reply
This is fantastic!

Now, they just need to adapt jupyter itself so that it reads the python files directly, dispensing with the need of the silly ipynb!

[+] dfee|7 years ago|reply
I think that’s called IPython. But I agree with your sentiment.
[+] kankroc|7 years ago|reply
Can someone provide me a usecase for this when compared to executing jupyter straight into VSCode/Atom with vscodeJupyter/Hydrogen?
[+] enriquto|7 years ago|reply
The idea is that you can edit your notebooks with your favorite text editor, use git for version tracking them, and no need to mess with a web browser at all.
[+] xaedes|7 years ago|reply
I really like the markdown conversion! This should make it easy to import ipynb notebooks into markdown based documentations.