Conversation
|
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. |
bc02408 to
c64e577
Compare
There was a problem hiding this comment.
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:
|
@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)
Someone should probably open a new PR to fix all TC006 warnings, include I do get the same TC006 error if I locally run the system-installed ruff 0.11.0. |
7ab870e to
f42279b
Compare
|
Is there a way to disable the progress bar? We’re running in a containerized environment without a cli UI, where all 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 You might be best actually just using |
Great points, thank you. I'll add that condition as well. |
c698875 to
83155c0
Compare
peterjdolan
left a comment
There was a problem hiding this comment.
I've addressed your comments to the best of my ability, and left unresolved the comments that I had questions on. Thanks for your review!
| for line in error_lines: | ||
| ui.print_(line) | ||
|
|
||
| with concurrent.futures.ThreadPoolExecutor() as executor: |
There was a problem hiding this comment.
The base implementation uses par_map to parallelize the operation instead of simply looping in the main thread. I'm trying to maintain all existing logic, so I'm maintaining the thread-parallel structure
However, par_map's implementation is incompatible with the enlighten progress bar - it delegates work to threads and it's not possible to update the progress bar from different threads. So, instead we use a thread pool executor to achieve the same type of parallelism while keeping the progress bar iterator operating in the main thread.
If you'd rather, I could simplify this by removing the thread-parallelism, but in my testing it improves speed (over a NAS connection) by about an order of magnitude.
beetsplug/badfiles.py
Outdated
| return None | ||
|
|
||
| def check_item(self, item): | ||
| def check_item(self, item: library.Item) -> tuple[bool, list[str]]: |
There was a problem hiding this comment.
Ah, I thought I'd do a little code health improvements while I'm here, but yes it's muddying the commit's changes. I'll revert them.
beetsplug/duplicates.py
Outdated
| ): | ||
| values = [getattr(obj, k, None) for k in keys] | ||
| values = [v for v in values if v not in (None, "")] | ||
| values = list(filter(lambda v: v not in (None, ""), values)) |
beetsplug/missing.py
Outdated
| if count: | ||
| fmt += ": $missing" | ||
|
|
||
| for album in albums: | ||
| if count: | ||
| for album in ui.iprogress_bar( | ||
| albums, desc="Analyzing albums", unit="albums" | ||
| ): | ||
| if _missing_count(album): | ||
| print_(format(album, fmt)) | ||
|
|
||
| else: | ||
| else: | ||
| for album in albums: |
There was a problem hiding this comment.
Ah, my mistake. I had misread the original logic and thought there was a bug, but I understand it now. Reverted.
| os.path.join(lib.directory, x.encode()) | ||
| for x in self.config["ignore_subdirectories"].as_str_seq() | ||
| ] | ||
| in_folder = set() |
There was a problem hiding this comment.
Reverted. Thank you, and will do.
beetsplug/unimported.py
Outdated
| and file not in art_files | ||
| ) | ||
|
|
||
| with ui.changes_and_errors_pbars( |
There was a problem hiding this comment.
My mistake, it was left over from a previous revision. I've resolved this error, and we should improve test coverage for this plugin.
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 a method to beets.ui - beets.ui.iprogress_bar - which can be used by Beets' core commands and all Beets plugins. Example usage is provided in the methods' documentation and in a new 'further reading' doc for developers. 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. Progress Bars are disabled also when not in a TTY, to prevent interference with logging when running as a web server, for example.
- Add lib.items_with_progress, lib.albums_with_progress - Code formatting and style - Update docs
|
@snejus it seems that 'poe format-docs' reformats virtually all of the docs; should I do so, or would you like another PR that does so that I can submit first? |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #5692 +/- ##
==========================================
+ Coverage 69.33% 69.59% +0.26%
==========================================
Files 141 141
Lines 18788 18831 +43
Branches 3061 3067 +6
==========================================
+ Hits 13026 13105 +79
+ Misses 5117 5078 -39
- Partials 645 648 +3
🚀 New features to boost your workflow:
|
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
enlightenpython 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
docs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)Example screenshot