Skip to content

Commit dec9578

Browse files
jakob-kellerJakob Keller
authored and
Jakob Keller
committed
fix(tags): fixes ImportError on Python >=3.11 (#1363)
1 parent bc8479e commit dec9578

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

Diff for: commitizen/tags.py

+6-2
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,6 @@
88
from string import Template
99
from typing import TYPE_CHECKING, NamedTuple
1010

11-
from typing_extensions import Self
12-
1311
from commitizen import out
1412
from commitizen.defaults import DEFAULT_SETTINGS, Settings, get_tag_regexes
1513
from commitizen.git import GitTag
@@ -24,6 +22,12 @@
2422
if TYPE_CHECKING:
2523
from commitizen.version_schemes import VersionScheme
2624

25+
# Self is Python 3.11+ but backported in typing-extensions
26+
if sys.version_info < (3, 11):
27+
from typing_extensions import Self
28+
else:
29+
from typing import Self
30+
2731

2832
class VersionTag(NamedTuple):
2933
"""Represent a version and its matching tag form."""

0 commit comments

Comments
 (0)