Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only depend on typing_extensions for Python < 3.10 #1015

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading