Live data from Hacker News

Jupytext: Jupyter notebooks as Python scripts

github.com

31–40 of 42 posts

Re: Jupytext: Jupyter notebooks as Python scripts

#31

Earlier quoted context omitted.

I was not being ironic. Notebooks are lovely as an output format for showing your research and allowing others to fiddle with your code. However, for people who do not want to edit inside a web browser window, jupytext is a godsend!

At that point you should put most of your work in a separate file, and just import the stuff you need for your demo.

In such a use case, the whole point is showing your work in a 'literate programming' manner i.e. having the appropriate code that's being run be right there between the descriptive text, instead of just running do_something() that you imported from somewhere.

Re: Jupytext: Jupyter notebooks as Python scripts

#32

Earlier quoted context omitted.

I'm sure notebooks are used a lot for interactive exploration, but I would not use them for reproducible research, so long as they lack things like dependency tracking: https://twitter.com/joelgrus/status/1033035196428378113

The bar in academia (over-generalizing here) was so low for so long that anything around including your code with your publication still gets placed under the historical title of "reproducibility" - that's probably where the confusion here is arising. I agree with your sentiment, but grandparent probably just meant "a lot of people release their code as notebooks".

It’s a step, but you’re both right. Things that containerize notebooks would count as reproducible, but they’re unwieldy and disgusting. I agree that while better than nothing they’re still not there.

Re: Jupytext: Jupyter notebooks as Python scripts

#34

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 pr…

In my personal experience, PyCharm really mangles Jupyter Notebooks. Has it gotten to better recently?

Re: Jupytext: Jupyter notebooks as Python scripts

#35
This is neat. If you are looking for something a bit simpler: put your code in a python package, install it, and then use %autoreload

You can now develop in your favorite editor, and changes are automatically reloaded.

More detail here: https://blog.godatadriven.com/write-less-terrible-notebook-c...

Re: Jupytext: Jupyter notebooks as Python scripts

#36

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 pr…

In my personal experience, PyCharm really mangles Jupyter Notebooks. Has it gotten to better recently?

I have not experienced much mangeling, but the newest CE edition still doesn't do notebooks very well IMO. to the point where I use jupyter-lab for my notebooks/prototypes and pycahrm for packages.

Re: Jupytext: Jupyter notebooks as Python scripts

#37
post #7

Earlier quoted context omitted.

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.

The "managed state" is important, though. For example I deal with cases where I'm doing some big expensive operations upfront (eg, processing a bunch of data coming in over a network share— ROS bag files, which are also bzipped, adding more upfront processing cost), and I'm interesting in tweaking the plots and analysis coming out the other end without having to re-run the processing each time. Even as a relatively e…

That sounds really weird. The only time I noticed such weirdness was when a colleague and me were simultaneously editing a notebook on Google Colab. The code was shared but not the state, super weird...

Re: Jupytext: Jupyter notebooks as Python scripts

#39
post #11

Earlier quoted context omitted.

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 comp…

I think you misunderstood me. My question was not why you would use an external editor (and get all the benefits you provided), but rather, why work back from jupyter to achieve this rather than working forward from simple markdown and allow code blocks to be embedded and run from the editor. But maybe I am missing some other features than the interface that the ipython kernel provides? I haven't used it much myself,…

I would prefer to use editor as yiu describe. but realitybis that jupyter is something lot of people like, find awesone and want to use. this is something that helps someone like me use what other use, but feel less pain. maybe people on future will start migrating out of ui because of stuff like this.

Re: Jupytext: Jupyter notebooks as Python scripts

#40

Earlier quoted context omitted.

I was not being ironic. Notebooks are lovely as an output format for showing your research and allowing others to fiddle with your code. However, for people who do not want to edit inside a web browser window, jupytext is a godsend!

At that point you should put most of your work in a separate file, and just import the stuff you need for your demo.

I do not want to hide anything, my only reason to use notebooks is to put all the computations inside them.
Post reply on HN