Skip to main content

Fork of nbterm. Jupyter Notebooks in Your terminal.

Project description

Code style: black

--==================================================--

 _______ ___. ___________                  .__
 \      \\_ |_\__    ___/__________  _____ |__|__  ___
 /   |   \| __ \|    |_/ __ \_  __ \/     \|  \  \/  /
/    |    \ \_\ \    |\  ___/|  | \/  Y Y  \  |>    <
\____|__  /___  /____| \___  >__|  |__|_|  /__/__/\_ \
        \/    \/           \/            \/         \/

      -| Jupyter Kernels at Your Terminal |-

--==================================================--

NBTERMIX SCREEN

Let you view, edit and execute Jupyter Notebooks in the terminal.

Install

Using pip:

pip3 install jupyter_client ipykernel nbtermix

Usage

Open an interactive notebook:

$ nbtermix foo.ipynb

Run a notebook in batch mode:

$ nbtermix --run foo.ipynb

Key bindings

There are two modes: edit mode, and command mode.

  • e: enter the edit mode, allowing to type into the cell.
  • esc: exit the edit mode and enter the command mode.

In edit mode:

  • ctrl-e: run cell.
  • ctrl-r: run cell and select below in edit mode.
  • ctrl-o: open cell in external editor.
  • ctrl-t: open cell result in external editor.
  • ctrl-f: save tmp file from cell and execute it.
  • ctrl-s: save.

In command mode:

  • up or k: select cell above.
  • down or j: select cell below.
  • ctrl-f: current cell to the top.
  • ctrl-g: go to last cell.
  • gg: go to first cell.
  • ctrl-up: move cell above.
  • ctrl-down: move cell below.
  • right : scroll output right
  • left : scroll output left
  • c-j : scroll output down
  • c-k : scroll output up
  • ctrl-b : reset output scroll shift
  • a: insert cell above.
  • b: insert cell below.
  • x: cut the cell.
  • c: copy the cell.
  • ctrl-v: paste cell above.
  • v: paste cell below.
  • o: set as code cell.
  • r: set as Markdown cell.
  • l: clear cell outputs.
  • ctrl-l: clear all cell outputs.
  • f: fold current cell input.
  • /: Search.
  • n: Repeat last search.
  • N: Search backwards.
  • m,<any>: Set mark .
  • ',<any>: Go to mark .
  • ctrl-e or enter: run cell.
  • ctrl-f : focus current cell.
  • ctrl-r or alt-enter: run cell and select below.
  • ctrl-s: save.
  • ctrl-p: run all cells.
  • ctrl-q: exit.
  • ctrl-h: show help.

Kernels

For more kernels visit:

Jupyter kernels . jupyter/jupyter Wiki

This nbtermix is tested on (install only if You know what You're doing):

c kernel

pip install jupyter-c-kernel
install_c_kernel

java kernel

wget https://github.com/SpencerPark/IJava/releases/download/v1.3.0/ijava-1.3.0.zip
unzip ijava-1.3.0.zip -d ijava
cd ijava
python install.py
apt-get isntall default-jdk

javascript kernel

apt-get install nodejs npm libczmq-dev
npm install -g --unsafe-perm npm
npm install -g --unsafe-perm ijavascript
ijsinstall --install=global

php kernel

apt-get install php composer php-zmq
wget https://litipk.github.io/Jupyter-PHP-Installer/dist/jupyter-php-installer.phar
chmod u+x jupyter-php-installer.phar
./jupyter-php-installer.phar install

sqlite kernel from sqlok

pip3 install sqli-kernel
sqlik_install

python3 kernel

out of the box

Testing environment

on Debian X using Python 3.7 (with kernel.json patch see Troubleshooting)

$ jupyter --version:

IPython          : 7.31.0
ipykernel        : 6.6.1
jupyter_client   : 7.1.0
jupyter_core     : 4.9.1
traitlets        : 5.1.1

Runtime Environment recommendations

Keep separated environment for the nbtermix

|= mkdir -p ~/pyenv
cd ~/pyenv
|= virtualenv -p /usr/bin/python3.9 nbtermix
|= source ~/pyenv/nbtermix/bin/activate

CHANGELOG

minor changes in v.0.1.4 by mtatton
* added ! keyboard shortcut to go to
  external editor from command mode
* when there was a cell edit in
  external editor the cell didn't
  refresh
minor changes to v.0.1.3  by mtatton
+ fixed search function (keys /,n,N)
minor changes to v.0.1.2  by mtatton
+ changed visible cells display a bit
+ added ctrl + f for current cell focus
+ added raw text/plain display 
+ added raw text/html display 
minor changes to v.0.0.18 by mtatton
+ scrollable output using left and right
minor changes to v.0.0.17 by mtatton
minor changes to v.0.0.16 by mtatton
minor changes to v.0.0.15 by mtatton
+ added folding for terminal space saving
+ renamed to nbtermix
minor changes to v.0.0.14 by mtatton
minor changes to v.0.0.13 by mtatton
minor changes to v.0.0.12 by mtatton

TROUBLESHOOTING

Problem: Python (busy) and nothing happens

Solution: Verify if python3 kernel is called

list python3 kernel location

$ jupyter kernelspec list

Find kernel.json in the destination (e.g.):

python3|/usr/local/share/jupyter/kernels/python3

In case Your system has both Python 2.7 and 3.x the nbtermix tries to run Python 2.7. And that's something that doesn't work.

Ensure in Your kernel.json for python3 the argv is python3:

cat /usr/local/share/jupyter/kernels/python3/kernel.json
{
"argv": [
*"python3"*,
"-m",
"ipykernel_launcher",
... etc.

Problem: On Debian 11 there is no /usr/bin/python binary

In case You are sure there is no Python 2.x installed on Your machine. You can prepare the binary by updating the default /usr/bin/python alternative. You can do this as follows:

update-alternatives --install /usr/bin/python python /usr/bin/python3.9 2

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nbtermix-0.1.4.tar.gz (18.6 kB view details)

Uploaded Source

File details

Details for the file nbtermix-0.1.4.tar.gz.

File metadata

  • Download URL: nbtermix-0.1.4.tar.gz
  • Upload date:
  • Size: 18.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.7.1 importlib_metadata/4.6.4 pkginfo/1.8.2 requests/2.26.0 requests-toolbelt/0.9.1 tqdm/4.62.0 CPython/3.9.3

File hashes

Hashes for nbtermix-0.1.4.tar.gz
Algorithm Hash digest
SHA256 7d608e49374536cfaaad100fdced30404963fa36f67be7544ff534ab75afa28f
MD5 107a1a32a29db83f9d3b78ab927e5407
BLAKE2b-256 fb78833fe20f7982d05c93d94e9be68ac2261b6a006586e30ec7d4814a94b46d

See more details on using hashes here.

Provenance

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page