-
Couldn't load subscription status.
- Fork 1.9k
Add deprecation warning for musicbrainz.enabled but use it to load the plugin, centralise deprecations handling
#6127
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
base: master
Are you sure you want to change the base?
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. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR centralizes deprecation handling in beets by introducing a new beets/util/deprecation.py module with standardized helper functions, and updates the MusicBrainz plugin loading behavior to always load unless explicitly disabled.
Key Changes:
- Created centralized deprecation system with
deprecate_for_user(),deprecate_for_maintainers(), anddeprecate_imports()functions - Modified MusicBrainz plugin to auto-load when not in plugins list and not disabled, with deprecation warnings
- Migrated all deprecation warnings throughout codebase to use new centralized functions
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| beets/util/deprecation.py | New module providing centralized deprecation helper functions with automatic version calculation |
| beets/util/init.py | Removed old deprecate_imports() function migrated to new deprecation module |
| beetsplug/musicbrainz.py | Updated to use new deprecate_for_user() function for searchlimit option warning |
| beets/ui/init.py | Replaced inline warning with deprecate_for_maintainers() call in decargs function |
| beets/plugins.py | Updated MusicBrainz auto-loading logic and migrated deprecation warnings to new functions |
| beets/mediafile.py | Replaced inline warning with deprecate_for_maintainers() call |
| beets/library/init.py | Updated import and removed version parameter from deprecate_imports() call |
| beets/autotag/init.py | Migrated deprecation warnings to new centralized functions |
| beets/init.py | Updated import and simplified deprecate_imports() call |
| beets/config_default.yaml | Changed default plugins list from [musicbrainz] to [] and added disabled_plugins option |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6127 +/- ##
==========================================
+ Coverage 66.98% 67.03% +0.04%
==========================================
Files 118 119 +1
Lines 18192 18211 +19
Branches 3079 3082 +3
==========================================
+ Hits 12186 12207 +21
+ Misses 5347 5345 -2
Partials 659 659
🚀 New features to boost your workflow:
|
|
I like the additional deprecation warnings, but adding a disabled plugin list doesn't feel right to me when a plugin should be considered disabled by merit of not being on the list of plugins to begin with. My thoughts on a solution to the Musicbrainz problem:
|
musicbrainz.enabled but use it to load the plugin, centralise deprecations handling
Agree with you. I have now updated the logic and added a test to show the behaviour (otherwise there's too much to wrap one's head around!) |
f9b71bd to
2a18445
Compare
2a18445 to
9fdcd0a
Compare
| }, | ||
| name=name, | ||
| version="3.0.0", | ||
| __name__, {"art": "beetsplug._utils", "vfs": "beetsplug._utils"}, name |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try to keep the trailing commas here? I recon we might add more imports here in the future.
See COM812:
The presence of a trailing comma can reduce diff size when parameters or elements are added or removed from function calls, function definitions, literals, etc.
Fixes: #6121
This PR introduces a centralized deprecation system and adjusts
musicbrainzplugin loading to properly handle the deprecatedmusicbrainz.enabledconfiguration option.MusicBrainz
musicbrainz.enabledconfiguration option:true, warns users to explicitly addmusicbrainzto theirpluginsconfiguration and adds it if not already presentfalse, warns users and adds the plugin todisabled_plugins(listreceived by the
--disable-pluginsflag)Deprecations
Created new
beets/util/deprecation.pymodule with standardized deprecation helpers:deprecate_for_user()- logs warnings visible to end usersdeprecate_for_maintainers()- emitsDeprecationWarningfor developersdeprecate_imports()- handles deprecated module imports with automatic version calculation_format_message()- generates consistent deprecation messages that auto-calculate next major versionMigrated all deprecation handling to use the new centralized functions:
warnings.warn()calls throughout codebasedeprecate_imports()signature to remove explicitversionparameterdeprecate_for_user()