alnoda-workspaces/workspaces/jupyter-workspace
2023-07-08 18:26:55 +00:00
..
workspace Upd. using wrk 2023-07-05 15:36:02 +00:00
Dockerfile Upd. using wrk 2023-07-05 15:36:02 +00:00
README.md readmes updated 2023-07-08 18:26:55 +00:00

Jupyter workspace

Workspace equipped with Jupyterlab and has a suite of tools for utilizing Jupyter notebooks

Start

docker run --name space-1 -d -p 8020-8040:8020-8040 --restart=always alnoda/jupyter-workspace

and open localhost:8020 in browser.

Features

  • JupyterLab - Web-based interactive development environment for notebooks, code, and data.
  • jpterm - jpterm aims to be the equivalent of JupyterLab in the terminal.
  • Euporie - Euporie is a terminal based interactive computing environment for Jupyter.
  • jut - Render Jupyter notebook in the terminal
  • nbpreview - A terminal viewer for Jupyter notebooks. Its like cat for ipynb files.
  • nbterm - Jupyter Notebooks in the terminal.
  • jupyter-python - Python LSP Server for Jupyterlab. Support for code completion, syntax highlighting
  • NBClient - Tool for running Jupyter Notebooks in different execution contexts, including the command line.
  • nbconvert - Jupyter Notebook Conversion
  • papermill - Papermill is a tool for parameterizing and executing Jupyter Notebooks.
  • Jupytext - Jupyter Notebooks as Markdown Documents, Julia, Python or R scripts.
  • Alnoda workspace features

Alnoda docs
Alnoda Hub

NBClient

NBClient is a tool for running Jupyter Notebooks in different execution contexts, including the command line. NBClient makes it possible to run command jupyter execute which runs Notebook cells one-by-one.

For example:

jupyter execute my-notebook.ipynb

This will execute each note in the notebook.

NBClient might handy, if you need to automate such tasks as web scrapping, data analysis or preparation, retraining of machine learning models.

Nbterm

Nbterm lets you view, edit and execute Jupyter Notebooks in the terminal, and produce the new notebook as a result of execution.

One of the differences between NBClient and Nbterm, is that the latter produces new notebook as a result. This is especially useful if you plan to use notebooks as reports.

An example use-case would be querying datasase, computing statistics from new orders or client activity, and providing read-only executed notebook via NBviewer. Such notebook will contain both code, SQL as well as results of execution - statistics, chartss and plots.

For example:

nbterm --run notebook.ipynb --save-path /home/project/notebook-1.ipynb

Because flag --save-path was defined, executed notebook has been saved.

Papermill

Papermill is a tool for parameterizing, executing, and analyzing Jupyter Notebooks.

Papermill solves the problem of parameterizing notebooks in a simple and efficient way. Jupyter notebooks allow users to tag cells. Papermill lets you to tag a cell, which contains parameters with parameters tag.

To parameterize a notebook, designate a cell with the tag parameters.

As an example, open Jupyter notebook from the Quickstart page, and create a new note.

First thing to do - is to enable tags. Click View -> Cell Toolbar -> Tags. This will enable the tags UI.

Open terminal and execute with different parameters, for example:

papermill mynotebook.ipynb mynotebook-1.ipynb -p PARAM1 "My name" -p PARAM2 "Slim Shady"

Nbconvert

Nbconvert tool allows you to convert an .ipynb notebook file into various static formats including executable scripts.

For example:

jupyter nbconvert --to script mynotebook.ipynb --output /home/project/newfile

Now you can execute this newly-generated python script

python /home/project/newfile.py

Nbconvert can convert to other formats too, such as HTML, PDF, LaTeX. Check tutorial about reports.

nbless

The nbless Python package includes nbconv shell command, which makes conversion of python notebooks into various commands, including .py executable scripts.

To try it with the example notebook, execute in terminal

nbconv mynotebook.ipynb --exporter python --out_file /home/project/mynotebook.py

You will see that file 'mynotebook.py' has appeared in the '/home/project' folder.

Jupytext

Jupytext can save Jupyter notebooks as python or markdown:

jupytext --to py mynotebook.ipynb  --output /home/project/myscript.py