# 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:
%%streamlit
import 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.
Raw data
{
"_id": null,
"home_page": "https://github.com/comet-ml/streamlit-jupyter-magic",
"name": "streamlit-jupyter-magic",
"maintainer": "",
"docs_url": null,
"requires_python": ">=3.7",
"maintainer_email": "",
"keywords": "data science,python",
"author": "Streamlit Jupyter Magic Development Team",
"author_email": "",
"download_url": "",
"platform": "Linux",
"description": "# streamlit-jupyter-magic\n\nA local streamlit server for Jupyter environments, and more.\n\n## Installation\n\n```python\npip install streamlit-jupyter-magic\n```\n\n## Example\n\n```python\n# Cell:\nimport streamlit_jupyter_magic\n\n# Cell:\n%%streamlit \n\nimport streamlit as st\n\nst.title(\"This is a Test\")\n\nif st.button(\"Click me!\"):\n st.button(\"Click me again!\")\n```\n\nResults in the following:\n\n![Jupyter Magic Demo](https://github.com/comet-ml/streamlit-jupyter-magic/blob/main/images/demo.gif?raw=true)\n\n## Limitations\n\n1. Currently doesn't work on colab, due to a couple of colab bugs\n2. Currently doesn't work in multiple, simultaneous notebooks in same environment\n\n## Flags\n\nUse any of these flags with `%%streamlit FLAGS...`\n\n* `--port NUMBER` - set the port for streamlit to use; default is 5000\n* `--host HOST` - set the host for streamlit to use; default is \"localhost\"\n* `--name NAME` - set the name (a unique instance id) for this cell app; default uses Jupyter cell ID\n* `--width VALUE` - set the app width, such as \"100%\" \n* `--height VALUE` - set the app height, such as \"700px\" \n* `--use-colab-workaround` - on colab, use a window rather than iframe, but still doesn't work (colab bug)\n\n## Under the hood\n\n`streamlit-jupyter-magic` uses streamlit pages to keep memory usage down.\n\nThe 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)\n\nThe rest of the code is utility code for managing the streamlit server.\n",
"bugtrack_url": null,
"license": "Apache 2.0 License",
"summary": "Streamlit for Jupyter environments",
"version": "1.2.1",
"project_urls": {
"Homepage": "https://github.com/comet-ml/streamlit-jupyter-magic"
},
"split_keywords": [
"data science",
"python"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "955ba07c21460e6ea87b4becbe29f1ac8ddcfc01ef983c29e937d631b21d7284",
"md5": "1f1ac0341ff474dcdcbc8992f95370d3",
"sha256": "6193c5b0c44dc55ceccf0e9a5a873ed8e640a967496d54f801bc8220c1f8fb51"
},
"downloads": -1,
"filename": "streamlit_jupyter_magic-1.2.1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "1f1ac0341ff474dcdcbc8992f95370d3",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.7",
"size": 9448,
"upload_time": "2024-02-04T16:40:41",
"upload_time_iso_8601": "2024-02-04T16:40:41.030887Z",
"url": "https://files.pythonhosted.org/packages/95/5b/a07c21460e6ea87b4becbe29f1ac8ddcfc01ef983c29e937d631b21d7284/streamlit_jupyter_magic-1.2.1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-02-04 16:40:41",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "comet-ml",
"github_project": "streamlit-jupyter-magic",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"requirements": [
{
"name": "streamlit",
"specs": []
},
{
"name": "rich",
"specs": []
},
{
"name": "psutil",
"specs": []
},
{
"name": "flask",
"specs": []
},
{
"name": "matplotlib",
"specs": []
},
{
"name": "numpy",
"specs": []
}
],
"lcname": "streamlit-jupyter-magic"
}