-
Notifications
You must be signed in to change notification settings - Fork 5
Open
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
Nested stqdm loops fail
To Reproduce
stqdm_bug.py:
import streamlit as st
from functools import partial
from stqdm import stqdm
from time import sleep
import logging
progress = partial(stqdm, st_container=st.sidebar)
def subfun(total):
for n in progress(range(total), desc="paragraph"):
sleep(0.1)
pass
sections = "ABCDEFGHIJK"
with progress(total=len(sections), desc="Working on") as pbar:
for section_counter, draft_section in enumerate(sections):
logging.warning(f"counter: {section_counter} / {len(sections)}")
try:
pbar.update(section_counter)
except Exception as ee:
logging.warning(ee)
pbar.set_description(desc=f"Section '{draft_section}'")
subfun(30)
sleep(0.5)streamlit run stqdm_bug.py
Fails while displaying:
Section 'F': : 15it [00:04, 3.24it/s]
Expected behavior
I expect the nested progress bars to run bug-free as tqdm does
Screenshots
raceback (most recent call last):
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/exec_code.py", line 88, in exec_func_with_error_handling
result = func()
^^^^^^
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/streamlit/runtime/scriptrunner/script_runner.py", line 590, in code_to_exec
exec(code, module.__dict__)
File "~/Library/CloudStorage/OneDrive-JNJ/repos/psts-doc-qc/stqdm_bug.py", line 16, in <module>
with progress(total=len(sections), desc="QC-ing") as pbar:
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/tqdm/std.py", line 1140, in __exit__
self.close()
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/stqdm/stqdm.py", line 109, in close
super().close()
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/tqdm/std.py", line 1302, in close
self.display(pos=0)
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/stqdm/stqdm.py", line 97, in display
self.st_display(**self.format_dict)
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/stqdm/stqdm.py", line 89, in st_display
self.st_progress_bar.progress(n / total)
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/streamlit/elements/progress.py", line 146, in progress
progress_proto.value = _get_value(value)
^^^^^^^^^^^^^^^^^
File "~/Library/r-miniconda-arm64/dspy/lib/python3.11/site-packages/streamlit/elements/progress.py", line 74, in _get_value
raise StreamlitAPIException(
streamlit.errors.StreamlitAPIException: Progress Value has invalid value [0.0, 1.0]: 1.363636
if I replace stqdm with tqdm, it works with no issues.
Desktop:
- OS: Apple M1 Max, Sonoma 14.7 (23H124)
- Browser: Chrome
- Version of streamlit: streamlit==1.38.0
- Version of stqdm: stqdm==0.0.5
- Version of tqdm: tqdm==4.66.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working