streamlit-ext


Namestreamlit-ext JSON
Version 0.1.10 PyPI version JSON
download
home_page
SummarySmall handy widgets for streamlit, e.g. download button which won't cause rerun, set page width
upload_time2024-02-29 03:09:58
maintainer
docs_urlNone
author
requires_python>=3.8
licenseMIT
keywords streamlit widgets
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # streamlit-ext

[![PyPI Latest Release](https://img.shields.io/pypi/v/streamlit-ext.svg)](https://pypi.org/project/streamlit-ext/)
[![streamlit-ext-demo](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://paleneutron-streamlit-ext-testse2etest-sync-widget-orfpyh.streamlitapp.com/)

A small handy extension for streamlit, keep your widget values in url, and share it with your friends.

Use widget from `stramlit-ext` just as `streamlit` and pass a unique `key` to it!

![example gif](https://raw.githubusercontent.com/PaleNeutron/streamlit-ext/master/docs/examples.gif)

```python
import numpy as np
import pandas as pd

import streamlit as st
import streamlit_ext as ste

df = pd.DataFrame(np.random.rand(10, 5))


option = ste.selectbox(
    "A form will show up if you select less than 10",
    range(100),
    key="selectbox",
)

st.write("You selected:", option)

age = ste.slider("How old are you?", 0, 130, 25, key="slider1")
st.write("I'm ", age, "years old")

ste.download_button("Click to download data!", df, "YOUR_DF.xlsx")
ste.download_button("Click to download text!", b"text content", "YOUR_STRING.txt")
```



## installation

```bash
pip install streamlit-ext
```

## Usage

### sync widgets' value with urls

When widgets value changes, the url synced and if you open the url in new tab, every value keeped.

Just import widgets from streamlit_ext, and give a specific `key` argument to it!

```python
import streamlit as st
import streamlit_ext as ste

from datetime import time, datetime, date

option = ste.selectbox(
    "How would you like to be contacted?",
    range(100),
    key="selectbox",
)

st.write("You selected:", option)

d = ste.date_input("When's your birthday", date(2019, 7, 6), key="date_input")
st.write("Your birthday is:", d)

t = ste.time_input("Set an alarm for", time(8, 45), key="time_input")
st.write("Alarm is set for", t)
```

### Download button which won't cause rerun

```python
import streamlit as st
import streamlit_ext as ste

st.title('streamlit-ext')

ste.set_page_width("60em")

ste.download_button("Download", "Hello World".encode(), "hello.txt")
```

### Set page width

```python
import streamlit as st
import streamlit_ext as ste

st.title('streamlit-ext')

ste.set_page_width("60em")

st.write("a quick fox jump..."*100)
```

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "streamlit-ext",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8",
    "maintainer_email": "",
    "keywords": "streamlit,widgets",
    "author": "",
    "author_email": "John Lyu <paleneutron@outlook.com>",
    "download_url": "https://files.pythonhosted.org/packages/f5/6a/db8db23a6b694844b1cae0bdbd8e4a2e8d7b9a7925d1cb58bd038351fb85/streamlit-ext-0.1.10.tar.gz",
    "platform": null,
    "description": "# streamlit-ext\n\n[![PyPI Latest Release](https://img.shields.io/pypi/v/streamlit-ext.svg)](https://pypi.org/project/streamlit-ext/)\n[![streamlit-ext-demo](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://paleneutron-streamlit-ext-testse2etest-sync-widget-orfpyh.streamlitapp.com/)\n\nA small handy extension for streamlit, keep your widget values in url, and share it with your friends.\n\nUse widget from `stramlit-ext` just as `streamlit` and pass a unique `key` to it!\n\n![example gif](https://raw.githubusercontent.com/PaleNeutron/streamlit-ext/master/docs/examples.gif)\n\n```python\nimport numpy as np\nimport pandas as pd\n\nimport streamlit as st\nimport streamlit_ext as ste\n\ndf = pd.DataFrame(np.random.rand(10, 5))\n\n\noption = ste.selectbox(\n    \"A form will show up if you select less than 10\",\n    range(100),\n    key=\"selectbox\",\n)\n\nst.write(\"You selected:\", option)\n\nage = ste.slider(\"How old are you?\", 0, 130, 25, key=\"slider1\")\nst.write(\"I'm \", age, \"years old\")\n\nste.download_button(\"Click to download data!\", df, \"YOUR_DF.xlsx\")\nste.download_button(\"Click to download text!\", b\"text content\", \"YOUR_STRING.txt\")\n```\n\n\n\n## installation\n\n```bash\npip install streamlit-ext\n```\n\n## Usage\n\n### sync widgets' value with urls\n\nWhen widgets value changes, the url synced and if you open the url in new tab, every value keeped.\n\nJust import widgets from streamlit_ext, and give a specific `key` argument to it!\n\n```python\nimport streamlit as st\nimport streamlit_ext as ste\n\nfrom datetime import time, datetime, date\n\noption = ste.selectbox(\n    \"How would you like to be contacted?\",\n    range(100),\n    key=\"selectbox\",\n)\n\nst.write(\"You selected:\", option)\n\nd = ste.date_input(\"When's your birthday\", date(2019, 7, 6), key=\"date_input\")\nst.write(\"Your birthday is:\", d)\n\nt = ste.time_input(\"Set an alarm for\", time(8, 45), key=\"time_input\")\nst.write(\"Alarm is set for\", t)\n```\n\n### Download button which won't cause rerun\n\n```python\nimport streamlit as st\nimport streamlit_ext as ste\n\nst.title('streamlit-ext')\n\nste.set_page_width(\"60em\")\n\nste.download_button(\"Download\", \"Hello World\".encode(), \"hello.txt\")\n```\n\n### Set page width\n\n```python\nimport streamlit as st\nimport streamlit_ext as ste\n\nst.title('streamlit-ext')\n\nste.set_page_width(\"60em\")\n\nst.write(\"a quick fox jump...\"*100)\n```\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Small handy widgets for streamlit, e.g. download button which won't cause rerun, set page width",
    "version": "0.1.10",
    "project_urls": {
        "Source Code": "https://github.com/PaleNeutron/streamlit-ext"
    },
    "split_keywords": [
        "streamlit",
        "widgets"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "eb07f239c6039482689138d2667feaa243ba216b31b74de6e3de7b747acf721d",
                "md5": "69863de507319faf962ab8bde7207513",
                "sha256": "ae6c824e42b33acd8bddfbae585ca47a8b06aa07d289859ea5111458cd0de17d"
            },
            "downloads": -1,
            "filename": "streamlit_ext-0.1.10-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "69863de507319faf962ab8bde7207513",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8",
            "size": 10745,
            "upload_time": "2024-02-29T03:09:56",
            "upload_time_iso_8601": "2024-02-29T03:09:56.867963Z",
            "url": "https://files.pythonhosted.org/packages/eb/07/f239c6039482689138d2667feaa243ba216b31b74de6e3de7b747acf721d/streamlit_ext-0.1.10-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f56adb8db23a6b694844b1cae0bdbd8e4a2e8d7b9a7925d1cb58bd038351fb85",
                "md5": "068a5e0a92b9e6b97cc98a69c443a807",
                "sha256": "60c19def7cf594fdabbdafa7d2bdbbb549daee063bc7dcd92afc18f471bf0e13"
            },
            "downloads": -1,
            "filename": "streamlit-ext-0.1.10.tar.gz",
            "has_sig": false,
            "md5_digest": "068a5e0a92b9e6b97cc98a69c443a807",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8",
            "size": 281750,
            "upload_time": "2024-02-29T03:09:58",
            "upload_time_iso_8601": "2024-02-29T03:09:58.195462Z",
            "url": "https://files.pythonhosted.org/packages/f5/6a/db8db23a6b694844b1cae0bdbd8e4a2e8d7b9a7925d1cb58bd038351fb85/streamlit-ext-0.1.10.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-02-29 03:09:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "PaleNeutron",
    "github_project": "streamlit-ext",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "streamlit-ext"
}
        
Elapsed time: 0.19154s