Skip to content

Commit 8a53592

Browse files
authored
feat: drop python<=3.7 support (#769)
1 parent c3348bf commit 8a53592

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+148
-265
lines changed

.github/CONTRIBUTING.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -241,7 +241,7 @@ build-backend = "scikit_build_core.build"
241241
[project]
242242
name = "cmake_example"
243243
version = "0.0.1"
244-
requires-python = ">=3.7"
244+
requires-python = ">=3.8"
245245

246246
[project.optional-dependencies]
247247
test = ["pytest>=6.0"]
@@ -275,7 +275,7 @@ setup(
275275
cmake_source_dir=".",
276276
zip_safe=False,
277277
extras_require={"test": ["pytest>=6.0"]},
278-
python_requires=">=3.7",
278+
python_requires=">=3.8",
279279
)
280280
```
281281

.github/workflows/ci.yml

+5-21
Original file line numberDiff line numberDiff line change
@@ -52,23 +52,17 @@ jobs:
5252
strategy:
5353
fail-fast: false
5454
matrix:
55-
python-version: ["3.7", "pypy-3.9", "3.12", "3.13"]
55+
python-version: ["3.8", "pypy-3.9", "3.13"]
5656
runs-on: [ubuntu-latest, macos-13]
5757
cmake-version: ["3.15.x"]
5858

5959
include:
60-
- python-version: "3.7"
61-
runs-on: windows-2022
62-
cmake-version: "3.21.x"
6360
- python-version: "pypy-3.8"
6461
runs-on: windows-2022
6562
cmake-version: "3.21.x"
6663
- python-version: "3.11"
6764
runs-on: windows-2022
6865
cmake-version: "3.26.x"
69-
- python-version: "pypy-3.7"
70-
runs-on: ubuntu-latest
71-
cmake-version: "3.15.x"
7266
- python-version: "pypy-3.10"
7367
runs-on: ubuntu-latest
7468
cmake-version: "3.15.x"
@@ -99,13 +93,9 @@ jobs:
9993
- python-version: "3.13"
10094
runs-on: windows-latest
10195
cmake-version: "3.26.x"
102-
- python-version: "3.7"
96+
- python-version: "3.8"
10397
runs-on: ubuntu-22.04
10498
cmake-version: "3.15.x"
105-
exclude:
106-
- python-version: "3.7"
107-
runs-on: ubuntu-latest
108-
cmake-version: "3.15.x"
10999

110100
steps:
111101
- uses: actions/checkout@v4
@@ -118,23 +108,17 @@ jobs:
118108
allow-prereleases: true
119109

120110
- uses: astral-sh/setup-uv@v5
121-
if:
122-
matrix.python-version != '3.7' && matrix.python-version != 'pypy-3.8'
123-
&& matrix.python-version != 'pypy-3.7'
111+
if: matrix.python-version != 'pypy-3.8'
124112

125113
- name: Install package (uv)
126-
if:
127-
matrix.python-version != '3.7' && matrix.python-version != 'pypy-3.8'
128-
&& matrix.python-version != 'pypy-3.7'
114+
if: matrix.python-version != 'pypy-3.8'
129115
run:
130116
uv pip install
131117
-e.[test,test-meta,test-numpy,test-schema,test-hatchling,wheels,cov,wheel-free-setuptools]
132118
--system
133119

134120
- name: Install package (pip)
135-
if:
136-
matrix.python-version == '3.7' || matrix.python-version == 'pypy-3.8'
137-
|| matrix.python-version == 'pypy-3.7'
121+
if: matrix.python-version == 'pypy-3.8'
138122
run:
139123
pip install
140124
-e.[test,test-meta,test-numpy,test-schema,wheels,cov,wheel-free-setuptools]

.pre-commit-config.yaml

+1-2
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,8 @@ repos:
7676
- cmake
7777
- exceptiongroup
7878
- hatch-fancy-pypi-readme>=24
79-
- importlib-metadata>=6.6.0
8079
- importlib-resources
81-
- markdown-it-py<3 # Python 3.7 compat needed for mypy check
80+
- markdown-it-py
8281
- ninja
8382
- nox
8483
- orjson

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ features over classic Scikit-build:
7070
The following limitations are present compared to classic scikit-build:
7171

7272
- The minimum supported CMake is 3.15
73-
- The minimum supported Python is 3.7
73+
- The minimum supported Python is 3.8 (3.7+ for 0.10.x and older)
7474

7575
Some known missing features that will be developed soon:
7676

@@ -218,7 +218,7 @@ sdist.cmake = false
218218
wheel.packages = ["src/<package>", "python/<package>", "<package>"]
219219

220220
# The Python tags. The default (empty string) will use the default Python
221-
# version. You can also set this to "cp37" to enable the CPython 3.7+ Stable ABI
221+
# version. You can also set this to "cp38" to enable the CPython 3.8+ Stable ABI
222222
# / Limited API (only on CPython and if the version is sufficient, otherwise
223223
# this has no effect). Or you can set it to "py3" or "py2.py3" to ignore Python
224224
# ABI compatibility. The ABI tag is inferred from this tag.

docs/cmakelists.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ in your `pyproject.toml`:
123123

124124
```toml
125125
[tool.scikit-build]
126-
wheel.py-api = "cp37"
126+
wheel.py-api = "cp38"
127127
```
128128

129129
When you do that, `${SKBUILD_SABI_COMPONENT}` will be set to

docs/conf.py

+2-6
Original file line numberDiff line numberDiff line change
@@ -7,17 +7,13 @@
77
from __future__ import annotations
88

99
import importlib
10+
import importlib.metadata
1011
import inspect
1112
import os
1213
import sys
1314
import warnings
1415
from pathlib import Path
1516

16-
if sys.version_info < (3, 8):
17-
import importlib_metadata
18-
else:
19-
import importlib.metadata as importlib_metadata
20-
2117
try:
2218
import scikit_build_core
2319
except ModuleNotFoundError:
@@ -32,7 +28,7 @@
3228
from scikit_build_core import __version__ as version
3329
except ModuleNotFoundError:
3430
try:
35-
version = importlib_metadata.version("scikit_build_core")
31+
version = importlib.metadata.version("scikit_build_core")
3632
except ModuleNotFoundError:
3733
msg = (
3834
"Package should be installed to produce documentation! "

docs/configuration.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -352,7 +352,7 @@ the wheel tags for the version you support:
352352

353353
```toml
354354
[tool.scikit-build]
355-
wheel.py-api = "cp37"
355+
wheel.py-api = "cp38"
356356
```
357357

358358
Scikit-build-core will only target ABI3 if the version of Python is equal to or
@@ -698,8 +698,8 @@ configuration. Recommendations:
698698
Known limitations:
699699

700700
- Resources (via `importlib.resources`) are not properly supported (yet).
701-
Currently experimentally supported except on Python 3.9 (3.7, 3.8, 3.10, 3.11,
702-
and 3.12 work). `importlib_resources` may work on Python 3.9.
701+
Currently experimentally supported except on Python 3.9 (3.8, 3.10, 3.11,
702+
3.12, and 3.13 work). `importlib_resources` may work on Python 3.9.
703703

704704
```console
705705
# Very experimental rebuild on initial import feature

docs/examples/downstream/pybind11_example/README.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
| pip builds | [![Pip Actions Status][actions-pip-badge]][actions-pip-link] |
99

1010
An example project built with [pybind11](https://github.com/pybind/pybind11) and
11-
scikit-build-core. Python 3.7+ (see older commits for older versions of Python).
11+
scikit-build-core. Python 3.8+ (see older commits for older versions of Python).
1212

1313
[gitter-badge]: https://badges.gitter.im/pybind/Lobby.svg
1414
[gitter-link]: https://gitter.im/pybind/Lobby

docs/examples/downstream/pybind11_example/pyproject.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -11,16 +11,17 @@ readme = "README.md"
1111
authors = [
1212
{ name = "My Name", email = "[email protected]" },
1313
]
14-
requires-python = ">=3.7"
14+
requires-python = ">=3.8"
1515
classifiers = [
1616
"Development Status :: 4 - Beta",
1717
"License :: OSI Approved :: MIT License",
1818
"Programming Language :: Python :: 3 :: Only",
19-
"Programming Language :: Python :: 3.7",
2019
"Programming Language :: Python :: 3.8",
2120
"Programming Language :: Python :: 3.9",
2221
"Programming Language :: Python :: 3.10",
2322
"Programming Language :: Python :: 3.11",
23+
"Programming Language :: Python :: 3.12",
24+
"Programming Language :: Python :: 3.13",
2425
]
2526

2627
[project.optional-dependencies]

docs/examples/getting_started/abi3/CMakeLists.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,6 @@ find_package(
66
COMPONENTS Interpreter Development.SABIModule
77
REQUIRED)
88

9-
python_add_library(example MODULE example.c WITH_SOABI USE_SABI 3.7)
9+
python_add_library(example MODULE example.c WITH_SOABI USE_SABI 3.8)
1010

1111
install(TARGETS example DESTINATION .)

docs/examples/getting_started/abi3/pyproject.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,4 +7,4 @@ name = "example"
77
version = "0.0.1"
88

99
[tool.scikit-build-core]
10-
wheel.py-api = "cp37"
10+
wheel.py-api = "cp38"

docs/plugins/hatchling.md

-2
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,6 @@ Key limitations:
7373
needed.
7474
- Anything in `${SKBUILD_METADATA_DIR}` must be placed in an `extra_metadata`
7575
folder.
76-
- Python 3.8 highly recommended as features are missing from the last Hatchling
77-
to support 3.7.
7876

7977
## Writing CMakeLists.txt
8078

pyproject.toml

+4-10
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ authors = [
99
]
1010
description = "Build backend for CMake based projects"
1111
readme = "README.md"
12-
requires-python = ">=3.7"
12+
requires-python = ">=3.8"
1313
classifiers = [
1414
"Topic :: Scientific/Engineering",
1515
"Topic :: Software Development :: Build Tools",
@@ -20,7 +20,6 @@ classifiers = [
2020
"Programming Language :: Python",
2121
"Programming Language :: Python :: 3",
2222
"Programming Language :: Python :: 3 :: Only",
23-
"Programming Language :: Python :: 3.7",
2423
"Programming Language :: Python :: 3.8",
2524
"Programming Language :: Python :: 3.9",
2625
"Programming Language :: Python :: 3.10",
@@ -35,7 +34,6 @@ dynamic = ["version"]
3534

3635
dependencies = [
3736
"exceptiongroup >=1.0; python_version<'3.11'",
38-
"importlib-metadata >=4.13; python_version<'3.8'",
3937
"importlib-resources >=1.3; python_version<'3.9'",
4038
"packaging >=21.3",
4139
"pathspec >=0.10.1",
@@ -72,7 +70,6 @@ test-meta = [
7270
]
7371
test-numpy = [
7472
"numpy; python_version<'3.13' and platform_python_implementation!='PyPy'",
75-
"numpy~=1.21.0; python_version=='3.7' and platform_python_implementation=='PyPy' and sys_platform == 'linux'",
7673
"numpy~=1.24.0; python_version=='3.8' and platform_python_implementation=='PyPy'",
7774
"numpy~=2.0.0; python_version=='3.9' and platform_python_implementation=='PyPy'",
7875
]
@@ -186,7 +183,7 @@ ignore_missing_imports = true
186183

187184

188185
[tool.pylint]
189-
py-version = "3.7"
186+
py-version = "3.8"
190187
jobs = "0"
191188
reports.output-format = "colorized"
192189
good-names = ["f"]
@@ -290,20 +287,17 @@ known-local-folder = ["pathutils"]
290287
"typing.Mapping".msg = "Use collections.abc.Mapping instead."
291288
"typing.Sequence".msg = "Use collections.abc.Sequence instead."
292289
"typing.Set".msg = "Use collections.abc.Set instead."
293-
"typing.Literal".msg = "Use scikit_build_core._compat.typing.Literal instead."
294-
"typing.Protocol".msg = "Use scikit_build_core._compat.typing.Protocol instead."
295290
"typing.Self".msg = "Use scikit_build_core._compat.typing.Self instead."
296291
"typing_extensions.Self".msg = "Use scikit_build_core._compat.typing.Self instead."
297-
"typing.runtime_checkable".msg = "Add and use scikit_build_core._compat.typing.runtime_checkable instead."
298292
"typing.Final".msg = "Add scikit_build_core._compat.typing.Final instead."
299293
"typing.NotRequired".msg = "Add scikit_build_core._compat.typing.NotRequired instead."
300294
"typing.OrderedDict".msg = "Add scikit_build_core._compat.typing.OrderedDict instead."
301295
"typing.TypedDict".msg = "Add scikit_build_core._compat.typing.TypedDict instead."
302296
"typing.assert_never".msg = "Add scikit_build_core._compat.typing.assert_never instead."
303297
"tomli".msg = "Use scikit_build_core._compat.tomllib instead."
304298
"tomllib".msg = "Use scikit_build_core._compat.tomllib instead."
305-
"importlib.metadata".msg = "Use scikit_build_core._compat.importlib.metadata instead."
306-
"importlib_metadata".msg = "Use scikit_build_core._compat.importlib.metadata instead."
299+
"importlib_metadata".msg = "Use importlib.metadata directly instead."
300+
"importlib.metadata.entry_points".msg = "Use scikit_build_core._compat.importlib.metadata.entry_points instead."
307301
"importlib.resources".msg = "Use scikit_build_core._compat.importlib.resources instead."
308302
"importlib_resources".msg = "Use scikit_build_core._compat.importlib.resources instead."
309303
"pyproject_metadata".msg = "Use scikit_build_core._vendor.pyproject_metadata instead."

src/scikit_build_core/_compat/importlib/metadata.py

+6-20
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,26 @@
11
from __future__ import annotations
22

3+
import importlib.metadata
34
import sys
45
import typing
56

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-
13-
147
if typing.TYPE_CHECKING:
15-
if sys.version_info < (3, 8):
16-
from importlib_metadata import EntryPoints
17-
elif sys.version_info < (3, 10):
8+
if sys.version_info < (3, 10):
189
from importlib.metadata import EntryPoint
1910

2011
EntryPoints = typing.List[EntryPoint]
2112
else:
2213
from importlib.metadata import EntryPoints
2314

24-
__all__ = ["PathDistribution", "entry_points", "version"]
15+
__all__ = ["entry_points"]
2516

2617

2718
def entry_points(*, group: str) -> EntryPoints:
2819
if sys.version_info >= (3, 10):
29-
return _metadata.entry_points(group=group)
30-
31-
epg = _metadata.entry_points()
32-
33-
if sys.version_info < (3, 8) and hasattr(epg, "select"):
34-
return epg.select(group=group) # type: ignore[no-any-return, no-untyped-call]
20+
return importlib.metadata.entry_points(group=group)
3521

36-
# pylint: disable-next=no-member
37-
return epg.get(group, [])
22+
epg = importlib.metadata.entry_points()
23+
return epg.get(group, []) # pylint: disable=no-member
3824

3925

4026
def __dir__() -> list[str]:

src/scikit_build_core/_compat/typing.py

-10
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,6 @@
33
import sys
44
import typing
55

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
13-
146
if sys.version_info < (3, 9):
157
from typing_extensions import Annotated, get_args, get_origin
168
else:
@@ -31,8 +23,6 @@ def assert_never(_: object) -> None:
3123

3224
__all__ = [
3325
"Annotated",
34-
"Literal",
35-
"Protocol",
3626
"Self",
3727
"assert_never",
3828
"get_args",

0 commit comments

Comments
 (0)