avoid linter error
avoid other linter error
fix format
changing deps (no lock!)
poetry lock?
lint & format
attempt 2 at poetry lock
crlf -> lf line endings
changelog!
This PR:
1. Reorganizes distance-related code by moving it from `hooks.py` and
`match.py` to a new dedicated `distance.py` module:
- The actual implementation logic and algorithms remain unchanged - code
is moved, not rewritten
- Distance class, string distance functions, and track/album distance
calculators are relocated intact
- Only imports and function references are updated to maintain
compatibility
- `current_metadata` function is replaced with equivalent
`get_most_common_tags` function for clarity
2. Refactors the distance testing code from unittest to pytest:
- Tests now use fixtures and parametrization while verifying the same
functionality
- The tested behaviors remain identical, just with improved test
structure
- Actually, `distance.py` coverage slightly increased since I included
an additional test
3. Adds a test for the `sanitize_pairs` function to complete config
utility test coverage
This is primarily a code organization improvement that follows better
separation of concerns, grouping related distance functionality in a
single module without changing how the distance calculations work. No
algorithm changes or behavior modifications were made to the core
distance calculation code - it was simply moved to a more appropriate
location.
## Description
Fixes#5560. Also a couple other incidental changes / improvements:
* Add `EventType` that holds the actual string literals used for event
sending. With type checking, this can prevent subtle bugs resulting from
misspelled event names.
* Fix `HiddenFileTest` by using `bytestring_path()`
## To Do
- [x] ~Documentation.~
- [x] Changelog.
- [x] Tests.
---------
Co-authored-by: J0J0 Todos <jojo@peek-a-boo.at>
Co-authored-by: J0J0 Todos <2733783+JOJ0@users.noreply.github.com>
Adds replace plugin. The plugin allows the user to replace the audio
file of a song, while keeping the tags and file name.
Some music servers keep track of favourite songs via paths and tags. Now
there won't be a need to 'refavourite'. Plus, this skips the
import/merge steps.
## Description
Fixes#5802.
Today, tests fail on most Windows machines because we hard-code `D:` as
the root drive, but most machines use `C:`. This change uses the same
normalization function in the test assertion to ensure the drives match.
## To Do
- [ ] ~~Documentation.~~
- [x] Changelog.
- [x] Tests. (this is a tests change)
## What changed?
* Updated tests to generate the drive name via normalization, instead of
hard-coding `D:`.
* Updated the `Item::destination()` method to document the
`relative_to_libdir` param.
## How tested?
* [x] Tests pass locally.
Speed up tests by using `unittest.TestCase` for tests that don't require
directory setup
This PR improves test performance by switching several test classes from
`BeetsTestCase` to standard `unittest.TestCase` when they don't require
the directory setup and teardown overhead. The changes focus on test
classes that:
1. Only test utility functions
2. Don't need temporary directories
3. Don't interact with the filesystem
The PR removes unnecessary imports of `BeetsTestCase` and adds direct
imports of `unittest` where needed. This change reduces the test
execution time by avoiding the expensive setup/teardown steps for tests
that don't require them.
## Description
The current developer documentation feels somewhat cluttered due to
inline auto-generated API references for certain classes. To improve
readability and maintainability, this PR introduces a more streamlined
approach that aligns better with best practices observed in other PyData
ecosystem documentation.
Specifically, this PR:
- Adds a dedicated `api/` folder to the documentation structure.
- Moves all auto-generated references (classes, methods, etc.) to this
folder.
- Enables clean, concise linking to API elements from the narrative
documentation—without interrupting human-written content with large
autogenerated blocks.
This separation makes the documentation easier to navigate and maintain,
while still providing full API reference coverage where needed.
- [x] Documentation
- [x] Changelog
Meta: I was looking for possible contribution opportunities, so I
noticed this in the docs. I assume that the `bite-size` label is
outdated, as there aren't actually any issues with that label. Looks
like https://github.com/beetbox/beets/labels/good%20first%20issue is
currently used.
Note: Further below there's also mention of a `first timers only` label
– that link also yields no results and even gives a message about the
label being invalid. I wasn't sure if/how that should be replaced, so I
didn't touch it. Maybe the sentence I am changing should actually be
moved down and replace the one mentioning `first timers only`?
Adds typings to fetchart; a revised and modernized version of
https://github.com/beetbox/beets/pull/5213.
The former pull request became stale because I did more refactoring
there, in order to express properties of the `Candidate` (whether or not
it is validated) via the type system (motivated by the type state
pattern which is more common in Rust.
The result was a little contentious, since it became a little unclear
what the purpose of the `Candidate` class should even be at that point.
I think this was a case of combining too many things into a single PR.
Thus, this version does not perform any refactoring of that extent. It
does sprinkle in a few `assert`s to make thinks clear for the type
checker.
This PR adds two new features to the Discogs plugin:
1. A new `track_for_id` method that allows users to retrieve singleton
tracks directly by their Discogs ID
- Builds on top of the existing `album_for_id` method
- Searches through the album tracks to find the matching track ID
2. A configurable `search_limit` option to control the number of results
returned by the Discogs metadata search queries
- Default value is set to 5
- Helps improve performance by limiting the number of results processed
- Added proper documentation in the plugin docs
Fixes#4661
Fixes#5788
This PR fixes a regression that occurred when the MusicBrainz autotagger
was moved from core functionality into a standalone plugin. During this
transition, the handling of user-configured `extra_tags` was broken,
causing `beets` to die with `AttributeError` when this option was set.
Key changes in `musicbrainz` plugin
- Properly process values from `extra_tags` using the same logic as
before the migration.
- Centralize common bits from `candidates` and `item_candidates`
implementations under `_search_api` to move this class closer towards
`MetadataSourcePlugin` definition.
- Instead of checking for empty `artist` query, use `va_likely`
parameter to determine whether we should query for Various Artists or
not.
- `album` / `title` is always a truthy string - no need to handle empty
criteria case
- `tracks` list always has at least one track - no need to check for
`len(items)`