streamlit-bokeh


Namestreamlit-bokeh JSON
Version 3.8.0 PyPI version JSON
download
home_pagehttps://streamlit.io
SummaryStreamlit component that allows you to render Bokeh charts
upload_time2025-09-02 21:11:58
maintainerNone
docs_urlNone
authorSnowflake Inc
requires_python>=3.9
licenseApache License 2.0
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # streamlit-bokeh

A lightweight Python package that seamlessly integrates **Bokeh** plots into **Streamlit** apps, allowing for interactive, customizable, and responsive visualizations with minimal effort.

## Filing Issues

Please file [bug reports](https://github.com/streamlit/streamlit/issues/new?template=bug_report.yml) and [enhancement requests](https://github.com/streamlit/streamlit/issues/new?template=feature_request.yml) through our main Streamlit repo.

## 🚀 Features

- Effortlessly embed Bokeh figures in Streamlit apps.
- Responsive layout support with `use_container_width`.
- Customizable themes (`streamlit` (which supports both light and dark mode) or [Bokeh Themes](https://docs.bokeh.org/en/latest/docs/reference/themes.html))

---

## 📦 Installation

```bash
pip install streamlit-bokeh
```

Ensure you have **Streamlit** and **Bokeh** installed as well:

```bash
pip install streamlit bokeh
```

---

## 💡 Usage

Here's how to integrate a simple Bokeh line plot into your Streamlit app:

```python
from bokeh.plotting import figure
from streamlit_bokeh import streamlit_bokeh

# Data
x = [1, 2, 3, 4, 5]
y = [6, 7, 2, 4, 5]

# Create Bokeh figure
YOUR_BOKEH_FIGURE = figure(title="Simple Line Example",
                           x_axis_label="x",
                           y_axis_label="y")
YOUR_BOKEH_FIGURE.line(x, y, legend_label="Trend", line_width=2)

# Render in Streamlit
streamlit_bokeh(YOUR_BOKEH_FIGURE, use_container_width=True, theme="streamlit", key="my_unique_key")
```

---

## ⚙️ API Reference

### `streamlit_bokeh(figure, use_container_width=False, theme='streamlit', key=None)`

#### Parameters:

- **`figure`** (_bokeh.plotting.figure_): The Bokeh figure object to display.
- **`use_container_width`** (_bool_, optional): Whether to override the figure's native width with the width of the parent container. This is `True` by default.
- **`theme`** (_str_, optional): The theme for the plot. This can be one of the following strings:
  - `"streamlit"` (default): Matches Streamlit's current theme.
  - A Bokeh theme name including:
    - `"caliber"`
    - `"light_minimal"`
    - `"dark_minimal"`
    - `"contrast"`
- **`key`** (_str_, optional but recommended): An optional string to give this element a stable identity. If this is `None` (default), this element's identity will be determined based on the values of the other parameters.

---

## 🖼️ Example

```bash
streamlit run app.py
```

Where `app.py` contains:

```python
import streamlit as st
from bokeh.plotting import figure
from streamlit_bokeh import streamlit_bokeh

# Sample Data
x = [1, 2, 3, 4, 5]
y = [2, 4, 8, 16, 32]

# Create Plot
p = figure(title="Exponential Growth", x_axis_label="x", y_axis_label="y")
p.line(x, y, legend_label="Growth", line_width=3, color="green")

# Display in Streamlit
streamlit_bokeh(p, use_container_width=True, key="plot1")
```

---

## 📚 Versioning

We designed the versioning scheme for this custom component to mirror the Bokeh version with the exception of the patch number. We reserve that so we can make bug fixes and new (mostly compatible) features.

For example, `3.6.x` will mirror a version of Bokeh that's `3.6.y`.

---

## 📝 Contributing

Feel free to file issues in [our Streamlit Repository](https://github.com/streamlit/streamlit/issues/new/choose).

Contributions are welcome 🚀, however, please inform us before building a feature.

---

## 📄 License

This project is licensed under the [Apache 2.0](LICENSE).

---

## 🙋 FAQ

**Q:** Can I embed multiple Bokeh plots on the same page?

- **A:** Yes! Just make sure each plot has a unique `key`.

**Q:** Does it support Bokeh widgets?

- **A:** Currently, `streamlit-bokeh` focuses on plots. For widget interactivity, consider combining with native Streamlit widgets.

**Q:** How do I adjust the plot size?

- **A:** Use `use_container_width=True` for responsive sizing, or manually set `plot_width` and `plot_height` in your Bokeh figure.

---

Happy Streamlit-ing! 🎉

            

Raw data

            {
    "_id": null,
    "home_page": "https://streamlit.io",
    "name": "streamlit-bokeh",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": null,
    "author": "Snowflake Inc",
    "author_email": "hello@streamlit.io",
    "download_url": "https://files.pythonhosted.org/packages/e2/78/04ce151e9f35dfe5069659678f3e01d1a0a8641ef96a888580820eee197a/streamlit_bokeh-3.8.0.tar.gz",
    "platform": null,
    "description": "# streamlit-bokeh\n\nA lightweight Python package that seamlessly integrates **Bokeh** plots into **Streamlit** apps, allowing for interactive, customizable, and responsive visualizations with minimal effort.\n\n## Filing Issues\n\nPlease file [bug reports](https://github.com/streamlit/streamlit/issues/new?template=bug_report.yml) and [enhancement requests](https://github.com/streamlit/streamlit/issues/new?template=feature_request.yml) through our main Streamlit repo.\n\n## \ud83d\ude80 Features\n\n- Effortlessly embed Bokeh figures in Streamlit apps.\n- Responsive layout support with `use_container_width`.\n- Customizable themes (`streamlit` (which supports both light and dark mode) or [Bokeh Themes](https://docs.bokeh.org/en/latest/docs/reference/themes.html))\n\n---\n\n## \ud83d\udce6 Installation\n\n```bash\npip install streamlit-bokeh\n```\n\nEnsure you have **Streamlit** and **Bokeh** installed as well:\n\n```bash\npip install streamlit bokeh\n```\n\n---\n\n## \ud83d\udca1 Usage\n\nHere's how to integrate a simple Bokeh line plot into your Streamlit app:\n\n```python\nfrom bokeh.plotting import figure\nfrom streamlit_bokeh import streamlit_bokeh\n\n# Data\nx = [1, 2, 3, 4, 5]\ny = [6, 7, 2, 4, 5]\n\n# Create Bokeh figure\nYOUR_BOKEH_FIGURE = figure(title=\"Simple Line Example\",\n                           x_axis_label=\"x\",\n                           y_axis_label=\"y\")\nYOUR_BOKEH_FIGURE.line(x, y, legend_label=\"Trend\", line_width=2)\n\n# Render in Streamlit\nstreamlit_bokeh(YOUR_BOKEH_FIGURE, use_container_width=True, theme=\"streamlit\", key=\"my_unique_key\")\n```\n\n---\n\n## \u2699\ufe0f API Reference\n\n### `streamlit_bokeh(figure, use_container_width=False, theme='streamlit', key=None)`\n\n#### Parameters:\n\n- **`figure`** (_bokeh.plotting.figure_): The Bokeh figure object to display.\n- **`use_container_width`** (_bool_, optional): Whether to override the figure's native width with the width of the parent container. This is `True` by default.\n- **`theme`** (_str_, optional): The theme for the plot. This can be one of the following strings:\n  - `\"streamlit\"` (default): Matches Streamlit's current theme.\n  - A Bokeh theme name including:\n    - `\"caliber\"`\n    - `\"light_minimal\"`\n    - `\"dark_minimal\"`\n    - `\"contrast\"`\n- **`key`** (_str_, optional but recommended): An optional string to give this element a stable identity. If this is `None` (default), this element's identity will be determined based on the values of the other parameters.\n\n---\n\n## \ud83d\uddbc\ufe0f Example\n\n```bash\nstreamlit run app.py\n```\n\nWhere `app.py` contains:\n\n```python\nimport streamlit as st\nfrom bokeh.plotting import figure\nfrom streamlit_bokeh import streamlit_bokeh\n\n# Sample Data\nx = [1, 2, 3, 4, 5]\ny = [2, 4, 8, 16, 32]\n\n# Create Plot\np = figure(title=\"Exponential Growth\", x_axis_label=\"x\", y_axis_label=\"y\")\np.line(x, y, legend_label=\"Growth\", line_width=3, color=\"green\")\n\n# Display in Streamlit\nstreamlit_bokeh(p, use_container_width=True, key=\"plot1\")\n```\n\n---\n\n## \ud83d\udcda Versioning\n\nWe designed the versioning scheme for this custom component to mirror the Bokeh version with the exception of the patch number. We reserve that so we can make bug fixes and new (mostly compatible) features.\n\nFor example, `3.6.x` will mirror a version of Bokeh that's `3.6.y`.\n\n---\n\n## \ud83d\udcdd Contributing\n\nFeel free to file issues in [our Streamlit Repository](https://github.com/streamlit/streamlit/issues/new/choose).\n\nContributions are welcome \ud83d\ude80, however, please inform us before building a feature.\n\n---\n\n## \ud83d\udcc4 License\n\nThis project is licensed under the [Apache 2.0](LICENSE).\n\n---\n\n## \ud83d\ude4b FAQ\n\n**Q:** Can I embed multiple Bokeh plots on the same page?\n\n- **A:** Yes! Just make sure each plot has a unique `key`.\n\n**Q:** Does it support Bokeh widgets?\n\n- **A:** Currently, `streamlit-bokeh` focuses on plots. For widget interactivity, consider combining with native Streamlit widgets.\n\n**Q:** How do I adjust the plot size?\n\n- **A:** Use `use_container_width=True` for responsive sizing, or manually set `plot_width` and `plot_height` in your Bokeh figure.\n\n---\n\nHappy Streamlit-ing! \ud83c\udf89\n",
    "bugtrack_url": null,
    "license": "Apache License 2.0",
    "summary": "Streamlit component that allows you to render Bokeh charts",
    "version": "3.8.0",
    "project_urls": {
        "Bug Tracker": "https://github.com/streamlit/streamlit/issues",
        "Community": "https://discuss.streamlit.io/",
        "Homepage": "https://streamlit.io",
        "Source Code": "https://github.com/streamlit/streamlit-bokeh",
        "Twitter": "https://twitter.com/streamlit"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "4ba713e3fd79e08ffa4618d034c998335936788d9804c50c8ebafdd4557e8ece",
                "md5": "8409eceee09d0cdb2e35e149981ea0e6",
                "sha256": "26a6a220162c21a0e2fb368d6f98096b9fb5b3fa403358368da7ca77a7f8a6ec"
            },
            "downloads": -1,
            "filename": "streamlit_bokeh-3.8.0-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "8409eceee09d0cdb2e35e149981ea0e6",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.9",
            "size": 1863809,
            "upload_time": "2025-09-02T21:11:56",
            "upload_time_iso_8601": "2025-09-02T21:11:56.837604Z",
            "url": "https://files.pythonhosted.org/packages/4b/a7/13e3fd79e08ffa4618d034c998335936788d9804c50c8ebafdd4557e8ece/streamlit_bokeh-3.8.0-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e27804ce151e9f35dfe5069659678f3e01d1a0a8641ef96a888580820eee197a",
                "md5": "1b1e07e646f37a7d1642db94e15e05a1",
                "sha256": "539d05336ad592278b856626499fc82ef4c55c30b7c64400d3786f3ba6dbe78c"
            },
            "downloads": -1,
            "filename": "streamlit_bokeh-3.8.0.tar.gz",
            "has_sig": false,
            "md5_digest": "1b1e07e646f37a7d1642db94e15e05a1",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 1855112,
            "upload_time": "2025-09-02T21:11:58",
            "upload_time_iso_8601": "2025-09-02T21:11:58.339958Z",
            "url": "https://files.pythonhosted.org/packages/e2/78/04ce151e9f35dfe5069659678f3e01d1a0a8641ef96a888580820eee197a/streamlit_bokeh-3.8.0.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-09-02 21:11:58",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "streamlit",
    "github_project": "streamlit",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "streamlit-bokeh"
}
        
Elapsed time: 0.52737s