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 and enhancement requests 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)
📦 Installation
uv pip install streamlit-bokeh
Ensure you have Streamlit and Bokeh installed as well:
uv pip install streamlit bokeh
🛠️ Development
Prerequisites
- Python 3.10–3.13
- Node.js 24.x.y (see
.nvmrc) - uv (fast Python package manager)
1) Create and activate a virtual environment
uv venv .venv
source .venv/bin/activate
2) Install Python dependencies from pyproject.toml
# Minimal runtime install (editable)
uv pip install -e .
# Recommended for development (includes tests/tools)
uv pip install -e ".[devel]"
3) Install and build the frontend
cd streamlit_bokeh/frontend
corepack enable
yarn install
yarn build # one-time build to produce frontend/build assets
# Optional: frontend dev server
# Use `yarn dev:v2` to utilize the Custom Component v2 frontend (recommended).
# Use `yarn dev:v1` to utilize the Custom Component v1 frontend (legacy).
yarn dev:v2
4) Run a local demo
streamlit run ./e2e_playwright/bokeh_chart_basics.py
5) Run tests
Python end-to-end tests (Playwright):
# Build the package (clear dist/ first, so the glob below matches one wheel)
rm -rf dist
uv build
# Install the test dependencies and the package you just built.
# --reinstall matters on a rebuild: installing the same version again is
# otherwise a no-op, so the tests would run against the previous frontend build.
uv pip install -r e2e_playwright/test-requirements.txt
uv pip install --reinstall dist/*.whl
# Install browsers (first time only)
python -m playwright install --with-deps
# Run tests
pytest e2e_playwright -n auto
Frontend tests and type checks:
cd streamlit_bokeh/frontend
yarn test
yarn typecheck
6) Build the Python package (optional)
uv build
ls dist/
💡 Usage
Here's how to integrate a simple Bokeh line plot into your Streamlit app:
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=True, 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 isTrueby default. -
theme(str or None, optional): The theme for the plot. This can be:"streamlit"(default): Matches Streamlit's current theme, including light and dark mode.- One of Bokeh's built-in themes:
"caliber""contrast""dark_minimal""light_minimal""night_sky"
None: Applies no theme, so the figure renders exactly as Bokeh would draw it on its own.
Any other value raises an error. Note that Bokeh's
"carbon"theme is not supported: it exists in Bokeh's Python package but is not included in BokehJS, so it cannot be applied in the browser. -
key(str, optional but recommended): An optional string to give this element a stable identity. If this isNone(default), this element's identity will be determined based on the values of the other parameters.
Theming and your own styling
Styling you set on the figure always wins over the theme. A theme only fills in what you left unspecified.
Because Bokeh builds one visual decision out of several properties — a line needs a colour, an alpha and a width to be drawn — setting only a colour used to leave the theme supplying the alpha, which could hide the element you had just styled. Setting a line colour now makes that line render at Bokeh's default opacity instead of the theme's:
# Renders as fully opaque red, under every theme.
plot.xaxis.major_tick_line_color = "red"
# Set the matching alpha to control opacity yourself.
plot.xaxis.major_tick_line_color = "red"
plot.xaxis.major_tick_line_alpha = 0.25
This applies to line properties only — ticks, axis lines, grid lines, outlines, borders. Fill, text and hatch opacity is still left to the theme, because a theme's fill opacity can be keeping text on top of it readable. If you set legend.background_fill_color, for example, the theme keeps the background translucent; set legend.background_fill_alpha yourself if you want it opaque.
🖼️ Example
streamlit run app.py
Where app.py contains:
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.
Contributions are welcome 🚀, however, please inform us before building a feature.
📄 License
This project is licensed under the Apache 2.0.
🙋 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-bokehfocuses on plots. For widget interactivity, consider combining with native Streamlit widgets.
Q: How do I adjust the plot size?
- A: Use
use_container_width=Truefor responsive sizing, or manually setplot_widthandplot_heightin your Bokeh figure.
Happy Streamlit-ing! 🎉
Metadata
Release files for streamlit-bokeh 3.10.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| streamlit_bokeh-3.10.1.tar.gz | 1.6 MB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_bokeh-3.10.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 3.3 MB
Release files / streamlit_bokeh-3.10.1.tar.gz
| Download URL | streamlit_bokeh-3.10.1.tar.gz |
|---|---|
| Size | 1.6 MB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e53d92e44ce121ca6bba7381886e9a89e5fb9f29d6be70fdf903bf3ae594a7f2
|
|
BLAKE2b-256 checksum How to use checksums |
3508edf3265938207b1a5e0de8535e1b9e59e70c35656c0f302feffa7bff44cb
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency logRelease files / streamlit_bokeh-3.10.1-py3-none-any.whl
| Download URL | streamlit_bokeh-3.10.1-py3-none-any.whl |
|---|---|
| Size | 1.6 MB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
4ed7475e94039e581868a75435f06dbb9530e133c97c718244d29d97057c3c35
|
|
BLAKE2b-256 checksum How to use checksums |
189f19d917710ca0ee1e9bb7d7f967525ca74510ab5328e5f3e71e3cc717a038
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Sep 14, 2026.
Transparency log