Commit graph

205 commits

Author SHA1 Message Date
Ember Light
51c971f089 Fix sourcery-ai comments 2025-10-12 21:38:13 +02:00
Ember Light
37a5f9cb15 Add custom feat words 2025-10-12 20:47:51 +02:00
Šarūnas Nejus
f8887d48b6
Add deprecation warning for <plugin>.source_weight 2025-10-10 20:36:33 +01:00
Šarūnas Nejus
96670cf971
Cache found metadata source plugins 2025-10-10 20:36:33 +01:00
Šarūnas Nejus
c34b2a00a4
Fix plugin loading 2025-09-29 11:39:15 +01:00
Šarūnas Nejus
1736a5e735
Define MetadataSourcePlugin methods on the subclass only 2025-09-04 12:49:47 +01:00
Šarūnas Nejus
d93ddf8dd4
Do not use explicit indices for logging args when not needed 2025-08-30 23:10:21 +01:00
Šarūnas Nejus
1c16b2b308
Replace string concatenation (' + ')
- Join hardcoded strings
- Replace concatenated variables with f-strings
2025-08-30 23:10:15 +01:00
Šarūnas Nejus
4a361bd501
Replace format calls with f-strings 2025-08-30 18:42:26 +01:00
David Logie
d87b80bd51 Log loaded plugins at the debug level. 2025-08-23 13:11:58 +01:00
Šarūnas Nejus
2059a3a802
Move EventType definition to plugins.py and fix test_hook types 2025-08-09 15:44:35 +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
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
dc6f07d705 Added typing_extensions to all python version. Removed sys.version checks 2025-08-04 11:19:14 +02: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
Sebastian Mohr
648a9be172 Added deprecation warning for legacy type metadata plugins. 2025-07-15 15:03:14 +02:00
Sebastian Mohr
5cd6a39a01 Edited changelog and fixed an issue with plugin loading. 2025-07-15 15:03:14 +02:00
Sebastian Mohr
5fe8431a65 Use inspect instead of isclass in load_plugin function to fix import
issues.
2025-07-15 15:03:14 +02:00
Sebastian Mohr
06b6f4f27b Isolated autottag related plugin functions into an new metadata_plugins
file.
2025-07-15 15:03:14 +02:00
Sebastian Mohr
04a3dd2169 Adjusted typehint for search api. Removed optional none from filter. 2025-07-07 11:37:02 +02:00
Sebastian Mohr
085b89b70b Minor improvements to deezer plugin typing. 2025-07-07 11:37:02 +02:00
Šarūnas Nejus
99f7e94b59
Add Distance and current_metadata to autotag.__init__ for backward compat 2025-05-31 19:17:44 +01:00
Šarūnas Nejus
adbd50b237
Move distance to a separate module 2025-05-31 19:17:43 +01:00
Šarūnas Nejus
509cbdcbe4
Move sanitize_pairs/choices from plugins to util module 2025-05-31 17:55:41 +01:00
Ian McCowan
0f76312f31
Fix duplicate database change event send on Library.add (#5561)
## 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>
2025-05-30 13:41:29 +00:00
Šarūnas Nejus
d3ef627494
Expect plugins to return Iterables instead of Iterators 2025-05-19 09:43:54 +01:00
Šarūnas Nejus
e8e9369bc7
Remove unused extra_tags parameter 2025-05-19 09:18:06 +01:00
Šarūnas Nejus
b520981c9c
plugins: restructure id extraction 2025-05-17 14:57:34 +01:00
Šarūnas Nejus
f1dc75f743
Fix types in all edited files 2025-05-17 03:32:01 +01:00
Šarūnas Nejus
78462245b7
Use wraps for notify_info_yielded decorator 2025-05-17 03:32:01 +01:00
Šarūnas Nejus
5df857674c
plugins: add types and documentation to metadata backends methods and functions 2025-05-17 03:31:58 +01:00
Sebastian Mohr
6594bd7f24 Moved all typehint that need a typechecking guard to the top. see
https://github.com/beetbox/beets/pull/5701#discussion_r2051486012
2025-04-19 16:19:07 +02:00
Sebastian Mohr
557cb1a019 minor additions 2025-04-19 13:00:12 +02:00
Sebastian Mohr
2f57dd9e1c Added missing return types. 2025-04-18 23:03:32 +02:00
Sebastian Mohr
d7838b29c3 https://github.com/beetbox/beets/pull/5701#discussion_r2050637901 2025-04-18 16:03:39 +02:00
Sebastian Mohr
39a5bdb0bd https://github.com/beetbox/beets/pull/5701#discussion_r2050488475 2025-04-18 13:29:33 +02:00
Sebastian Mohr
fef81af67d https://github.com/beetbox/beets/pull/5701#discussion_r2048644522 2025-04-18 12:06:02 +02:00
Sebastian Mohr
b3c61d5c19 typed import_stages 2025-04-17 14:17:45 +02:00
Sebastian Mohr
62d28260c7 small nits 2025-04-15 18:04:40 +02:00
Sebastian Mohr
287c7228af Fixed circular import issue introduced in last commit 2025-04-15 12:02:40 +02:00
Sebastian Mohr
90254bb511 Fixed lint error introduced by merging main. 2025-04-15 11:57:52 +02:00
Sebastian Mohr
f878e4da3e
Merge branch 'master' into typehints-plugins 2025-04-15 11:52:08 +02:00
Sebastian Mohr
7e61027366 Added suggestions from code review 2025-04-15 11:49:24 +02:00
Šarūnas Nejus
6a192d0bdb
albums_for_id -> album_for_id and return a single candidate instead of an iterator 2025-04-14 02:28:42 +01:00
Sebastian Mohr
753bdd9106 Added typehints for _instance, _classes and for class attributes. 2025-04-08 18:15:08 +02:00
Sebastian Mohr
e6ce818913 Added some more typehints where missing. 2025-04-02 16:28:41 +02:00
Sebastian Mohr
19b3330fc8 Fixed circular import of distance by consistently importing if whenever
it is needed.
2025-04-02 16:07:00 +02:00
Sebastian Mohr
0cc0db313a Added typehints to the plugins file. 2025-04-02 15:57:16 +02:00