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

Fix: tqdm.auto requires ipywidgets for notebook support. #614

Merged
merged 6 commits into from Mar 1, 2022

Conversation

bdice
Copy link
Member

@bdice bdice commented Feb 27, 2022

Description

This is a workaround for half of the issue reported in #602:

The notebook issue is partially caused by #371. tqdm has an automatic mode that detects if it is in a notebook, and shows an HTML progress bar instead of a console one (the console format doesn't render very well in the notebook, I have sometimes seen the \r fail to clear the current line and instead output lots of lines with progress bars). This issue has been reported to tqdm as tqdm/tqdm#1082 and there is a PR tqdm/tqdm#1218 to fix it by falling back to the console progress bar.

This PR does not change the default behavior of showing/not showing progress bars. See #602 for more details on that issue.

This workaround requires tqdm/tqdm#1148, so the minimum tqdm version has been bumped to 4.60.0.

Motivation and Context

Workaround for tqdm/tqdm#1218

Types of Changes

  • Documentation update
  • Bug fix
  • New feature
  • Breaking change1

Checklist:

If necessary:

  • I have updated the API documentation as part of the package doc-strings.
  • I have created a separate pull request to update the framework documentation on signac-docs and linked it here.
  • I have updated the changelog.

@bdice bdice requested review from a team as code owners February 27, 2022 17:26
@bdice bdice requested review from cbkerr and tommy-waltmann and removed request for a team February 27, 2022 17:26
@codecov
Copy link

codecov bot commented Feb 27, 2022

Codecov Report

Merging #614 (1de0014) into master (ff7f972) will increase coverage by 0.00%.
The diff coverage is 88.88%.

❗ Current head 1de0014 differs from pull request most recent head 0330bf4. Consider uploading reports for the commit 0330bf4 to get more accurate results

Impacted file tree graph

@@           Coverage Diff           @@
##           master     #614   +/-   ##
=======================================
  Coverage   79.00%   79.00%           
=======================================
  Files          33       33           
  Lines        3225     3230    +5     
  Branches      688      688           
=======================================
+ Hits         2548     2552    +4     
- Misses        534      535    +1     
  Partials      143      143           
Impacted Files Coverage Δ
flow/project.py 81.04% <ø> (-0.02%) ⬇️
flow/util/misc.py 74.48% <87.50%> (+0.38%) ⬆️
flow/render_status.py 55.31% <100.00%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff7f972...0330bf4. Read the comment docs.

@bdice bdice self-assigned this Feb 27, 2022
@bdice bdice added the bug Something isn't working label Feb 27, 2022
@bdice bdice added this to the v0.19.0 milestone Feb 27, 2022
@bdice bdice requested a review from a team as a code owner February 27, 2022 18:24
@csadorf csadorf removed the request for review from a team February 28, 2022 09:03
@tommy-waltmann
Copy link
Contributor

Since tqdm/tqdm#1218 and tqdm/tqdm#1148 are merged, shouldn't this PR just be a tqdm version bump? Or have they not made a release since fixing those bugs?

@bdice
Copy link
Member Author

bdice commented Feb 28, 2022

@tommy-waltmann That fix was made to tqdm after I created this PR. It doesn't look like tqdm 4.63.0 is out yet, which would include the fix. However, I'm also not sure if the "fix" acts like we want it to. I would like to fall back silently to text-based progress bars if ipywidgets is not available. It seems like the changes made in tqdm will throw a warning that ipywidgets is not available. For now, I know this PR acts like I want (no warnings, just silent fallback from HTML to text progress bars).

Copy link
Contributor

@tommy-waltmann tommy-waltmann left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fair enough, if you want different behavior than the tqdm default then you are going to have to wrap it somehow.

Copy link
Member

@cbkerr cbkerr left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks! The code makes sense and I checked with the tqdm docs.
I didn't test it locally.

@bdice bdice enabled auto-merge (squash) March 1, 2022 19:22
@bdice bdice merged commit 6137f70 into master Mar 1, 2022
@bdice bdice deleted the tqdm-auto-requires-ipywidgets branch March 1, 2022 19:35
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

Successfully merging this pull request may close these issues.

None yet

3 participants