Remove lib parameter from _raw_main and _setup#6547
Merged
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. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #6547 +/- ##
==========================================
- Coverage 71.77% 71.77% -0.01%
==========================================
Files 159 159
Lines 20531 20528 -3
Branches 3266 3264 -2
==========================================
- Hits 14737 14734 -3
Misses 5105 5105
Partials 689 689
🚀 New features to boost your workflow:
|
Contributor
There was a problem hiding this comment.
Pull request overview
PR remove lib param from CLI bootstrap (_raw_main / _setup). Goal: keep test-only hook out of prod code. grug like that idea.
Changes:
- Remove
libinjection path frombeets.ui._setupandbeets.ui._raw_main; always open library via_open_library. - Update test harness
RunMixin.run_commandto patchbeets.ui._open_libraryinstead of passinglibinto_raw_main.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.
| File | Description |
|---|---|
| beets/ui/init.py | Drop lib argument from CLI internals and always close opened library. |
| beets/test/helper.py | Switch tests to patch _open_library and stub lib._close to keep shared lib alive. |
Comments suppressed due to low confidence (1)
beets/ui/init.py:1000
- grug see
mainnow needargsalways. packaging entrypointbeet = "beets.ui:main"callmain()with no args, so runtime TypeError. makeargsoptional (default None) and when None set tosys.argv[1:]before call_raw_main.
def main(args: list[str]) -> None:
"""Run the main command-line interface for beets. Includes top-level
exception handlers that print friendly error messages.
"""
if "AppData\\Local\\Microsoft\\WindowsApps" in sys.exec_prefix:
snejus
reviewed
Apr 18, 2026
lib parameter from _raw_main and `_setuplib parameter from _raw_main and _setup
5146bf0 to
f258c3a
Compare
snejus
approved these changes
Apr 19, 2026
f258c3a to
5120e59
Compare
5120e59 to
7f48672
Compare
snejus
added a commit
that referenced
this pull request
Apr 22, 2026
Fix regression error from #6547. Default value `None` is needed for main function, was removed accidentally.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
The
libparameter on_raw_mainand_setupwas only used by the test harness. Rather than keep testing-specific logic in production code, this PR removes the parameter and updates the test harness to patch_open_libraryinstead.Changelog.(Not needed as this is a purely internal factor imo)