streamlit-pills-multiselect


Namestreamlit-pills-multiselect JSON
Version 0.6.1 PyPI version JSON
download
home_page
Summary💊 A Streamlit component to show clickable pills/badges
upload_time2023-03-26 00:40:05
maintainer
docs_urlNone
authorJohannes Rieke
requires_python>=3.8,<4.0
licenseMIT
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # streamlit-pills 💊

[![PyPI](https://img.shields.io/pypi/v/streamlit-pills)](https://pypi.org/project/streamlit-pills/)

**A Streamlit component to show clickable pills/badges.**

This custom component works just like `st.selectbox` but shows the options as clickable 
pills. It's nice to show the user upfront what they can select, without going through a 
dropdown.

---

<h3 align="center">
  💊 <a href="https://pills-component.streamlit.app/">Demo app</a> 💊
</h3>

---

<p align="center">
    <a href="https://pills-component.streamlit.app/"><img src="images/demo.png"></a>
</p>


## Installation

```bash
pip install streamlit-pills
```

## Usage

```python
from streamlit_pills import pills
selected = pills("Label", ["Option 1", "Option 2", "Option 3"], ["🍀", "🎈", "🌈"])
st.write(selected)
```

See [the demo app](https://pills-component.streamlit.app/) for a detailed guide!


## Development

Note: you only need to run these steps if you want to change this component or 
contribute to its development!

### Setup

First, clone the repository:

```bash
git clone https://github.com/jrieke/streamlit-pills.git
cd streamlit-pills
```

Install the Python dependencies:

```bash
poetry install
```

And install the frontend dependencies:

```bash
cd streamlit_pills/frontend
npm install
```

### Making changes

To make changes, first go to `streamlit_pills/__init__.py` and make sure the 
variable `_RELEASE` is set to `False`. This will make the component use the local 
version of the frontend code, and not the built project. 

Then, start one terminal and run:

```bash
cd streamlit_pills/frontend
npm start
```

This starts the frontend code on port 3001.

Open another terminal and run:

```bash
cp demo/streamlit_app.py .
poetry shell
streamlit run streamlit_app.py
```

This copies the demo app to the root dir (so you have something to work with and see 
your changes!) and then starts it. Now you can make changes to the Python or Javascript 
code in `streamlit_pills` and the demo app should update automatically!

If nothing updates, make sure the variable `_RELEASE` in `streamlit_pills/__init__.py` is set to `False`. 


### Publishing on PyPI

Switch the variable `_RELEASE` in `streamlit_pills/__init__.py` to `True`. 
Increment the version number in `pyproject.toml`. Make sure the copy of the demo app in 
the root dir is deleted or merged back into the demo app in `demo/streamlit_app.py`.

Build the frontend code with:

```bash
cd streamlit_pills/frontend
npm run build
```

After this has finished, build and upload the package to PyPI:

```bash
cd ../..
poetry build
poetry publish
```

## Changelog

### 0.4.0 (March 24, 2023)
- Added Multi-Select
- Added Centered Mode

### 0.3.0 (November 22, 2022)
- Added `label_visibility` parameter to hide the label.

### 0.2.0 (November 22, 2022)
- Added `format_func` parameter to allow formatting the pill texts.

### 0.1.2 (November 22, 2022)
- First functioning release.
            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "streamlit-pills-multiselect",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.8,<4.0",
    "maintainer_email": "",
    "keywords": "",
    "author": "Johannes Rieke",
    "author_email": "johannes.rieke@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/85/5f/23b2635429d3f7e687f5ecae45c73afeb8c3b6bf21450ce78089c12e78ed/streamlit_pills_multiselect-0.6.1.tar.gz",
    "platform": null,
    "description": "# streamlit-pills \ud83d\udc8a\n\n[![PyPI](https://img.shields.io/pypi/v/streamlit-pills)](https://pypi.org/project/streamlit-pills/)\n\n**A Streamlit component to show clickable pills/badges.**\n\nThis custom component works just like `st.selectbox` but shows the options as clickable \npills. It's nice to show the user upfront what they can select, without going through a \ndropdown.\n\n---\n\n<h3 align=\"center\">\n  \ud83d\udc8a <a href=\"https://pills-component.streamlit.app/\">Demo app</a> \ud83d\udc8a\n</h3>\n\n---\n\n<p align=\"center\">\n    <a href=\"https://pills-component.streamlit.app/\"><img src=\"images/demo.png\"></a>\n</p>\n\n\n## Installation\n\n```bash\npip install streamlit-pills\n```\n\n## Usage\n\n```python\nfrom streamlit_pills import pills\nselected = pills(\"Label\", [\"Option 1\", \"Option 2\", \"Option 3\"], [\"\ud83c\udf40\", \"\ud83c\udf88\", \"\ud83c\udf08\"])\nst.write(selected)\n```\n\nSee [the demo app](https://pills-component.streamlit.app/) for a detailed guide!\n\n\n## Development\n\nNote: you only need to run these steps if you want to change this component or \ncontribute to its development!\n\n### Setup\n\nFirst, clone the repository:\n\n```bash\ngit clone https://github.com/jrieke/streamlit-pills.git\ncd streamlit-pills\n```\n\nInstall the Python dependencies:\n\n```bash\npoetry install\n```\n\nAnd install the frontend dependencies:\n\n```bash\ncd streamlit_pills/frontend\nnpm install\n```\n\n### Making changes\n\nTo make changes, first go to `streamlit_pills/__init__.py` and make sure the \nvariable `_RELEASE` is set to `False`. This will make the component use the local \nversion of the frontend code, and not the built project. \n\nThen, start one terminal and run:\n\n```bash\ncd streamlit_pills/frontend\nnpm start\n```\n\nThis starts the frontend code on port 3001.\n\nOpen another terminal and run:\n\n```bash\ncp demo/streamlit_app.py .\npoetry shell\nstreamlit run streamlit_app.py\n```\n\nThis copies the demo app to the root dir (so you have something to work with and see \nyour changes!) and then starts it. Now you can make changes to the Python or Javascript \ncode in `streamlit_pills` and the demo app should update automatically!\n\nIf nothing updates, make sure the variable `_RELEASE` in `streamlit_pills/__init__.py` is set to `False`. \n\n\n### Publishing on PyPI\n\nSwitch the variable `_RELEASE` in `streamlit_pills/__init__.py` to `True`. \nIncrement the version number in `pyproject.toml`. Make sure the copy of the demo app in \nthe root dir is deleted or merged back into the demo app in `demo/streamlit_app.py`.\n\nBuild the frontend code with:\n\n```bash\ncd streamlit_pills/frontend\nnpm run build\n```\n\nAfter this has finished, build and upload the package to PyPI:\n\n```bash\ncd ../..\npoetry build\npoetry publish\n```\n\n## Changelog\n\n### 0.4.0 (March 24, 2023)\n- Added Multi-Select\n- Added Centered Mode\n\n### 0.3.0 (November 22, 2022)\n- Added `label_visibility` parameter to hide the label.\n\n### 0.2.0 (November 22, 2022)\n- Added `format_func` parameter to allow formatting the pill texts.\n\n### 0.1.2 (November 22, 2022)\n- First functioning release.",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "\ud83d\udc8a A Streamlit component to show clickable pills/badges",
    "version": "0.6.1",
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "763b5b99f120b984dd4dc7ada48eb3eed73e6bc216da035782953cb9b11ff602",
                "md5": "75eab616b0d554a11680bc6cafcb6a9c",
                "sha256": "4f2ff5a0ddfdb6512be01c1c7da6d9d518ce93b52c4c49f39534362690ddb4ff"
            },
            "downloads": -1,
            "filename": "streamlit_pills_multiselect-0.6.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "75eab616b0d554a11680bc6cafcb6a9c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.8,<4.0",
            "size": 711781,
            "upload_time": "2023-03-26T00:40:03",
            "upload_time_iso_8601": "2023-03-26T00:40:03.540536Z",
            "url": "https://files.pythonhosted.org/packages/76/3b/5b99f120b984dd4dc7ada48eb3eed73e6bc216da035782953cb9b11ff602/streamlit_pills_multiselect-0.6.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "855f23b2635429d3f7e687f5ecae45c73afeb8c3b6bf21450ce78089c12e78ed",
                "md5": "ae521b04c3b6394def654406430d72b1",
                "sha256": "fecd79926d07886cdb5cdcb0504a21d2cd0221d016277c287c6aa32a1768aacf"
            },
            "downloads": -1,
            "filename": "streamlit_pills_multiselect-0.6.1.tar.gz",
            "has_sig": false,
            "md5_digest": "ae521b04c3b6394def654406430d72b1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.8,<4.0",
            "size": 700305,
            "upload_time": "2023-03-26T00:40:05",
            "upload_time_iso_8601": "2023-03-26T00:40:05.302534Z",
            "url": "https://files.pythonhosted.org/packages/85/5f/23b2635429d3f7e687f5ecae45c73afeb8c3b6bf21450ce78089c12e78ed/streamlit_pills_multiselect-0.6.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-26 00:40:05",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "lcname": "streamlit-pills-multiselect"
}
        
Elapsed time: 0.15615s