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

How to not display ETA and rate #40

Closed
notuxius opened this issue Oct 13, 2015 · 19 comments
Closed

How to not display ETA and rate #40

notuxius opened this issue Oct 13, 2015 · 19 comments
Assignees
Labels
p3-enhancement 🔥 Much new such feature

Comments

@notuxius
Copy link

how to disable viewing of ETA and it/s in progressbar for more minimal output

@lrq3000
Copy link
Member

lrq3000 commented Oct 13, 2015

It's not currently possible to disable the ETA nor it/s, but you can resize the progress bar by using the ncols argument.

@lrq3000
Copy link
Member

lrq3000 commented Oct 13, 2015

But if you really want to do that, and don't mind getting "hacky", you can manually edit these lines to remove what you don't want:

https://github.com/tqdm/tqdm/blob/master/tqdm/_tqdm.py#L135-L136

@casperdcl
Copy link
Sponsor Member

We could add arguments to disable eta, it/s if requested by enough other people. In the mean time, define your own format_meter function based on the comment above....

@lrq3000 lrq3000 changed the title How to don't display ETA and it/s How to not display ETA and rate Nov 10, 2015
@lrq3000 lrq3000 added the p3-enhancement 🔥 Much new such feature label Nov 10, 2015
@casperdcl casperdcl added question/docs ‽ Documentation clarification candidate p5-wont-fix ☮ Sorry and removed p3-enhancement 🔥 Much new such feature labels Nov 11, 2015
@lrq3000
Copy link
Member

lrq3000 commented Nov 30, 2015

Just an idea: we could just add one parameter which would be a list of parameters to show. If none, then it would default to show all parameters.

@lrq3000
Copy link
Member

lrq3000 commented Dec 1, 2015

Another way would be to directly let the user define the template of the bar, like they did here with the format_str argument:

https://github.com/aplavin/ipy-progressbar/blob/ipy2/ipy_progressbar/terminal_bar.py#L13

format_str='%(title)s: %(percent)3d%% [%(bar)s] %(current)d/%(max)d [%(elapsed).1f s] [eta %(eta_avg).0f+-%(eta_stddev).0f s]',

@casperdcl casperdcl added p3-enhancement 🔥 Much new such feature and removed question/docs ‽ Documentation clarification candidate p5-wont-fix ☮ Sorry labels Dec 19, 2015
@casperdcl
Copy link
Sponsor Member

👍 to the custom format (even though it will negatively affect speed)

@lrq3000
Copy link
Member

lrq3000 commented Dec 19, 2015

Yes but the speed decrease will only appear if the user sets a custom
format, else the default format will be used so there won't be any
noticeable effect on speed (apart from the infinitesimal decrease due to
the added if statement ;) ).

2015-12-19 1:16 GMT+01:00 Casper da Costa-Luis notifications@github.com:

[image: 👍] to the custom format (even though it will negatively affect
speed)


Reply to this email directly or view it on GitHub
#40 (comment).

@lrq3000 lrq3000 self-assigned this Dec 27, 2015
@casperdcl
Copy link
Sponsor Member

ok. all done (with custom format string)

@PyTis
Copy link

PyTis commented Mar 29, 2019

I am very confused. Judging by reading all of this, you guys have since added in bar_format as an option.
Judging by the documentation,... l_bar='{desc}: {percentage:3.0f}%|'
So when I specify "for i in tqdm.tqdm(range(int(9e6)), ncols=0, bar_format='{l_bar}', postfix=None): pass"
I should only get the percentage, however, I am getting all output, minus the "bar" itself, which is controlled by ncols. Can someone please help?

79% 7141647/9000000 [00:03<00:00, 2126903.64it/s]

@casperdcl
Copy link
Sponsor Member

@PyTis that'a because you used ncols=0. From the documentation:

ncols : int, optional
The width of the entire output message. If specified,
dynamically resizes the progressbar to stay within this bound.
If unspecified, attempts to use environment width. The
fallback is a meter width of 10 and no limit for the counter and
statistics. If 0, will not print any meter (only stats).

I think you can drop the ncols argument in your case.

@PyTis
Copy link

PyTis commented Apr 1, 2019

You were right! Thank you so very much.

Now, my output is just a percentage, as desired, with one caveat, that I could "live" with, but would much prefer to do without. The percentage is followed by a pipe ("|").

