Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUG] bar_format parameter doesn't seem to be working #93

Open
julienbosse opened this issue Nov 30, 2023 · 3 comments
Open

[BUG] bar_format parameter doesn't seem to be working #93

julienbosse opened this issue Nov 30, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@julienbosse
Copy link

julienbosse commented Nov 30, 2023

Describe the bug

Hi, first of all, thanks for this, it's great ! I'd like to report what I think is a bug. I'm trying to get to display only the progress bar and no additional info. Like this :

Capture d’écran 2023-11-30 à 11 45 27

Unfortunately, with stqdm, even when setting the bar_format parameter, additional info still shows.

Capture d’écran 2023-11-30 à 11 49 30

To Reproduce

Steps to reproduce the behavior :

from stqdm import stqdm
from time import sleep

for item in stqdm(range(10), bar_format="{bar}"):
    sleep(0.5)

I might be missing something, but since stqdm inherits from tdqm, I think this should be working ?

@julienbosse julienbosse added the bug Something isn't working label Nov 30, 2023
@Wirg
Copy link
Owner

Wirg commented Dec 10, 2023

Hi @julienbosse !

Thanks for reaching out.
This is a funny one.

I am going to have to think about it a bit more to have a good solution to this.
What is your objective? Get rid of the text part?

What's happening.
stqdm does not rely on the bar part of tqdm but use st.progress for this part (it looks nicer, and I think it was faster when I first created it).
To do this properly I rely on tqdm.format_meter which do all the formatting logic.
I use ncols=0 which is supposed to shrink the progress bar to 0 and write the result of format meter to st.write.

stqdm/stqdm/stqdm.py

Lines 88 to 89 in b1bdf74

self.st_text.write(self.format_meter(n, total, **{**kwargs, "ncols": 0}))
self.st_progress_bar.progress(n / total)

It appears that there is a shortcut for the ncols case which ignores bar_format and just return a standard format.
https://github.com/tqdm/tqdm/blob/4c956c20b83be4312460fc0c4812eeb3fef5e7df/tqdm/std.py#L620-L621

So I should probably change that, on the other hand, your formatting will return a double bar, which I guess is not what you are looking for.

@anatolec
Copy link

anatolec commented Feb 21, 2024

To do this properly I rely on tqdm.format_meter which do all the formatting logic.

tqdm.format_meter itself relies on bar_format so it's strange that it does not work out of the box

@BSalita
Copy link

BSalita commented Nov 16, 2024

For my use case, I don't want users to see the 'it/s' portion of the message. To users, the message is confusing and of no value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants