Skip to content

Feature: Add progress bars #5692

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Conversation

peterjdolan
Copy link
Contributor

@peterjdolan peterjdolan commented Mar 26, 2025

Description

Many long-running commands produce little or no feedback in the terminal to indicate that they're progressing, and none of them provide estimates of how long the operation will run. This change introduces the enlighten python package, which displays progress bars akin to TQDM below the existing terminal output.

See tracking issue

To Do

  • Documentation. (If you've added a new command-line flag, for example, find the appropriate page under docs/ to describe it.)
  • Changelog. (Add an entry to docs/changelog.rst to the bottom of one of the lists near the top of the document.)
  • Tests. (Very much encouraged but not strictly required.)

Example screenshots

Screenshot 2025-04-09 204941
Screenshot 2025-04-10 103457

Copy link

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

@peterjdolan peterjdolan changed the title Add progress bars to several commands. Feature: Add progress bars Apr 7, 2025
@peterjdolan
Copy link
Contributor Author

Import operation partially implemented; still needs some work. Example screenshot above.

@snejus snejus requested review from snejus and Copilot and removed request for snejus April 14, 2025 01:04
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 24 out of 25 changed files in this pull request and generated 2 comments.

Files not reviewed (1)
  • docs/changelog.rst: Language not supported

@peterjdolan peterjdolan force-pushed the tqdm branch 3 times, most recently from bc02408 to c64e577 Compare April 14, 2025 18:52
@peterjdolan peterjdolan requested a review from Copilot April 17, 2025 03:10
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Copilot reviewed 24 out of 25 changed files in this pull request and generated no comments.

Files not reviewed (1)
  • docs/changelog.rst: Language not supported
Comments suppressed due to low confidence (1)

beetsplug/replaygain.py:1560

  • Removal of the SystemExit and KeyboardInterrupt exception handling in the replaygain command may affect how user interruptions are managed. Please confirm that propagating these exceptions, rather than silencing them, is the intended behavior.
finally:

@peterjdolan
Copy link
Contributor Author

@snejus I'm not sure why the latest push is failing the automatic lint and formatting; it passes 'poetry run poe lint && poetry run poe format' on my machine just fine. Any suggestions? I've already sync'd my fork to beets master and rebased.

Many long-running commands produce little or no feedback in the terminal to
indicate that they're progressing, and none of them provide estimates of how
long the operation will run. This change introduces the `enlighten` python
package, which displays progress bars akin to TQDM below the existing terminal
output.

To support consistent use and presentation of the progress bars, and to
allow for future modification, we introduce two methods to beets.ui -
beets.ui.iprogress_bar, and beets.ui.changed_unchanged_error_pbars -
which can be used by Beets' core commands and all Beets plugins. Example
usage is provided in the methods' documentation.

Integrating progress bars into the 'import' command required a more
custom implementation than the beets.ui.* commands could support. The
approach taken is certainly open to discussion.

Notably, the Enlighten library does not work as well in Windows
PowerShell as it does in a linux terminal (manually tested in Zsh), so
the progress bars are disabled in Windows environments. Resolving these
issues and enabling them in Windows is left as future work.
@wisp3rwind
Copy link
Member

wisp3rwind commented Apr 22, 2025

This seems to be related to some combination of (although I'm not seeing the full picture yet)

Someone should probably open a new PR to fix all TC006 warnings, include TC in our ruff rule selection instead of TCH, and probably fix ruff to a major version (a 0.X.*). Since major ruff updates might contain breaking rule/style changes, I'd guess that we'd only want to bump it manually.

I do get the same TC006 error if I locally run the system-installed ruff 0.11.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants