Live data from Hacker News

Nbterm: Jupyter Notebooks in the Terminal

blog.jupyter.org

51–60 of 76 posts

Re: Nbterm: Jupyter Notebooks in the Terminal

#51
post #43

Slightly tangent, but has anyone figured out a good solution for version controlling jupyter notebooks? The closest thing that we've found has been to use the notebook percent format in a simple .py file [0][1]. It plays with git much nicer than an .ipynb and it is still interactive enough for rapid prototyping. However, it would be nice to have some first-class support from Jupyter on this. [0] https://jupytext.read…

Forgive the snark because my suggestion is obviously not an improvement or even a match for target audience, but org-mode files with inline org-babel code-blocks is what I consider to be perfect version controlled notebook.

Pity Emacs is not the best on-boarding experience.

Re: Nbterm: Jupyter Notebooks in the Terminal

#52

Why would one need this when you already have ipython?

Afaik IPython is Jupyter's predecessor and superseded by Jupyter (which provides the notebook abstraction for different languages).

IPython was in the beginning Python specific, though its heritage lives on in the new name (the 'py').

Re: Nbterm: Jupyter Notebooks in the Terminal

#53
post #43

Slightly tangent, but has anyone figured out a good solution for version controlling jupyter notebooks? The closest thing that we've found has been to use the notebook percent format in a simple .py file [0][1]. It plays with git much nicer than an .ipynb and it is still interactive enough for rapid prototyping. However, it would be nice to have some first-class support from Jupyter on this. [0] https://jupytext.read…

Shameless plug, but with Nextjournal you can use git directly: https://github.nextjournal.com/

And apart from that, we have a normal github component to load your code from a github repository: https://nextjournal.com/help/github

Re: Nbterm: Jupyter Notebooks in the Terminal

#54

I write my code in Python or Hy files and then call functions from the notebook. Makes the editing feedback loop much easier.

You might also be interested in Nextjournal, it's in clojure (whose notation you should be familiar). (check also https://github.nextjournal.com for a quick test from github code)

Re: Nbterm: Jupyter Notebooks in the Terminal

#55
post #43

Slightly tangent, but has anyone figured out a good solution for version controlling jupyter notebooks? The closest thing that we've found has been to use the notebook percent format in a simple .py file [0][1]. It plays with git much nicer than an .ipynb and it is still interactive enough for rapid prototyping. However, it would be nice to have some first-class support from Jupyter on this. [0] https://jupytext.read…

https://nbdev.fast.ai/

Re: Nbterm: Jupyter Notebooks in the Terminal

#56
post #43

Slightly tangent, but has anyone figured out a good solution for version controlling jupyter notebooks? The closest thing that we've found has been to use the notebook percent format in a simple .py file [0][1]. It plays with git much nicer than an .ipynb and it is still interactive enough for rapid prototyping. However, it would be nice to have some first-class support from Jupyter on this. [0] https://jupytext.read…

Until recently, I also thought this was a major problem. My old solution was to always pair .ipynb files with proper .py modules of the same name, so the .ipynb always starts with `%run foo.py` and just calls functions.

However, I recently started using VSCode Insiders the preview release of VSCode, which has amazing support for Jupyter notebooks in the editor. You can use your normally configured linters, auto-formatters, vi-mode keyboard shortcuts (major selling point for me). You even get legible, cell-aware diffs when comparing in git. Now, the edit/git workflow for .ipynb files is so close to parity I've stopped caring whether code is in a proper Python module or not, and I almost never run Jupyter Notebook or Jupyter Lab in the browser.

In some ways this is a loss, because it's nice to have project-wide linting and other tooling that only work with .py files, but using `%run` was always an imperfect abstraction. By default, `%run` executes modules in a new module namespace which is then copied over, so it's not exactly "paste into Jupyter" unless you do `%run -i`. Even then, it's limited by running all at once. Every cell in a typical Notebook is effectively a button that runs an `exec()` statement, and you can't achieve those semantics by calling Python functions.

Re: Nbterm: Jupyter Notebooks in the Terminal

#57
post #44

Very cool to see this – but will only be successful with great terminal plotting tools. The ones the author mentions like the matplotlib interface clearly won't do[0] due to lack of resolution A perfect use case for unicode plotting [1] (shameless plug) [0] https://github.com/domitry/matascii [1] https://github.com/olavolav/uniplot

I spent a hot second last year thinking about sparklines in a terminal, and it seemed to me that unicode could use some more glyphs to improve this situation of treating a single glyph as a modest array of pixels. I don't know what I googled for, but for some reason I found only about 1/3rd of the characters listed in the final two lines of http://tamivox.org/dave/boxchar/index.html Unless I'm wrong about your demo,…

That's right, I'm using the 2x2 characters and some off-center horizontal line characters.

Note aware of Unicode expansions, though more and more fonts seem to support the above.

Sparklines in the terminal sounds very cool, did you end up coding something?

Note that one other popular alternative (see for example the Unicode plotting lib for Julia) is using Braille characters, which probably have an even better support across fonts

Re: Nbterm: Jupyter Notebooks in the Terminal

#58
post #44

Earlier quoted context omitted.

I spent a hot second last year thinking about sparklines in a terminal, and it seemed to me that unicode could use some more glyphs to improve this situation of treating a single glyph as a modest array of pixels. I don't know what I googled for, but for some reason I found only about 1/3rd of the characters listed in the final two lines of http://tamivox.org/dave/boxchar/index.html Unless I'm wrong about your demo,…

That's right, I'm using the 2x2 characters and some off-center horizontal line characters. Note aware of Unicode expansions, though more and more fonts seem to support the above. Sparklines in the terminal sounds very cool, did you end up coding something? Note that one other popular alternative (see for example the Unicode plotting lib for Julia) is using Braille characters, which probably have an even better suppor…

> Sparklines in the terminal sounds very cool, did you end up coding something?

It seemed to me that the existing tools were about as good as I was going to achieve on my own. I got distracted from my use case and will have to circle back, hopefully soon.

Re: Nbterm: Jupyter Notebooks in the Terminal

#59
post #43

Slightly tangent, but has anyone figured out a good solution for version controlling jupyter notebooks? The closest thing that we've found has been to use the notebook percent format in a simple .py file [0][1]. It plays with git much nicer than an .ipynb and it is still interactive enough for rapid prototyping. However, it would be nice to have some first-class support from Jupyter on this. [0] https://jupytext.read…

So far, we try to just use Jupyter notebooks for experimentation, scratch, and poking around.

Real, working code gets checked in to a repository. The only reason to go back to an old notebook after that point is maybe to see how you may have experimented with or poked at some data.

Re: Nbterm: Jupyter Notebooks in the Terminal

#60
post #43

Slightly tangent, but has anyone figured out a good solution for version controlling jupyter notebooks? The closest thing that we've found has been to use the notebook percent format in a simple .py file [0][1]. It plays with git much nicer than an .ipynb and it is still interactive enough for rapid prototyping. However, it would be nice to have some first-class support from Jupyter on this. [0] https://jupytext.read…

Forgive the snark because my suggestion is obviously not an improvement or even a match for target audience, but org-mode files with inline org-babel code-blocks is what I consider to be perfect version controlled notebook. Pity Emacs is not the best on-boarding experience.

Worth noting that org files can also embed images inline. Unfortunately, I don't think it's enough to attract new users: images are non-interactive, you can't embed any other media, you have to pop a separate window to edit code, you can't embed rendered markdown (ie. headers and paragraphs have mostly the same font style/size), and so on. Sure org, babel, and calc give you a lot of other things to like, but that's if you're already an Emacs user.
Post reply on HN