Skip to main content

Easy progress bar for streamlit based on the awesome streamlit.progress and tqdm

Project description

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

Maintenance Status

STqdm is intentionally small and low-churn, but it is actively maintained for compatibility and security.

The public API is kept close to tqdm, supported combinations are tracked in CI, and security reports should be sent privately through SECURITY.md.

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 run the Streamlit demo app from demo/app/Home.py. The live deployment is available at stqdm-demo.streamlit.app.

The demo surface and the behaviors it covers are documented in demo/FEATURES.md.

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)

Setting Default Configuration

stqdm can set default configuration for all future progress bars.

from time import sleep

from stqdm import stqdm

# Set default configuration to suppress frontend display
stqdm.set_default_config(frontend=False)

# Utilize stqdm with the default configuration
# It will use the new default configuration with frontend=False
for _ in stqdm(range(50)):
    sleep(0.5)

Scoped Configuration

Use scope to temporarily override default arguments in a with block.

from time import sleep

import streamlit as st
from stqdm import stqdm

# Override default settings temporarily within a scope
with stqdm.scope(desc="Processing", bar_format="{desc}"):
    for _ in stqdm(range(10)):
        sleep(0.5)

# Outside the scope, stqdm reverts to the default settings
for _ in stqdm(range(10)):
    sleep(0.5)

# Attach all the stqdm instances used inside the scope
# to the sidebar, then go back to normal
with stqdm.scope(st_container=st.sidebar):
    function_1()
    function_2()

Going further with configuration management

See the Streamlit demo app for the complete scoped configuration example.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

stqdm-0.2.0.tar.gz (431.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

stqdm-0.2.0-py3-none-any.whl (13.0 kB view details)

Uploaded Python 3

File details

Details for the file stqdm-0.2.0.tar.gz.

File metadata

  • Download URL: stqdm-0.2.0.tar.gz
  • Upload date:
  • Size: 431.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for stqdm-0.2.0.tar.gz
Algorithm Hash digest
SHA256 896a4c033f7fc5a3058a0009e397d54bff5585db56fe43afcb83f51f402feee8
MD5 19a47d1121007732f679705079911fa6
BLAKE2b-256 22026bf3fc8f2c572c8f7f317ab8e0fc876e5985fd7f2fecc77776c90a8a2278

See more details on using hashes here.

File details

Details for the file stqdm-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: stqdm-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.17 {"installer":{"name":"uv","version":"0.11.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for stqdm-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 61fee779ad636358acac4e047aaa54ea7aeb23f8b16c11b54b2d186ddc2d9ec2
MD5 8341ec9c3c0162d5370097c83c636e8e
BLAKE2b-256 ca5ba3b275b548192a05ab2e28e1b3c632ee93b506ddb51569362feb3b1ed18a

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page