Skip to content

Use explicit autotag imports#6459

Open
snejus wants to merge 3 commits intomasterfrom
use-explicit-autotag-imports
Open

Use explicit autotag imports#6459
snejus wants to merge 3 commits intomasterfrom
use-explicit-autotag-imports

Conversation

@snejus
Copy link
Member

@snejus snejus commented Mar 23, 2026

Replace beets.autotag namespace imports with explicit submodule imports

This PR replaces broad beets.autotag package-level imports with direct imports from their canonical submodules (beets.autotag.hooks and beets.autotag.match).

The change reduces implicit coupling to the beets.autotag re-export surface. Callers now depend on the module that actually defines each symbol, making ownership clear and reducing the risk of circular imports.

Copilot AI review requested due to automatic review settings March 23, 2026 01:45
@snejus snejus requested review from a team and asardaes as code owners March 23, 2026 01:45
@github-actions
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.

Copy link
Contributor

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.

Pull request overview

This PR reduces coupling to beets.autotag package re-exports by switching callers to import symbols directly from their defining modules (beets.autotag.hooks / beets.autotag.match).

Changes:

  • Update app code to import AlbumInfo/TrackInfo/*Match/Proposal/Recommendation directly from beets.autotag.hooks and beets.autotag.match.
  • Update plugins to use explicit autotag submodule imports (e.g., musicbrainz, deezer, mbsubmit, bench).
  • Update tests to use the same explicit imports and remove beets.autotag namespace usage.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
test/ui/commands/test_import.py Switch test imports to beets.autotag.hooks and construct AlbumMatch directly.
test/test_importer.py Replace beets.autotag re-export import with beets.autotag.hooks import.
test/plugins/test_mbpseudo.py Consolidate autotag match/info imports under beets.autotag.hooks.
test/plugins/test_art.py Replace beets.autotag re-export import with beets.autotag.hooks import.
test/autotag/test_match.py Replace beets.autotag.match module import with explicit function imports.
test/autotag/test_distance.py Replace beets.autotag re-export import with beets.autotag.hooks import.
beetsplug/musicbrainz.py Replace beets.autotag.hooks.* references with direct AlbumInfo/TrackInfo imports and type hints.
beetsplug/mbsubmit.py Import Recommendation directly from beets.autotag.match.
beetsplug/mbpseudo.py Update TYPE_CHECKING AlbumMatch import to beets.autotag.hooks.
beetsplug/deezer.py Replace beets.autotag re-export import with beets.autotag.hooks import.
beetsplug/bench.py Replace match.tag_album usage with direct tag_album import/call.
beets/ui/commands/import_/session.py Replace beets.autotag namespace usage with explicit hooks/match imports.
beets/ui/commands/import_/display.py Replace hooks module usage with direct TrackInfo/*Match/Match types from beets.autotag.hooks.
beets/importer/tasks.py Replace autotag.* types/calls with explicit hooks/match imports.
beets/autotag/match.py Stop importing match classes via beets.autotag package surface; import from .hooks directly.

@codecov
Copy link

codecov bot commented Mar 23, 2026

Codecov Report

❌ Patch coverage is 81.08108% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.74%. Comparing base (72b4c77) to head (7ea42c7).
✅ All tests successful. No failed tests found.

Files with missing lines Patch % Lines
beets/ui/commands/import_/session.py 45.45% 4 Missing and 2 partials ⚠️
beetsplug/bench.py 50.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #6459      +/-   ##
==========================================
- Coverage   69.74%   69.74%   -0.01%     
==========================================
  Files         145      145              
  Lines       18495    18497       +2     
  Branches     3007     3007              
==========================================
+ Hits        12899    12900       +1     
- Misses       4967     4969       +2     
+ Partials      629      628       -1     
Files with missing lines Coverage Δ
beets/autotag/match.py 84.72% <100.00%> (-0.11%) ⬇️
beets/importer/tasks.py 90.87% <100.00%> (+0.03%) ⬆️
beets/ui/commands/import_/display.py 81.09% <100.00%> (ø)
beetsplug/deezer.py 17.77% <100.00%> (ø)
beetsplug/mbpseudo.py 79.87% <ø> (ø)
beetsplug/mbsubmit.py 52.63% <100.00%> (ø)
beetsplug/bench.py 26.82% <50.00%> (ø)
beets/ui/commands/import_/session.py 58.51% <45.45%> (+0.18%) ⬆️

... and 1 file with indirect coverage changes

🚀 New features to boost your workflow:
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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