Do you know how I can get rid of that?

Last but not least question, though you need not answer this if you don't want to, I am sure I can figure it out on my own, but what is the "lightest" version of what I am using this for, that I can "export?" I would rather just a single file to pull and add to my code base (proper copyright of original author left in place of course). It would make packaging my project much easier, as it would remove the dependency.

If there isn't such a thing, well if it isn't easy I mean, then perhaps that should be a suggestion to the authors, to package a "light" percentage only version, or at least one where all of the code is,... what is the word I am looking for,... "simplified?" "condensed?"... no,.. AH! "Minified!"

@PyTis
Copy link

PyTis commented Apr 1, 2019

P.S. I have "Watched" and "Stared" this project, I love it, I think it is a great, and very useful library! Thank you very much.

I have some down time right now, and I am working on turning my 150+ personal scripts into useful, documented libraries myself. They are all done, and working, but need "cleaned," and prepped for release.

@casperdcl
Copy link
Sponsor Member

@PyTis

The percentage is followed by a pipe ("|").

Do you know how I can get rid of that?

simply directly use bar_format='{desc}: {percentage:3.0f}%'

what is the "lightest" version of what I am using this for, that I can "export?"
[...] "simplified?" "condensed?"... no,.. AH! "Minified!"

Probably just tqdm/*.py: specifically, _tqdm.py, _utils.py and an edited __init__.py. See https://github.com/conda/conda/tree/master/conda/_vendor/tqdm and future plans at #198 (comment)

I have some down time right now, and I am working on turning my 150+ personal scripts into useful, documented libraries myself. They are all done, and working, but need "cleaned," and prepped for release.

I can help with this and have done the same with some of my scripts - do you have any links to your current code?

@brando90
Copy link

I hate be a complainer to a library that seems to be so well mantained and used but the default setting are confusing. The ETA is shown (I presume) by a less than or equal:

  0%|          | 0/10 [00:00<?, ?it/s]i=0
 10%|█         | 1/10 [00:05<00:45,  5.00s/it]i=1
 20%|██        | 2/10 [00:10<00:40,  5.00s/it]i=2
 30%|███       | 3/10 [00:15<00:35,  5.00s/it]i=3
 40%|████      | 4/10 [00:20<00:30,  5.00s/it]i=4
 50%|█████     | 5/10 [00:25<00:25,  5.00s/it]i=5
 60%|██████    | 6/10 [00:30<00:20,  5.00s/it]i=6

I assume 00:05<00:45 means that 0.05 seconds have passed but the estimation is to take 0.45. Right?

Code:

#%%

from tqdm import tqdm
import time

for i in tqdm(range(10)):
    # time.sleep(0.1)
    time.sleep(5)
    print(f'{i=}')

@casperdcl
Copy link
Sponsor Member

00:05<00:45 means 5 seconds have elapsed and a further (estimated) 45 remain. < is used as an ASCII arrow really rather than a less than sign.

@mh0w
Copy link

mh0w commented Oct 27, 2022

Just chiming in with another example in case it's useful to someone who comes across this post. The code below gives the text "Loading: ", the percentage progress, a vertical bar, and then the progress bar. Full example here.

from tqdm import tqdm
pbar = tqdm(total=100, initial=15, bar_format='Loading: {desc}{percentage:3.0f}%|{bar:10}')

Loading: 15%|█▌

@brando90
Copy link

brando90 commented Nov 1, 2022

@casperdcl so is the invariant that the sum always shows the total time estimated to finish the run?

@brando90
Copy link

00:05<00:45 means 5 seconds have elapsed and a further (estimated) 45 remain. < is used as an ASCII arrow really rather than a less than sign.
SO

Extracting : six-1.16.0-pyhd3eb1b0_1.conda:   0%|          | 1/433 [05:18<38:15:04, 318.76s/it]

means 38 hours remaining?!

@matanox
Copy link

matanox commented May 8, 2024

I guess it would be nice to have more examples on how to modify the progress bar line, in particular reducing the detail level that 35/121 [00:04<00:08, 10.63it/s] is to just 35/121, reducing and adding a la 35/121 segments.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
p3-enhancement 🔥 Much new such feature
Projects
None yet
Development

No branches or pull requests

7 participants