diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 8cbbda8f94..7079db444d 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -45,7 +45,11 @@ Union, ) -from typing_extensions import TypeAlias +if sys.version_info >= (3, 10): + from typing import TypeAlias +else: + from typing_extensions import TypeAlias + from unidecode import unidecode from beets.util import hidden diff --git a/beetsplug/aura.py b/beetsplug/aura.py index 35c3e919fa..09d859200b 100644 --- a/beetsplug/aura.py +++ b/beetsplug/aura.py @@ -17,6 +17,7 @@ import os import re +import sys from dataclasses import dataclass from mimetypes import guess_type from typing import ClassVar, Mapping, Type @@ -29,7 +30,11 @@ request, send_file, ) -from typing_extensions import Self + +if sys.version_info >= (3, 11): + from typing import Self +else: + 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 3725e4993e..6219437a9b 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -15,6 +15,7 @@ For packagers: * The minimum supported Python version is now 3.8. * The `beet` script has been removed from the repository. +* The `typing_extensions` is required for Python 3.10 and below. Other changes: diff --git a/poetry.lock b/poetry.lock index 1e3b4cd1d0..f7d53578a1 100644 --- a/poetry.lock +++ b/poetry.lock @@ -2720,4 +2720,4 @@ web = ["flask", "flask-cors"] [metadata] lock-version = "2.0" python-versions = ">=3.8,<4" -content-hash = "740281ee3ddba4c6015eab9cfc24bb947e8816e3b7f5a6bebeb39ff2413d7ac3" +content-hash = "48fba7c7149c8cb7824f96329bd469a9e9c84b13d233f957889b8b1d7076392f" diff --git a/pyproject.toml b/pyproject.toml index 3ef11ac148..be239a0ece 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -41,7 +41,7 @@ mediafile = ">=0.12.0" munkres = ">=1.0.0" musicbrainzngs = ">=0.4" pyyaml = "*" -typing_extensions = "*" +typing_extensions = { version = "*", python = "<=3.10" } unidecode = ">=1.3.6" beautifulsoup4 = { version = "*", optional = true } dbus-python = { version = "*", optional = true }