Hey there, I created a library streamlit-jupyter to allow for seamless creation of streamlit apps in jupyter notebooks.
A nifty little alternative to voila, one might say.
The way this works is it detects your environment, and if the script is run from a jupyter notebook, then it wraps existing streamlit methods to replace them with ipywidgets alternatives - that way you can code as you would in streamlit, and then displays your page as-you-code.
Then you export your notebook to a
.py file, and run it via streamlit as usual (no change in behaviour there)
pip install streamlit_jupyter
Take a look at our example notebook
The main idea is for you experiment and develop in your notebook,
visually see all the pieces, and then convert the notebook to
be run by streamlit
start by importing streamlit and patching it with streamlit-jupyter:
import streamlit as st
from streamlit_jupyter import StreamlitPatcher, tqdm
StreamlitPatcher().jupyter() # register streamlit with jupyter-compatible wrappers
And now develop your notebook as usual, but with the ability to use
Streamlit widgets and components.
See how it works below, and check out the example (it also incudes a nifty alternative to nbconvert that strips out all the magics and other irrelevant stuff)
|Markdown and headings
|Interactive data entry
|Pick and choose
|Dataframes, caching and progress bars
This is a very early beta and my first try at open source, so please share your thoughts and reach out with any questions/critiques!