streamlit-javascript
component to run javascript code in streamlit application
What it is and what it does
Streamlit-javascript is a Streamlit component that bridges Python and browser-side JavaScript execution. It lets you run arbitrary JavaScript code in the user's browser from within a Streamlit app and capture the result back in Python. This is useful when you need to perform operations that only the browser can do—like making cross-origin API calls, accessing browser APIs, or manipulating the DOM—without leaving your Streamlit application.
The package wraps a single function, `st_javascript()`, that takes a JavaScript code string and executes it in the browser session. The return value flows back to Python as a variable you can use in your app logic. It depends only on Streamlit itself, so installation is straightforward. However, the package has not been updated since May 2022, and the last commit was in April 2025, which means it may not be fully tested against recent Streamlit versions.
Use it for:
- Make browser-based API calls (e.g., fetch from external services) that would otherwise be blocked by CORS in a pure Python backend.
- Access browser-specific data like geolocation, local storage, or device information and pass it back to your Streamlit app.
- Execute client-side validation or transformation logic without a round-trip to the server.
- Integrate third-party JavaScript libraries that need to run in the browser context within your Streamlit UI.
- Prototype or debug JavaScript behavior directly within a Streamlit application without building a separate frontend.
Worth the install?
AI-flagged interpretation of the facts on this page — verify before relying
Executes arbitrary JavaScript code from within a Streamlit application and returns the result to Python, enabling browser-side operations like API calls and DOM manipulation.
Yes, if you need browser-side JavaScript execution in Streamlit and can tolerate aging maintenance. The package is simple, has no known vulnerabilities, and carries a permissive license. However, verify compatibility with your Streamlit version before relying on it in production, and be aware that browser security policies may limit what the JavaScript can do.
Install
streamlit-javascript on PyPI
pip
pip install streamlit-javascriptuv
uv add streamlit-javascriptpoetry
poetry add streamlit-javascriptInstalling streamlit-javascript
Before you install
Low friction install with a single runtime dependency on streamlit. Maintenance status is aging—last release was in 2022 and no commits since April 2025, though the repository remains active and the package is not archived.
License in practice
MIT license permits commercial and private use with minimal restrictions, making it safe to adopt in most projects.
Quickstart
pip install streamlit-javascript
import streamlit as st
from streamlit_javascript import st_javascript
return_value = st_javascript("""await fetch("https://example.com/api").then(r => r.json())""")
st.write(return_value)
Requires Streamlit to be installed and running; JavaScript execution happens in the browser, so network requests and DOM access are subject to browser security policies.
Verify before relying
- Whether the package works reliably with current versions of Streamlit (last release predates many recent Streamlit updates).
- Whether browser security policies (CORS, CSP) may block the JavaScript execution in production deployments.
- Performance and latency characteristics when executing complex JavaScript or making multiple API calls.
Package facts
| License | not declared (permissive) |
| Python support | supports the current Python release (>=3.6) |
| Install friction | low — pure-Python wheel |
| Runtime dependencies | 1 — streamlit |
| Maintenance | aging — 1,554 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 295,501/month — #7,921 on PyPI (30-day window, as of 2026-08-14) |
| Known vulnerabilities | none known (OSV.dev, checked 2026-08-14) |
Evidence: streamlit_javascript-0.1.5-py3-none-any.whl
Tags
More Application Frameworks packages
FastAPI is a Python web framework for building…
permissive · top 100 on PyPI
annotated-docProvides a way to document function parameters,…
permissive · top 100 on PyPI
textualTextual is a Python framework for building…
permissive · top 100 on PyPI
typerTyper builds command-line applications from…
permissive · top 1,000 on PyPI
mcpBuild and connect to Model Context Protocol…
permissive · top 1,000 on PyPI
WerkzeugWerkzeug is a WSGI utility library providing…
permissive · top 1,000 on PyPI
streamlit-cookies-controllerProvides read, write, and delete operations on…
permissive · top 15,000 on PyPI
streamlit-aceEmbeds an Ace code editor component into…
permissive · top 15,000 on PyPI
streamlit-js-evalStreamlit-js-eval lets you run arbitrary…
unclear · top 15,000 on PyPI
streamlit-code-editorEmbeds an interactive code editor component…
unclear · top 15,000 on PyPI
streamlit-plotly-eventsCaptures click, select, and hover events from…
unclear · top 15,000 on PyPI
telepathtelepath serializes Python objects to…
permissive · top 5,000 on PyPI
streamlit-camera-input-liveProvides a Streamlit component that captures…
unclear · top 15,000 on PyPI
streamlit-autorefreshAdds a frontend timer to Streamlit apps that…
unclear · top 15,000 on PyPI
streamlit-avatarRenders clickable avatar icons with images,…
unclear · top 15,000 on PyPI
pywebviewpywebview wraps native webview components to…
permissive · top 5,000 on PyPI