Experiments for serving Jupyter Notebook files through Tornado websockets as an interactive web application.
todo
-
The client connects to the server through websocket.
-
The server reads and compiles the Notebook's source code and executes it cell by cell.
-
The Notebook's source code calls widget functions.
-
The widgets are sent to the client through the server.
-
The client displays the widgets as UI components.
-
The client sends widget input to the server on user interactions.
-
The server partially re-executes the Notebook with the new input.
-
+1 Works embedded inside Jupyter without running a server using in-browser Javascript.
So it is basically Streamlit, but it
- does not rerun the whole script on inputs, only the given cells (imitating the normal data science flow: when I modify a cell, I rerun it with the following cells).
- can work without a server and display widgets inside the Notebook during development.
So it is better. 💩
This project is a monorepo containing the following:
- backend (lib): Tornado Web Server + IPython widgets
- frontend: Next.js Web Application
- widget(s): React Component Library
Currently only the dev mode is supported.
Prerequisites:
- Python >= 3.9 + PiP
- Node.js >= 18.0
pip install -r requirements.txt
cd ./frontend
npm install
Use an existing example or create a new Notebook:
cd ./examples
jupyter notebook
Start backend:
python ./main.py
Start frontend:
cd ./frontend
npm run dev
Then go to http://localhost:3000
Start widget storybook:
cd ./widget
npm run storybook
Then go to http://localhost:6006