diff --git a/beets/util/__init__.py b/beets/util/__init__.py index 8cbbda8f9..3ce187f02 100644 --- a/beets/util/__init__.py +++ b/beets/util/__init__.py @@ -45,7 +45,11 @@ from typing import ( Union, ) -from typing_extensions import TypeAlias +try: + # Python 3.10+ + from typing import TypeAlias +except ImportError: + 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 35c3e919f..b02dd85f2 100644 --- a/beetsplug/aura.py +++ b/beetsplug/aura.py @@ -29,7 +29,12 @@ from flask import ( request, send_file, ) -from typing_extensions import Self + +try: + # Python 3.11+ + from typing import Self +except ImportError: + 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 3725e4993..6219437a9 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/pyproject.toml b/pyproject.toml index 3ef11ac14..be239a0ec 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 }