9 ms·
Nbterm: Jupyter Notebooks in the Terminal
- alpaca128 5y agoThe web interface was the main reason I never really used the tool for more than a few test runs. Writing code in the browser combines bad usability and performance with a lack of useful dev tools. Which brings me to the question whether I can edit the code in a text editor as well or I have to write it as shown in the animation. It would be really helpful if there was a shortcut to open the current (code) section in $EDITOR, kind of like Git and other tools do it.
- atoav 5y agoI used nteract which is like a bit like a notepad for ipnyb files. It is not great software, but it works.
- samuell 5y agoOne way I've been exploring, is to use nbconvert [1] to convert notebooks to python scripts and back. [1] https://nbconvert.readthedocs.io/en/latest/index.html https://nbconvert.readthedocs.io/en/latest/index.html
- whitten 5y agoHave you found any Jupyter notebooks that don't convert easily ?
- nsonha 5y agoVscode and intelij both have had good support for notebook for a long time. For the web interface there maybe even extension to add intellisense to it or smt
- BiteCode_dev 5y agoUse the qt-console, best of both worlds.
- klibertp 5y agoqt-console is great, but it's not a notebook, ie. you don't have cells you can go back to and edit. It's more of a classic console, with great readline emulation and ability to display images easily.
- zokier 5y agoThere is the %edit magic
- goerz 5y agoFor editing notebooks in vim, I've created https://github.com/goerz/jupytext.vim https://github.com/goerz/jupytext.vim. Note that this does not allow to run any cells, it just edits the inputs. The motivation behind this was to have some basic interaction with existing ipynb files on a remote server without having to run the jupyter server (and set up port forwarding etc.) It's worth noting that the `jupytext.vim plugin is most useful if you're actually not running `jupytext` within jupyter; If you are, you could just directly open the .py or .md files linked to any .ipynb in your editor. I've used `jupytext.vim` to edit existing notebooks and then run them through `jupyter nbconvert --to notebook --execute`. It's also great for refactoring: moving code from a notebook files into a module, between notebooks, or to create a new notebook as a variation of an existing one.
- lnyan 5y agoIf you use vim, you can also try https://github.com/hanschen/vim-ipython-cell https://github.com/hanschen/vim-ipython-cell . It works quite well If you use emacs, ein is also a good choice: https://github.com/millejoh/emacs-ipython-notebook https://github.com/millejoh/emacs-ipython-notebook
- deleted 5y ago[deleted]
- reimbar 5y agoVS Code has been making progress to support Jupyter notebooks (https://code.visualstudio.com/docs/python/jupyter-support https://code.visualstudio.com/docs/python/jupyter-support), but it's not quite there yet. Code completion works, but other features such as user snippets are missing, and it can be quite laggy. Apparently that's because the VS Code team has to reimplement a lot of stuff for Jupyter specifically (compared to adding support for Rust or Go with a language server).
- goodside 5y agoVSCode Insiders has huge improvements in this area. I switched to Insiders specifically for this and it’s great. You get linting, auto-formatting, vim-mode keyboard input, and even git diff for .ipynb. I don’t run Jupyter’s browser UI at all now.
- jononor 5y agoFor those that don't know, VSCode Insiders seems to be some beta/alpha channel of releases with features that are under-development. So I guess that means it will end up in VSCode stable in a little bit.
- yewenjie 5y agoThere is also Emacs Jupyter if you use Emacs, and all sorts of `org-babel` integrations if you use org-mode. https://github.com/nnicandro/emacs-jupyter https://github.com/nnicandro/emacs-jupyter
- fzimmermann 5y agoOk, I failed in basic usage: Entering nbterm, I assumed some standard key bindings -- None seemed to work. Neither Ctrl-C, Ctrl-D, Ctrl-x ctrl-c, escape q, escape :q, ... seems to work. So off to google: Escape Ctrl-q should work. But does not. Ok I'm stuck, let's at least get 1+1 to work. So entering 1+1 and .. hitting Enter? Shift Enter? No. Ok, command mode, Ctrl E.. aaaaand it's stuck. Looks nice but I just don't seem to get it to work using anaconda on macos..
- de6u99er 5y agoThe project's README might help. https://github.com/davidbrochart/nbterm https://github.com/davidbrochart/nbterm
- Infernal 5y agoTo be fair the poster you’re replying to seems to have run the correct commands indicated by the README, unless I’m missing the same thing they are.
- mark_l_watson 5y agoThanks, just what I was looking for. I used to use a matplotlib backend that worked with ITerm2 for coding in a remote server (standard technique, that I also cover in my Hy language book). Adding Nbterm would also be useful. Off topic, but it is sometimes just (much) better to do development on a remote server with much more compute and faster Internet connections.
- prionassembly 5y agoI'm curious, what version of Hy are you targeting in your book?
- mark_l_watson 5y agoThe latest public version (pip install Hy). I don’t generally install from the GitHub repo. I know that Hy is no big deal, just a Lisp skin on top of Python, but I really enjoy using it. Hy is an example of “done” software: it was written years ago, and just does what it is meant to. I have noticed comments on Reddit about Hy not being actively maintained, but as I said, it is “done.”
- alfl 5y agoMy team is doing a lot of cli-based hacking on notebooks. They’re an interesting developing format. I would love early HN feedback on Notebook Ninja, which is (pre-)alpha here: https://notebook.ninja https://notebook.ninja
- whitten 5y agoWhat features does Noteback Ninja have that aren't present in the nbterm system ?
- alfl 5y agoGreat question. Right now Ninja is web-only for the public. Internally it's a CLI (releasing soon). nbterm is "notebooks in the terminal", Ninja is "materialized notebook executions". So, for example, whereas nbterm will display cell outputs, ninja will materialize them to disk and make them available via (eg) HTTP. Whereas nbterm is a CLI-based notebook development environment, Ninja is a notebook production execution environment. Ninja continues the thought from "how do I build notebooks better" to "how do I get into production".
- whitten 5y agoSo Notebook Ninja has a flag that means write the notebook and its calculated cells to an html page or some other form that would capture a snapshot at a particular step in the process, and thus be suitable to be served by a web server without being "re-executed" ? Why doesn't nbterm allow for production execution of code ? I thought that was the point of its existence, just that they are done in an terminal window rather than a web window.
- alfl 5y agoIn essence, yes. Ninja is based around the idea of reproducable science: a given execution of a notebook is immutable and accessible consistently. It writes out cell outputs depending on their mimetype (this is included in Jupyter Notebook metadata). It writes out all declared variables, per-cell, and makes them accessible in several formats (for pre-alpha, as JSON objects). It then exposes all of these via our web servers, so it's really easy to connect them to other services. Or, for example, generate a permanent link to the execution of a particular cell.
- asimjalis 5y agoI write my code in Python or Hy files and then call functions from the notebook. Makes the editing feedback loop much easier.
- O_H_E 5y agoAyyy, first person I see using Hy in the wild. Have been interested for long time to use it as a stepping stone into lisp. But now that I know about Julia, that is a much more likely candidate (or a lispy dialect thereof). The semantics and metaprogramming abilities mirror lisp much more closely. How have Hy been treating you?
- Heliosmaster 5y agoYou might also be interested in Nextjournal, it's in clojure (whose notation you should be familiar). (check also https://github.nextjournal.com https://github.nextjournal.com for a quick test from github code)
- unixhero 5y agoWhy would one need this when you already have ipython?
- goodside 5y agoIPython doesn’t help you view, edit, or execute .ipynb files.
- protomikron 5y agoAfaik 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').
- barefeg 5y agoWould be interesting to spin this into a normal bash terminal where you can edit text in the “cell” like in GUI editor and then execute the cell at the end
- olavolav 5y agoVery 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 https://github.com/domitry/matascii [1] https://github.com/olavolav/uniplot https://github.com/olavolav/uniplot
- elromulous 5y agoThe shameless plug is well justified. uniplot is seriously impressive!
- olavolav 5y agoThanks! Do let me know if you are still looking for any particular feature
- whitten 5y agoDo you know if Uniplot is able to handle pediatric growth charts ? (https://www.cdc.gov/growthcharts/index.htm https://www.cdc.gov/growthcharts/index.htm) or generally, being able to plot on a background that is always used, instead of the (default) of a blank page ? such as : https://www.cdc.gov/growthcharts/data/who/GrChrt_Boys_24HdCirc-L4W_rev90910.pdf https://www.cdc.gov/growthcharts/data/who/GrChrt_Boys_24HdCi... Thanks ! PS: Is the general case of a background image handled by Uniplot, and does Uniplot allow for the idea of taking a PDF, putting the plot data into it, and then creating a new PDF file ?
- olavolav 5y agoThanks for the question! So the labels only depend on the limits of the plotting window, which you can supply as a keyword option. In that sense, and together with using the same gridlines options, you could have the same background in some sense. What uniplot cannot do today is to have multiple vertical axis (like weight and head circumference in your example). Hope this helps! P.S.: Regarding your PDF question, for that in fact I think that some plotting library to graphics (rather than the terminal) might be better
- kache_ 5y agoWe've come full circle
- jhanschoo 5y agoWhat I thought when I saw the headline; ipynb has since matured so much beyond ipython into its own workflow and ecosystem it makes sense to port it back to the cli.
- enriquto 5y agoAlright. Now get rid of the stupid ipynb format and store the notebooks as God intended (runnable Python files with comments).
- kbd 5y agoI found that this is almost completely non-working. Ctrl+q doesn't quit, cells don't run. Does it work for others? It also unfortunately uses shortcuts that are native on Mac (ctrl+up and down do "mission control" things).
- kenward 5y agoSlightly 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.readthedocs.io/en/latest/formats.html?highlight=cell%20syntax#the-percent-format https://jupytext.readthedocs.io/en/latest/formats.html?highl... [1] https://code.visualstudio.com/docs/python/jupyter-support-py https://code.visualstudio.com/docs/python/jupyter-support-py
- dokem 5y agoYou can configure so they don't save their output, then the ipynb diffs will be readable.