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

Make dynamic_ncols=True the default #370

Closed
2 tasks done
anntzer opened this issue Apr 9, 2017 · 6 comments · Fixed by #1491
Closed
2 tasks done

Make dynamic_ncols=True the default #370

anntzer opened this issue Apr 9, 2017 · 6 comments · Fixed by #1491
Assignees
Labels
c3-small 🕒 Complexity medium p3-enhancement 🔥 Much new such feature question/docs ‽ Documentation clarification candidate
Projects

Comments

@anntzer
Copy link
Contributor

anntzer commented Apr 9, 2017

Any reason why dynamic_ncols is not True by default?

@casperdcl
Copy link
Sponsor Member

could slow things down to constantly check terminal width. The ethos of tqdm is to be as fast as possible with default parameters, and to make it easy to make it even prettier at minimal cost by tweaking parameters. If there are enough votes to change a default, we'd be happy to do so.

@achalddave
Copy link

achalddave commented Sep 16, 2018

Sorry to comment on a closed issue, but is this the right place to vote for this? I frequently run into this issue when working with long-running python scripts in tmux panes. A common use case for me is that I "zoom" into a pane when running the script and then zoom back out once I see a progress bar. Unfortunately, this doesn't work by default with tqdm. I only just found out about dynamic_ncols after a year or so of using tqdm, so my alternative for now is to ensure I add dynamic_ncols=True every time I use tqdm in any interactive script.

As far as I can tell from here, the overhead due to dynamic resizing is relatively small. However, if it cannot be added as a default, would it be possible to add an environment variable or a config that tqdm could check for to enable dynamic ncols? This would let me avoid having to add dynamic_ncols=True to every incantation of tqdm in my scripts :)

@ThyrixYang
Copy link

ThyrixYang commented Nov 20, 2019

I found it really annoying that I need to check the dynamic_ncols every time, I think there should be something dedicated for tmux use case like

from tqdm import dynamic_tqdm as tqdm

that would work for any legacy code.
If it's ok may I open a PR for it?
I believe this will be more convenient than a global config and can switch between different cases easily.

@casperdcl
Copy link
Sponsor Member

Could just add this to the top of your library:

from functools import partial
from tqdm import tqdm as std_tqdm
tqdm = partial(std_tqdm, dynamic_ncols=True)

@ThyrixYang
Copy link

@casperdcl Awesome! Thank you.

@casperdcl casperdcl self-assigned this Nov 20, 2019
@casperdcl casperdcl added the question/docs ‽ Documentation clarification candidate label Nov 20, 2019
casperdcl added a commit that referenced this issue Nov 20, 2019
MatthieuBizien added a commit to MatthieuBizien/tqdm that referenced this issue Mar 21, 2020
MatthieuBizien added a commit to MatthieuBizien/tqdm that referenced this issue Dec 20, 2020
casperdcl added a commit that referenced this issue Aug 5, 2023
- fixes #370, fixes #612, fixes #619, fixes #1318
- closes #950, closes #1061
casperdcl added a commit that referenced this issue Aug 8, 2023
- fixes #370, fixes #612, fixes #619, fixes #1318
- closes #950, closes #1061
casperdcl added a commit that referenced this issue Aug 8, 2023
- fixes #370, fixes #612, fixes #619, fixes #1318
- closes #950, closes #1061
@casperdcl casperdcl added p3-enhancement 🔥 Much new such feature c3-small 🕒 Complexity medium labels Aug 9, 2023
@casperdcl
Copy link
Sponsor Member

Thanks everyone for your patience! Just released tqdm==4.66.0 which includes support for env var overrides. I'm using TQDM_MININTERVAL=5 in most of my CI jobs now :)

@casperdcl casperdcl added this to Done in Casper Aug 9, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
c3-small 🕒 Complexity medium p3-enhancement 🔥 Much new such feature question/docs ‽ Documentation clarification candidate
Projects
Casper
  
Done
Development

Successfully merging a pull request may close this issue.

4 participants