Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/comet-ml/streamlit-jupyter-magic
A local streamlit server for Jupyter environments
https://github.com/comet-ml/streamlit-jupyter-magic
Last synced: 7 days ago
JSON representation
A local streamlit server for Jupyter environments
- Host: GitHub
- URL: https://github.com/comet-ml/streamlit-jupyter-magic
- Owner: comet-ml
- License: apache-2.0
- Created: 2023-09-25T12:09:36.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2024-02-04T16:41:31.000Z (9 months ago)
- Last Synced: 2024-10-08T10:24:46.324Z (about 1 month ago)
- Language: Python
- Homepage:
- Size: 71.3 KB
- Stars: 5
- Watchers: 6
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# streamlit-jupyter-magic
A local streamlit server for Jupyter environments, and more.
## Installation
```python
pip install streamlit-jupyter-magic
```## Example
```python
# Cell:
import streamlit_jupyter_magic# Cell:
%%streamlitimport streamlit as st
st.title("This is a Test")
if st.button("Click me!"):
st.button("Click me again!")
```Results in the following:
![Jupyter Magic Demo](https://github.com/comet-ml/streamlit-jupyter-magic/blob/main/images/demo.gif?raw=true)
## Limitations
1. Currently doesn't work on colab, due to a couple of colab bugs
2. Currently doesn't work in multiple, simultaneous notebooks in same environment## Flags
Use any of these flags with `%%streamlit FLAGS...`
* `--port NUMBER` - set the port for streamlit to use; default is 5000
* `--host HOST` - set the host for streamlit to use; default is "localhost"
* `--name NAME` - set the name (a unique instance id) for this cell app; default uses Jupyter cell ID
* `--width VALUE` - set the app width, such as "100%"
* `--height VALUE` - set the app height, such as "700px"
* `--use-colab-workaround` - on colab, use a window rather than iframe, but still doesn't work (colab bug)## Under the hood
`streamlit-jupyter-magic` uses streamlit pages to keep memory usage down.
The magic code can be found in: [streamlit_jupyter_magic/\_\_init__.py](https://github.com/comet-ml/streamlit-jupyter-magic/blob/main/streamlit_jupyter_magic/__init__.py)
The rest of the code is utility code for managing the streamlit server.