Feature: Add progress bars
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. This PR does not modify the import workflow, rather only modifies several built-in plugins. Modifying the import workflow to display a progress bar will be done in a follow-up PR.
See tracking issue
To Do
- [x] Documentation. (If you've added a new command-line flag, for example, find the appropriate page under
docs/to describe it.) - [x] Changelog. (Add an entry to
docs/changelog.rstto the bottom of one of the lists near the top of the document.) - [x] Tests. (Very much encouraged but not strictly required.)
Example screenshot
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.
Import operation partially implemented; still needs some work. Example screenshot above.
@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.
This seems to be related to some combination of (although I'm not seeing the full picture yet)
- you regenerated the lockfile, which now chooses a newer version of ruff
- https://github.com/astral-sh/ruff/blob/6bdffc3cbff2194afdff0e46fccb03cf6147d367/CHANGELOG.md?plain=1#L987
- https://github.com/astral-sh/ruff/pull/14511
- maybe, you're still running another ruff version locally
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.
Is there a way to disable the progress bar?
We’re running in a containerized environment without a cli UI, where all stdout and stderr are redirected into log files. In similar cases, progress libraries (e.g. tqdm) tend to generate a lot of noisy log output, as each terminal update is written as a new line. I’m not sure how enlighten handles this and was not able to derive this from their docs.
Just wanted to mention this here to spare us some trouble down the line. Do you see any other problems regarding this use case?
It looks like this needs to replicate the check enlighten.get_manager does - disabling the manager if the output is not a TTY.
You might be best actually just using enlighten.get_manager and passing enabled to that, as it will only enable the manager if the provided enable value was true and the stream is a TTY.
It looks like this needs to replicate the check
enlighten.get_managerdoes - disabling the manager if the output is not a TTY.You might be best actually just using
enlighten.get_managerand passing enabled to that, as it will only enable the manager if the provided enable value was true and the stream is a TTY.
Great points, thank you. I'll add that condition as well.
This is now ready for review. I'm not certain how to request a review, though. Anybody have pointers?