Skip to content

Wirg/stqdm

Repository files navigation

stqdm

Tests codecov CodeQL Downloads Supported Python Versions pypi version

stqdm is the simplest way to handle a progress bar in streamlit app.

demo gif

How to install

pip install stqdm

Development

This project uses uv for packaging and dependency management, with mise managing local tools and sourcing uv's .venv. Trust the local mise config once, then install tools and dependencies:

mise trust
mise install
mise run install
mise run test

mise manages local tools, uv manages the project environment and lockfile, and nox creates isolated compatibility environments. Nox is configured to use uv as its virtualenv backend when available.

Compatibility checks are managed with nox:

mise run nox-list
mise run compat

How to use

You can find some examples in examples/

Use stqdm in main

from time import sleep
from stqdm import stqdm

for _ in stqdm(range(50)):
    sleep(0.5)

Use stqdm in sidebar

from time import sleep
import streamlit as st
from stqdm import stqdm

for _ in stqdm(range(50), st_container=st.sidebar):
    sleep(0.5)

Customize the bar with tqdm parameters

demo gif

from time import sleep
from stqdm import stqdm

for _ in stqdm(range(50), desc="This is a slow task", mininterval=1):
    sleep(0.5)

Display a progress bar during pandas Dataframe & Series operations

STqdm inherits from tqdm, you can call stqdm.pandas() in a similar way. See tqdm docs.

from time import sleep

import pandas as pd
from stqdm import stqdm

stqdm.pandas()

pd.Series(range(50)).progress_map(lambda x: sleep(1))
pd.Dataframe({"a": range(50)}).progress_apply(lambda x: sleep(1), axis=1)

Display the progress bar only in the frontend or the backend

from time import sleep

from stqdm import stqdm

# Default to frontend only
for i in stqdm(range(50), backend=False, frontend=True):
    sleep(0.5)


for i in stqdm(range(50), backend=True, frontend=False):
    sleep(0.5)

About

stqdm is the simplest way to handle a progress bar in streamlit app.

Topics

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors

Languages