Skip to content

Commit

Permalink
Merge pull request #1015 from dcermak/typing_extensions-only-for-olde…
Browse files Browse the repository at this point in the history
…r-py

Only depend on typing_extensions for Python < 3.10
  • Loading branch information
RonnyPfannschmidt authored Feb 28, 2024
2 parents 58c9758 + 5170451 commit fee09f4
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 7 deletions.
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ dependencies = [
"packaging>=20",
"setuptools",
'tomli>=1; python_version < "3.11"',
"typing-extensions",
'typing-extensions; python_version < "3.10"',
]
[project.optional-dependencies]
docs = [
Expand All @@ -61,6 +61,7 @@ test = [
"build",
"pytest",
"rich",
'typing-extensions; python_version < "3.11"',
"wheel",
]
toml = [
Expand Down
7 changes: 6 additions & 1 deletion src/setuptools_scm/_file_finders/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,12 @@
from .pathtools import norm_real

if TYPE_CHECKING:
from typing_extensions import TypeGuard
import sys

if sys.version_info >= (3, 10):
from typing import TypeGuard
else:
from typing_extensions import TypeGuard


log = _log.log.getChild("file_finder")
Expand Down
5 changes: 4 additions & 1 deletion src/setuptools_scm/_integration/toml.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@
from tomli import loads as load_toml

if TYPE_CHECKING:
from typing_extensions import TypeAlias
if sys.version_info >= (3, 10):
from typing import TypeAlias
else:
from typing_extensions import TypeAlias

from .. import _log

Expand Down
7 changes: 6 additions & 1 deletion src/setuptools_scm/_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
from typing import Union

if TYPE_CHECKING:
from typing_extensions import TypeAlias
import sys

if sys.version_info >= (3, 10):
from typing import TypeAlias
else:
from typing_extensions import TypeAlias

from . import version

Expand Down
10 changes: 8 additions & 2 deletions src/setuptools_scm/version.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,14 @@
from . import _modify_version

if TYPE_CHECKING:
from typing_extensions import Concatenate
from typing_extensions import ParamSpec
import sys

if sys.version_info >= (3, 10):
from typing import Concatenate
from typing import ParamSpec
else:
from typing_extensions import Concatenate
from typing_extensions import ParamSpec

_P = ParamSpec("_P")

Expand Down
7 changes: 6 additions & 1 deletion testing/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import contextlib
import os
import sys

from pathlib import Path
from types import TracebackType
Expand All @@ -11,7 +12,11 @@
import pytest

from setuptools_scm._run_cmd import run
from typing_extensions import Self

if sys.version_info >= (3, 11):
from typing import Self
else:
from typing_extensions import Self

from .wd_wrapper import WorkDir

Expand Down

0 comments on commit fee09f4

Please sign in to comment.