diff --git a/beets/dbcore/db.py b/beets/dbcore/db.py index b780c5756..d55cf70cd 100755 --- a/beets/dbcore/db.py +++ b/beets/dbcore/db.py @@ -26,8 +26,9 @@ from abc import ABC from collections import defaultdict from collections.abc import Generator, Iterable, Iterator, Mapping, Sequence from sqlite3 import Connection -from typing import TYPE_CHECKING, Any, AnyStr, Callable, Generic, TypeVar +from typing import TYPE_CHECKING, Any, AnyStr, Callable, Generic +from typing_extensions import TypeVar # default value support from unidecode import unidecode import beets @@ -49,10 +50,7 @@ if TYPE_CHECKING: from .query import SQLiteType - D = TypeVar("D", bound="Database", default=Any) -else: - D = TypeVar("D", bound="Database") - +D = TypeVar("D", bound="Database", default=Any) FlexAttrs = dict[str, str] diff --git a/beets/metadata_plugins.py b/beets/metadata_plugins.py index 5b11dc4ec..9d69633d6 100644 --- a/beets/metadata_plugins.py +++ b/beets/metadata_plugins.py @@ -10,20 +10,16 @@ from __future__ import annotations import abc import inspect import re -import sys import warnings from typing import TYPE_CHECKING, Generic, Literal, Sequence, TypedDict, TypeVar +from typing_extensions import NotRequired + from beets.util import cached_classproperty from beets.util.id_extractors import extract_release_id from .plugins import BeetsPlugin, find_plugins, notify_info_yielded, send -if sys.version_info >= (3, 11): - from typing import NotRequired -else: - from typing_extensions import NotRequired - if TYPE_CHECKING: from collections.abc import Iterable diff --git a/beets/plugins.py b/beets/plugins.py index 81f423431..3e04ccdfc 100644 --- a/beets/plugins.py +++ b/beets/plugins.py @@ -19,7 +19,6 @@ from __future__ import annotations import abc import inspect import re -import sys import traceback from collections import defaultdict from functools import wraps @@ -27,6 +26,7 @@ from types import GenericAlias from typing import TYPE_CHECKING, Any, Callable, Sequence, TypeVar import mediafile +from typing_extensions import ParamSpec import beets from beets import logging @@ -34,11 +34,6 @@ from beets import logging if TYPE_CHECKING: from beets.event_types import EventType -if sys.version_info >= (3, 10): - from typing import ParamSpec -else: - from typing_extensions import ParamSpec - if TYPE_CHECKING: from collections.abc import Iterable diff --git a/beets/util/pipeline.py b/beets/util/pipeline.py index 140407f04..bd2c49316 100644 --- a/beets/util/pipeline.py +++ b/beets/util/pipeline.py @@ -38,10 +38,7 @@ import sys from threading import Lock, Thread from typing import Callable, Generator, TypeVar -if sys.version_info >= (3, 11): - from typing import TypeVarTuple, Unpack -else: - from typing_extensions import TypeVarTuple, Unpack +from typing_extensions import TypeVarTuple, Unpack BUBBLE = "__PIPELINE_BUBBLE__" POISON = "__PIPELINE_POISON__" diff --git a/beetsplug/aura.py b/beetsplug/aura.py index e7034c1e9..53458d7ee 100644 --- a/beetsplug/aura.py +++ b/beetsplug/aura.py @@ -16,7 +16,6 @@ import os import re -import sys from collections.abc import Mapping from dataclasses import dataclass from mimetypes import guess_type @@ -30,11 +29,7 @@ from flask import ( request, send_file, ) - -if sys.version_info >= (3, 11): - from typing import Self -else: - from typing_extensions import Self +from typing_extensions import Self from beets import config from beets.dbcore.query import ( diff --git a/docs/changelog.rst b/docs/changelog.rst index c0e96635f..12454d154 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -63,6 +63,7 @@ For packagers: * Optional ``extra_tags`` parameter has been removed from ``BeetsPlugin.candidates`` method signature since it is never passed in. If you override this method in your plugin, feel free to remove this parameter. +* Loosened `typing_extensions`` dependency in pyproject.toml to apply to every python version. For plugin developers: @@ -92,7 +93,6 @@ For plugin developers: Old imports are now deprecated and will be removed in version ``3.0.0``. * ``beets.ui.decargs`` is deprecated and will be removed in version ``3.0.0``. - Other changes: * Refactor: Split responsibilities of Plugins into MetaDataPlugins and general Plugins. diff --git a/poetry.lock b/poetry.lock index a7a0ee9f7..70b72e9ce 100644 --- a/poetry.lock +++ b/poetry.lock @@ -3292,4 +3292,4 @@ web = ["flask", "flask-cors"] [metadata] lock-version = "2.0" python-versions = ">=3.9,<4" -content-hash = "b3f2746a43227fe639d17eb22d7924e30c9d83eef53dce2c10388c602f0c6665" +content-hash = "c98049afba33c3cb22359ae75bb73bcc5d74b27c5a45802292a56f8d3c547f1e" diff --git a/pyproject.toml b/pyproject.toml index 39c543307..d784fe4b0 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -52,7 +52,7 @@ musicbrainzngs = ">=0.4" numpy = ">=1.24.4" platformdirs = ">=3.5.0" pyyaml = "*" -typing_extensions = { version = "*", python = "<=3.10" } +typing_extensions = "*" unidecode = ">=1.3.6" beautifulsoup4 = { version = "*", optional = true }