Skip to content

Commit bd536ff

Browse files
kloczekhenryiii
authored andcommitted
drop python<=3.7 support
According to https://endoflife.date/python python 3.7 has been EOSed 27 Jun 2023. Filter all code over `pyupgrade --py38-plus`. Signed-off-by: Tomasz Kłoczko <[email protected]>
1 parent 3a16f45 commit bd536ff

File tree

6 files changed

+15
-39
lines changed

6 files changed

+15
-39
lines changed

src/scikit_build_core/_compat/importlib/metadata.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,9 @@
11
from __future__ import annotations
22

3+
import importlib.metadata as _metadata
34
import sys
45
import typing
5-
6-
if sys.version_info < (3, 8):
7-
import importlib_metadata as _metadata
8-
from importlib_metadata import PathDistribution, version
9-
else:
10-
import importlib.metadata as _metadata
11-
from importlib.metadata import PathDistribution, version
12-
6+
from importlib.metadata import PathDistribution, version
137

148
if typing.TYPE_CHECKING:
159
if sys.version_info < (3, 8):

src/scikit_build_core/_compat/typing.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,7 @@
22

33
import sys
44
import typing
5-
6-
if sys.version_info < (3, 8):
7-
from typing_extensions import (
8-
Literal,
9-
Protocol,
10-
)
11-
else:
12-
from typing import Literal, Protocol
5+
from typing import Literal, Protocol
136

147
if sys.version_info < (3, 9):
158
from typing_extensions import Annotated, get_args, get_origin

src/scikit_build_core/_logging.py

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,7 @@ def __repr__(self) -> str:
4444
)
4545

4646

47-
if sys.version_info < (3, 8):
48-
opts: Any = {}
49-
else:
50-
opts: Any = {"stacklevel": 2}
47+
opts: Any = {"stacklevel": 2}
5148

5249

5350
class ScikitBuildLogger:

tests/conftest.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,12 @@
88
import subprocess
99
import sys
1010
import sysconfig
11+
from importlib import metadata
1112
from pathlib import Path
13+
from typing import Literal, overload
1214

1315
import virtualenv as _virtualenv
1416

15-
if sys.version_info < (3, 8):
16-
import importlib_metadata as metadata
17-
from typing_extensions import Literal, overload
18-
else:
19-
from importlib import metadata
20-
from typing import Literal, overload
21-
2217
if sys.version_info < (3, 11):
2318
import tomli as tomllib
2419
else:

tests/test_custom_modules.py

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ def test_ep(isolated):
2323
contents = Path(script).read_text()
2424
assert contents.startswith(f"#!{pysys}")
2525

26-
if sys.version_info >= (3, 8):
27-
assert (
28-
isolated.execute(
29-
"from importlib import metadata; print(metadata.version('custom_modules'), end='')"
30-
)
31-
== "2.3.4"
26+
assert (
27+
isolated.execute(
28+
"from importlib import metadata; print(metadata.version('custom_modules'), end='')"
3229
)
30+
== "2.3.4"
31+
)

tests/test_dynamic_metadata.py

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
import importlib
44
import shutil
55
import subprocess
6-
import sys
76
import types
87
import zipfile
98
from pathlib import Path
@@ -238,11 +237,10 @@ def test_pep517_wheel(virtualenv):
238237
assert wheel == dist / out
239238

240239
virtualenv.install(wheel)
241-
if sys.version_info >= (3, 8):
242-
license = virtualenv.execute(
243-
"from importlib.metadata import metadata; print(metadata('dynamic')['License'])"
244-
)
245-
assert license == "MIT License"
240+
license = virtualenv.execute(
241+
"from importlib.metadata import metadata; print(metadata('dynamic')['License'])"
242+
)
243+
assert license == "MIT License"
246244

247245
with zipfile.ZipFile(wheel) as zf:
248246
file_paths = {Path(n) for n in zf.namelist()}

0 commit comments

Comments
 (0)