Streamlit-Notify
A Streamlit component that provides status elements that persist across reruns.
Demo App: https://st-notify.streamlit.app/
Installation
pip install streamlit-notify
Documentation
Full documentation is available at Read the Docs.
To build the documentation locally:
cd docs
pip install -r requirements.txt
make html
Then open docs/build/html/index.html in your browser.
Supported Status Elements
stn.toast: Toast notificationsstn.balloons: Balloon animationsstn.snow: Snow animationsstn.success: Success messagesstn.info: Info messagesstn.error: Error messagesstn.warning: Warning messagesstn.exception: Exception messages
How It Works
This package wraps standard Streamlit status element to enable queueing. Notifications are stored in Streamlit's session state and displayed during the next rerun cycle.
Basic Usage
import streamlit as st
import streamlit_notify as stn
# Display all queued notifications at the beginning of your app. This will also clear the list.
stn.notify()
# Add a notification that will be displayed on the next rerun
if st.button("Show Toast"):
stn.toast("This is a toast message", icon="✅")
st.rerun()
if st.button("Show Balloons"):
stn.balloons()
st.rerun()
if st.button("Show Success Message"):
stn.success("Operation successful!")
st.rerun()
Priority Support
# Higher priority notifications are displayed first
stn.info("High priority message", priority=10)
stn.info("Low priority message", priority=-5)
Passing User Data
# Higher priority notifications are displayed first
stn.info("High priority message", data="Hello World")
stn.info("Low priority message", data={'Hello': 'World'})
Getting all notifications
# returns a dict mapping notification types to list of notifications
notifications = stn.get_notifications()
error_notifications = notifications['error']
toast_notifications = notifications['toast']
# or you can get the notifications directly from the stn widget
error_notifications = stn.error.get_notifications()
Clearing notifications
# clears all notifications
stn.clear_notifications()
# clears notifications of only a specific type
stn.error.clear_notifications()
Checking if any notifications need to be shown
# check if any notifications exist across all types
stn.has_notifications()
# check only specific type
stn.error.has_notifications()
Metadata
Release files for streamlit-notify 0.3.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_notify-0.3.1.tar.gz | 15.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| streamlit_notify-0.3.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 25.6 kB
Release files / streamlit_notify-0.3.1.tar.gz
| Download URL | streamlit_notify-0.3.1.tar.gz |
|---|---|
| Size | 15.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
89e2f0655059571df84952a2875ce27e6e43cfea871e69da95dfcf3a23caa445
|
|
BLAKE2b-256 checksum How to use checksums |
9e1e2e6f3747bd98658985403ba32e8aa91bfc9f561b479c2d9450fa0537f340
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|
Release files / streamlit_notify-0.3.1-py3-none-any.whl
| Download URL | streamlit_notify-0.3.1-py3-none-any.whl |
|---|---|
| Size | 9.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
83154dd247a8daa70db8d254fe01247aa17c46101ccf40bb133a94dbee4fc958
|
|
BLAKE2b-256 checksum How to use checksums |
bb71ce3b6c85a793f1ec2d4c4ea3b70ea5a86b7554003cc179a84fd105cc9f0f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.9.23
|