Skip to content

Commit e3574a7

Browse files
authored
Remove version dependency for typing_extensions (#5879)
Removes the python version dependency for typing_extensions, for more information see also #5869
2 parents 5beb3d1 + 63eefa6 commit e3574a7

File tree

8 files changed

+11
-30
lines changed

8 files changed

+11
-30
lines changed

beets/dbcore/db.py

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,9 @@
2626
from collections import defaultdict
2727
from collections.abc import Generator, Iterable, Iterator, Mapping, Sequence
2828
from sqlite3 import Connection
29-
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Generic, TypeVar
29+
from typing import TYPE_CHECKING, Any, AnyStr, Callable, Generic
3030

31+
from typing_extensions import TypeVar # default value support
3132
from unidecode import unidecode
3233

3334
import beets
@@ -49,10 +50,7 @@
4950

5051
from .query import SQLiteType
5152

52-
D = TypeVar("D", bound="Database", default=Any)
53-
else:
54-
D = TypeVar("D", bound="Database")
55-
53+
D = TypeVar("D", bound="Database", default=Any)
5654

5755
FlexAttrs = dict[str, str]
5856

beets/metadata_plugins.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,20 +10,16 @@
1010
import abc
1111
import inspect
1212
import re
13-
import sys
1413
import warnings
1514
from typing import TYPE_CHECKING, Generic, Literal, Sequence, TypedDict, TypeVar
1615

16+
from typing_extensions import NotRequired
17+
1718
from beets.util import cached_classproperty
1819
from beets.util.id_extractors import extract_release_id
1920

2021
from .plugins import BeetsPlugin, find_plugins, notify_info_yielded, send
2122

22-
if sys.version_info >= (3, 11):
23-
from typing import NotRequired
24-
else:
25-
from typing_extensions import NotRequired
26-
2723
if TYPE_CHECKING:
2824
from collections.abc import Iterable
2925

beets/plugins.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,26 +19,21 @@
1919
import abc
2020
import inspect
2121
import re
22-
import sys
2322
import traceback
2423
from collections import defaultdict
2524
from functools import wraps
2625
from types import GenericAlias
2726
from typing import TYPE_CHECKING, Any, Callable, Sequence, TypeVar
2827

2928
import mediafile
29+
from typing_extensions import ParamSpec
3030

3131
import beets
3232
from beets import logging
3333

3434
if TYPE_CHECKING:
3535
from beets.event_types import EventType
3636

37-
if sys.version_info >= (3, 10):
38-
from typing import ParamSpec
39-
else:
40-
from typing_extensions import ParamSpec
41-
4237

4338
if TYPE_CHECKING:
4439
from collections.abc import Iterable

beets/util/pipeline.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,10 +38,7 @@
3838
from threading import Lock, Thread
3939
from typing import Callable, Generator, TypeVar
4040

41-
if sys.version_info >= (3, 11):
42-
from typing import TypeVarTuple, Unpack
43-
else:
44-
from typing_extensions import TypeVarTuple, Unpack
41+
from typing_extensions import TypeVarTuple, Unpack
4542

4643
BUBBLE = "__PIPELINE_BUBBLE__"
4744
POISON = "__PIPELINE_POISON__"

beetsplug/aura.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616

1717
import os
1818
import re
19-
import sys
2019
from collections.abc import Mapping
2120
from dataclasses import dataclass
2221
from mimetypes import guess_type
@@ -30,11 +29,7 @@
3029
request,
3130
send_file,
3231
)
33-
34-
if sys.version_info >= (3, 11):
35-
from typing import Self
36-
else:
37-
from typing_extensions import Self
32+
from typing_extensions import Self
3833

3934
from beets import config
4035
from beets.dbcore.query import (

docs/changelog.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ For packagers:
6161
* Optional ``extra_tags`` parameter has been removed from
6262
``BeetsPlugin.candidates`` method signature since it is never passed in. If
6363
you override this method in your plugin, feel free to remove this parameter.
64+
* Loosened `typing_extensions`` dependency in pyproject.toml to apply to every python version.
6465

6566
For plugin developers:
6667

@@ -90,7 +91,6 @@ For plugin developers:
9091
Old imports are now deprecated and will be removed in version ``3.0.0``.
9192
* ``beets.ui.decargs`` is deprecated and will be removed in version ``3.0.0``.
9293

93-
9494
Other changes:
9595

9696
* Refactor: Split responsibilities of Plugins into MetaDataPlugins and general Plugins.

poetry.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ musicbrainzngs = ">=0.4"
5252
numpy = ">=1.24.4"
5353
platformdirs = ">=3.5.0"
5454
pyyaml = "*"
55-
typing_extensions = { version = "*", python = "<=3.10" }
55+
typing_extensions = "*"
5656
unidecode = ">=1.3.6"
5757

5858
beautifulsoup4 = { version = "*", optional = true }

0 commit comments

Comments
 (0)