Commit graph

12768 commits

Author SHA1 Message Date
Šarūnas Nejus
84df87c665
Upload test results to codecov 2025-08-09 15:27:17 +01:00
Šarūnas Nejus
24ae1a765b
Make cov setup a bit more useful and upgrade cov upload action 2025-08-09 15:11:59 +01:00
Šarūnas Nejus
54b31d01e9
Use only plugins/disabled_plugins config in plugin loading 2025-08-09 15:11:58 +01:00
Šarūnas Nejus
e9feb41709
Refactor plugin registration tests 2025-08-09 15:06:07 +01:00
Šarūnas Nejus
52bdb58a46
Simplify plugin loading mechanism
Centralise plugin loading in `beets.plugins` and refactor the plugin
loading system to be more straightforward and eliminate complex mocking
in tests. Replace the two-stage class collection and instantiation
process with direct instance creation and storage.

Add plugins.PluginImportError and adjust plugin import tests to only
complain about plugin import issues.
2025-08-09 15:06:06 +01:00
Šarūnas Nejus
788e31b619
Slightly simplify listener registration 2025-08-09 15:04:01 +01:00
Sebastian Mohr
c2d1bc3aaf
Add py.typed marker file to support PEP 561 typing (#5906)
Add `py.typed` marker file to support PEP 561 typing

This PR adds a `py.typed` marker file to the package directory to
indicate that the package includes inline type hints and is PEP 561
compliant.
2025-08-09 13:31:55 +02:00
Šarūnas Nejus
78c361154f
Added a load all plugins test. (#5878)
Adds a test that loads all available plugins in the beetsplug namespace.
This came up during #5876.
2025-08-09 12:21:53 +01:00
Sebastian Mohr
3f23f35353 Removed duplicate importlib import. 2025-08-09 13:17:27 +02:00
Sebastian Mohr
84ae11657e Added a check for gstream plugin issues on windows. 2025-08-09 13:17:27 +02:00
Sebastian Mohr
73dda4f7f8 Added dependencies for all failed plugins 2025-08-09 13:17:27 +02:00
Sebastian Mohr
6c3f93df2c Replaced find_executable with shutil.which for python 3.12
compatibility as distutils was deprecated.
2025-08-09 13:17:27 +02:00
Sebastian Mohr
1696789cbe Removed re and added brackets 2025-08-09 13:17:27 +02:00
Sebastian Mohr
a2136e1100 Removed now unused _is_spec_avilable function 2025-08-09 13:17:27 +02:00
Sebastian Mohr
8d134d1389 Skip module not found checks in favor for only running the test in
the ci.
2025-08-09 13:17:27 +02:00
Sebastian Mohr
586b89016b Using fixture to unload plugins. Enhance comment. Simplified get available
plugins function.
2025-08-09 13:17:27 +02:00
Sebastian Mohr
8b0af15b83 Use load_plugins directly as the plugin mixin version wants
to create an instance which is not wanted here.
2025-08-09 13:17:27 +02:00
Sebastian Mohr
3a2b6d85a4 Using plugin mixin to unload plugins. 2025-08-09 13:17:27 +02:00
Sebastian Mohr
8aa298d646 Added module cleanup, might fix errors. 2025-08-09 13:17:27 +02:00
Sebastian Mohr
4723f3de7d Instead of trying to import all plugins together, opted to test
one plugin at a time.
2025-08-09 13:17:27 +02:00
Sebastian Mohr
cfab2eb56e Some typos 2025-08-09 13:17:27 +02:00
Sebastian Mohr
3c6dab57e9 Changelog update. 2025-08-09 13:17:27 +02:00
Sebastian Mohr
355e4d3fed Added a load all plugins test. 2025-08-09 13:17:27 +02:00
Šarūnas Nejus
d8d227eee1
discogs: don't crash if a release is deleted (#5893)
Before:

```
Traceback (most recent call last):
  File "/nix/store/yk2m7a9wdmh8fz8ywca0c73sc5ad2zm6-beets-2.3.1/lib/python3.13/site-packages/beetsplug/discogs.py", line 312, in get_album_info
    result.refresh()
    ~~~~~~~~~~~~~~^^
  File "/nix/store/007cfg4f295dz064bl9a2cjw10vlpc83-python3.13-discogs-client-2.8/lib/python3.13/site-packages/discogs_client/models.py", line 204, in refresh
    data = self.client._get(self.data['resource_url'])
  File "/nix/store/007cfg4f295dz064bl9a2cjw10vlpc83-python3.13-discogs-client-2.8/lib/python3.13/site-packages/discogs_client/client.py", line 114, in _get
    return self._request('GET', url)
           ~~~~~~~~~~~~~^^^^^^^^^^^^
  File "/nix/store/007cfg4f295dz064bl9a2cjw10vlpc83-python3.13-discogs-client-2.8/lib/python3.13/site-packages/discogs_client/client.py", line 111, in _request
    raise HTTPError(body['message'], status_code)
discogs_client.exceptions.HTTPError: 404: That release does not exist or may have been deleted.
```

After:

```
Discogs release not found: <Release 20919814 'Kumi Tanioka, Yae - Final Fantasy Crystal Chronicles Original Soundtrack'>: 404: That release does not exist or may have been deleted.
```

Here's the link to the relevant release, which [shows up in search
results](https://www.discogs.com/search?q=Kumi+Tanioka%2C+Yae+-+Final+Fantasy+Crystal+Chronicles+Original+Soundtrack&type=all)
but 404s if you click on it:
https://www.discogs.com/release/20919814-Kumi-Tanioka-Yae-Final-Fantasy-Crystal-Chronicles-Original-Soundtrack
2025-08-08 22:02:37 +01:00
Šarūnas Nejus
9e4559b8e9
Merge branch 'master' into discogs-404 2025-08-08 21:57:46 +01:00
Rebecca Turner
0430bd383a discogs: don't crash if a release is deleted 2025-08-07 20:25:09 -07:00
Sebastian Mohr
e3574a7287
Remove version dependency for typing_extensions (#5879)
Removes the python version dependency for typing_extensions, for more
information see also #5869
2025-08-04 11:25:28 +02:00
Sebastian Mohr
63eefa61b3 Update changelog. 2025-08-04 11:20:33 +02:00
Sebastian Mohr
dc6f07d705 Added typing_extensions to all python version. Removed sys.version checks 2025-08-04 11:19:14 +02:00
Šarūnas Nejus
5beb3d1c81
Add artist, album to item entry template in the web plugin (#5753)
Add the artist and album information to the item template in the web
plugin.

When searching for an item, Instead of 

`` Doo Woop (That Thing)``

the interface now shows

``Lauryn Hill - The Miseducation of Lauryn Hill - Doo Wop (That Thing)``

which is arguably clearer, and matches the default output of `beet ls`
in the cli.
2025-08-02 22:44:47 +01:00
Šarūnas Nejus
44af7b24e5
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-08-02 22:39:59 +01:00
Martin Atukunda
034e608a4f
Update changelog.rst
remove duplicate changelog entry
2025-08-02 14:21:37 +03:00
Šarūnas Nejus
619589dde0
Deprecate imports, decargs (#5892)
## Summary

See https://github.com/beetbox/beets/discussions/5891 for context.

This PR introduces a deprecation system for module structure changes and
deprecated functionality in the beets codebase:

### Key Changes

**New deprecation infrastructure:**
- Add `deprecate_imports()` utility function to handle deprecated module
imports with warnings
- Implement `__getattr__` hooks in modules to intercept and redirect
deprecated imports
- Deprecate previously removed imports in `beets.library` and
`beets.autotag`
- Deprecate `decargs` function.
2025-08-02 10:48:25 +01:00
Šarūnas Nejus
c2a8651b68
Deprecate decargs 2025-08-02 10:42:51 +01:00
Šarūnas Nejus
ebc0709c40
Deprecate beets.autotag.Distance beets.autotag.current_metadata 2025-08-02 10:42:51 +01:00
Šarūnas Nejus
3dd18dc3be
Bring back and deprecate queries and types imports from beets.library 2025-08-02 10:42:51 +01:00
Martin Atukunda
dc789485be
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-31 13:19:07 +03:00
Damon McDougall
268075063f Use python3 print in plugins.rst 2025-07-29 10:06:30 +02:00
Šarūnas Nejus
0fec858a13
Update deps to address security vulnerabilities (#5873)
This PR updates dependencies to address security vulnerabilities

### Key changes
- **GitHub Actions:** Updated `tj-actions/changed-files` from v44/v45 to
v46 across all workflows
- **Python package updates:**
<img width="618" height="548" alt="image"
src="https://github.com/user-attachments/assets/c48ccd41-55f4-4dd6-b43a-4eb921c28b7d"
/>
2025-07-20 09:50:08 +01:00
Martin Atukunda
5043dcc78d
Move change log note to the New features
After some guidance from @snejus this is the proper place to place the
change log entries, not inside the New features section of _released_
versions.
2025-07-18 00:31:08 +03:00
Martin Atukunda
4a7e474efc
Merge branch 'master' into feature/add-artist-to-item-entry-template 2025-07-18 00:25:42 +03:00
Šarūnas Nejus
62bbd187a9
Bump tj-actions/changed-files 2025-07-17 13:30:34 +01:00
Šarūnas Nejus
7a79adb1e6
Update Python deps 2025-07-17 13:30:31 +01:00
Šarūnas Nejus
bde5de42b3
Register types and queries from plugins on models dynamically (#5872)
## Fix dynamic plugin type and query registration

This PR refactors the plugin system to properly handle dynamic type and
query registration by converting static class attributes to cached class
properties.

**Problem**: Plugin types and queries were stored as mutable class
attributes that were manually updated during plugin loading/unloading.
This caused issues where:
- Plugin types weren't properly registered in test environments
- Shared mutable state between test runs caused inconsistent behavior  
- Manual cleanup was error-prone and incomplete

See https://github.com/beetbox/beets/pull/5833 and specifically
https://github.com/beetbox/beets/pull/5833#issuecomment-3016635209 for
the context.

**Solution**: 
- Convert `_types` and `_queries` from static dictionaries to
`@cached_classproperty` decorators
- Types and queries are now dynamically computed from loaded plugins
when accessed
- Eliminates manual mutation of class attributes during plugin loading
- Properly clears cached properties when plugins are loaded/unloaded
- Ensures plugin types are available immediately after registration

**Key Changes**:
- `Model._types` and `LibModel._queries` now use `@cached_classproperty`
- Removed manual `_types.update()` calls in plugin loading code
- Added proper cache clearing in test infrastructure
- Plugin types are now inherited through the class hierarchy correctly

This fixes the developer's issue where `item_types` weren't being
registered properly in tests - the new dynamic property approach ensures
plugin types are available as soon as plugins are loaded.
2025-07-16 20:19:14 +01:00
Šarūnas Nejus
98bb7f12be
refactor: convert _queries from class attributes to cached properties
Convert _queries from mutable class attributes to cached class properties
that dynamically fetch plugin queries. This eliminates the need for manual
query registration and cleanup in plugin loading/unloading logic.
2025-07-16 14:45:25 +01:00
Šarūnas Nejus
3be4a89aee
refactor: convert _types from class attributes to cached properties
Convert static _types dictionaries to dynamic cached class properties to
enable proper plugin type inheritance and avoid mutating shared state.

Key changes:
- Replace static _types dicts with @cached_classproperty decorators
- Update cached_classproperty to support proper caching with class names
- Remove manual _types mutation in plugin loading/unloading
- Add pluginload event and cache clearing for proper plugin integration
- Fix test to trigger type checking during item creation

This ensures plugin types are properly inherited through the class
hierarchy and eliminates issues with shared mutable state between
test runs.
2025-07-16 14:45:25 +01:00
Šarūnas Nejus
852cbd2650
Fix a pair of regressions, types and enforce mypy in CI (#5870)
**Bug Fixes**:
   - Wrong `raw_seconds_short` module in `DurationQuery`.
   - Missing `byte_paths` variable in `import_func`.

Otherwise

- Addressed all static type checking errors in the codebase (except
`spotify` plugin which has already been fixed in a separate PR)
- Removed `continue-on-error` from in `mypy` CI job, which means any
errors in type checking will now fail the CI job.
2025-07-16 14:36:13 +01:00
Šarūnas Nejus
ada672b759
Do not install not required apt deps in ci 2025-07-16 14:30:03 +01:00
Šarūnas Nejus
7509843517
Fix a generic type error and warnings in spotify 2025-07-16 14:15:27 +01:00
Šarūnas Nejus
3495a7ef36
Update mypy config
Remove 'files' configuration from the config to make sure that mypy runs
quicker when invoked from the editor (where ideally it should only check
the file being edited).

Remove 'disallow_any_generics' from the config since we already have
this configured centrally.

And finally, do not allow variable redefinitions.
2025-07-16 14:15:27 +01:00