Use typing_extensions only when needed

Self was added in Python 3.11
TypeAlias was added in Python 3.10
This commit is contained in:
Arkadiy Illarionov 2024-06-22 16:02:24 +03:00
parent a273807569
commit 859072ee9e
4 changed files with 13 additions and 3 deletions

View file

@ -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

View file

@ -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 (

View file

@ -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:

View file

@ -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 }