stqdm
stqdm provides an easy-to-use progress bar for Streamlit applications, integrating the functionality of the popular `tqdm` library with Streamlit's `st.progress`. The current version is 0.0.5, released in January 2023, and the library is actively maintained for compatibility with newer Python, Streamlit, and tqdm versions, though with an irregular release cadence.
Warnings
- gotcha Stopping a Streamlit app (e.g., via the 'Stop' button in the UI) while an `stqdm` loop is active can cause the app to freeze or the progress bar to become unresponsive on subsequent reruns. A full console restart is often required to recover.
- deprecated In versions prior to 0.0.5, `stqdm` had issues with iterators that did not provide a predefined length or total, such as generators. The progress bar might not display correctly or update as expected.
- gotcha Using multiple `stqdm` instances in an application, particularly across reruns, might lead to issues where Streamlit fails to reload. This has been reported as an issue related to a `last_print_t` attribute.
- gotcha There are reported limitations and 'weird interactions' when using `stqdm` in conjunction with multithreading within a Streamlit application. Direct `tqdm` (and by extension `stqdm`) updates from non-Streamlit threads might not propagate correctly.
Install
-
pip install stqdm
Imports
- stqdm
from tqdm import tqdm
from stqdm import stqdm
- stqdm.pandas
from stqdm import stqdm stqdm.pandas()
Quickstart
import streamlit as st
import time
from stqdm import stqdm
st.title('stqdm Demo')
if st.button('Start Progress Bar'):
for i in stqdm(range(50), desc="Processing items"):
time.sleep(0.1)
st.success("Processing complete!")
if st.button('Start Progress Bar in Sidebar'):
with st.sidebar:
for i in stqdm(range(20), desc="Sidebar progress"):
time.sleep(0.2)
st.success("Sidebar processing complete!")