A repo tryna see if you could run a streamlit app in mybinder
Last updated Jan 21, 2024
11
Stars
7
Forks
1
Issues
0
Stars/day
Attention Score
5
Language breakdown
Python 100.0%
▸ Files
click to expand
README
testing-streamlit-mybinder
A repo tryna see if you could run a streamlit app on mybinderInspired by this thread: https://discuss.streamlit.io/t/jupyterhub-streamlit/1238/5
It finally worked when github user op07n forked and fixed streamlitcall.py
Requirements
3 files:requirements.txtorevironment.ymlwith
- a jupyter server extension script:
streamlit_call.py and it's fairly simple
from subprocess import Popen
def loadjupyterserver_extension(nbapp): """serve the streamlit app""" Popen(["streamlit", "hello", "--browser.serverAddress=0.0.0.0", "--server.enableCORS=False"])
postBuildwhich enables nbserverproxy, moves the extension script and enables it
# enable nbserverproxy jupyter serverextension enable --sys-prefix nbserverproxy # streamlit launches at startup mv .binder/streamlitcall.py ${NBPYTHON_PREFIX}/lib/python*/site-packages/ # enable streamlit extension jupyter serverextension enable --sys-prefix streamlit_call
To open by default you'd add ?urlpath=proxy/8501/ to the end of your mybinder link. For example, this repo's link is https://mybinder.org/v2/gh/chekos/testing-streamlit-mybinder/master?urlpath=proxy/8501/
| WARNING: Make sure you have a trailing / at the end (proxy/8501/ :thumbsup: - proxy/8501 :thumbsdown:) | | --- |
🔗 More in this category