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

feat: drop python<=3.7 support #769

Merged
merged 6 commits into from
Feb 8, 2025
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
4 changes: 2 additions & 2 deletions .github/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ build-backend = "scikit_build_core.build"
[project]
name = "cmake_example"
version = "0.0.1"
requires-python = ">=3.7"
requires-python = ">=3.8"

[project.optional-dependencies]
test = ["pytest>=6.0"]
Expand Down Expand Up @@ -275,7 +275,7 @@ setup(
cmake_source_dir=".",
zip_safe=False,
extras_require={"test": ["pytest>=6.0"]},
python_requires=">=3.7",
python_requires=">=3.8",
)
```

Expand Down
26 changes: 5 additions & 21 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,17 @@ jobs:
strategy:
fail-fast: false
matrix:
python-version: ["3.7", "pypy-3.9", "3.12", "3.13"]
python-version: ["3.8", "pypy-3.9", "3.13"]
runs-on: [ubuntu-latest, macos-13]
cmake-version: ["3.15.x"]

include:
- python-version: "3.7"
runs-on: windows-2022
cmake-version: "3.21.x"
- python-version: "pypy-3.8"
runs-on: windows-2022
cmake-version: "3.21.x"
- python-version: "3.11"
runs-on: windows-2022
cmake-version: "3.26.x"
- python-version: "pypy-3.7"
runs-on: ubuntu-latest
cmake-version: "3.15.x"
- python-version: "pypy-3.10"
runs-on: ubuntu-latest
cmake-version: "3.15.x"
Expand Down Expand Up @@ -99,13 +93,9 @@ jobs:
- python-version: "3.13"
runs-on: windows-latest
cmake-version: "3.26.x"
- python-version: "3.7"
- python-version: "3.8"
runs-on: ubuntu-22.04
cmake-version: "3.15.x"
exclude:
- python-version: "3.7"
runs-on: ubuntu-latest
cmake-version: "3.15.x"

steps:
- uses: actions/checkout@v4
Expand All @@ -118,23 +108,17 @@ jobs:
allow-prereleases: true

- uses: astral-sh/setup-uv@v5
if:
matrix.python-version != '3.7' && matrix.python-version != 'pypy-3.8'
&& matrix.python-version != 'pypy-3.7'
if: matrix.python-version != 'pypy-3.8'

- name: Install package (uv)
if:
matrix.python-version != '3.7' && matrix.python-version != 'pypy-3.8'
&& matrix.python-version != 'pypy-3.7'
if: matrix.python-version != 'pypy-3.8'
run:
uv pip install
-e.[test,test-meta,test-numpy,test-schema,test-hatchling,wheels,cov,wheel-free-setuptools]
--system

- name: Install package (pip)
if:
matrix.python-version == '3.7' || matrix.python-version == 'pypy-3.8'
|| matrix.python-version == 'pypy-3.7'
if: matrix.python-version == 'pypy-3.8'
run:
pip install
-e.[test,test-meta,test-numpy,test-schema,wheels,cov,wheel-free-setuptools]
Expand Down
3 changes: 1 addition & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,8 @@ repos:
- cmake
- exceptiongroup
- hatch-fancy-pypi-readme>=24
- importlib-metadata>=6.6.0
- importlib-resources
- markdown-it-py<3 # Python 3.7 compat needed for mypy check
- markdown-it-py
- ninja
- nox
- orjson
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ features over classic Scikit-build:
The following limitations are present compared to classic scikit-build:

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

Some known missing features that will be developed soon:

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

# The Python tags. The default (empty string) will use the default Python
# version. You can also set this to "cp37" to enable the CPython 3.7+ Stable ABI
# version. You can also set this to "cp38" to enable the CPython 3.8+ Stable ABI
# / Limited API (only on CPython and if the version is sufficient, otherwise
# this has no effect). Or you can set it to "py3" or "py2.py3" to ignore Python
# ABI compatibility. The ABI tag is inferred from this tag.
Expand Down
2 changes: 1 addition & 1 deletion docs/cmakelists.md
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ in your `pyproject.toml`:

```toml
[tool.scikit-build]
wheel.py-api = "cp37"
wheel.py-api = "cp38"
```

When you do that, `${SKBUILD_SABI_COMPONENT}` will be set to
Expand Down
8 changes: 2 additions & 6 deletions docs/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,13 @@
from __future__ import annotations

import importlib
import importlib.metadata
import inspect
import os
import sys
import warnings
from pathlib import Path

if sys.version_info < (3, 8):
import importlib_metadata
else:
import importlib.metadata as importlib_metadata

try:
import scikit_build_core
except ModuleNotFoundError:
Expand All @@ -32,7 +28,7 @@
from scikit_build_core import __version__ as version
except ModuleNotFoundError:
try:
version = importlib_metadata.version("scikit_build_core")
version = importlib.metadata.version("scikit_build_core")
except ModuleNotFoundError:
msg = (
"Package should be installed to produce documentation! "
Expand Down
6 changes: 3 additions & 3 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ the wheel tags for the version you support:

```toml
[tool.scikit-build]
wheel.py-api = "cp37"
wheel.py-api = "cp38"
```

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

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

```console
# Very experimental rebuild on initial import feature
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/downstream/pybind11_example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
| pip builds | [![Pip Actions Status][actions-pip-badge]][actions-pip-link] |

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

[gitter-badge]: https://badges.gitter.im/pybind/Lobby.svg
[gitter-link]: https://gitter.im/pybind/Lobby
Expand Down
5 changes: 3 additions & 2 deletions docs/examples/downstream/pybind11_example/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,17 @@ readme = "README.md"
authors = [
{ name = "My Name", email = "[email protected]" },
]
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Development Status :: 4 - Beta",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
]

[project.optional-dependencies]
Expand Down
2 changes: 1 addition & 1 deletion docs/examples/getting_started/abi3/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ find_package(
COMPONENTS Interpreter Development.SABIModule
REQUIRED)

python_add_library(example MODULE example.c WITH_SOABI USE_SABI 3.7)
python_add_library(example MODULE example.c WITH_SOABI USE_SABI 3.8)

install(TARGETS example DESTINATION .)
2 changes: 1 addition & 1 deletion docs/examples/getting_started/abi3/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ name = "example"
version = "0.0.1"

[tool.scikit-build-core]
wheel.py-api = "cp37"
wheel.py-api = "cp38"
2 changes: 0 additions & 2 deletions docs/plugins/hatchling.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,6 @@ Key limitations:
needed.
- Anything in `${SKBUILD_METADATA_DIR}` must be placed in an `extra_metadata`
folder.
- Python 3.8 highly recommended as features are missing from the last Hatchling
to support 3.7.

## Writing CMakeLists.txt

Expand Down
14 changes: 4 additions & 10 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ authors = [
]
description = "Build backend for CMake based projects"
readme = "README.md"
requires-python = ">=3.7"
requires-python = ">=3.8"
classifiers = [
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Build Tools",
Expand All @@ -20,7 +20,6 @@ classifiers = [
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
Expand All @@ -35,7 +34,6 @@ dynamic = ["version"]

dependencies = [
"exceptiongroup >=1.0; python_version<'3.11'",
"importlib-metadata >=4.13; python_version<'3.8'",
"importlib-resources >=1.3; python_version<'3.9'",
"packaging >=21.3",
"pathspec >=0.10.1",
Expand Down Expand Up @@ -72,7 +70,6 @@ test-meta = [
]
test-numpy = [
"numpy; python_version<'3.13' and platform_python_implementation!='PyPy'",
"numpy~=1.21.0; python_version=='3.7' and platform_python_implementation=='PyPy' and sys_platform == 'linux'",
"numpy~=1.24.0; python_version=='3.8' and platform_python_implementation=='PyPy'",
"numpy~=2.0.0; python_version=='3.9' and platform_python_implementation=='PyPy'",
]
Expand Down Expand Up @@ -186,7 +183,7 @@ ignore_missing_imports = true


[tool.pylint]
py-version = "3.7"
py-version = "3.8"
jobs = "0"
reports.output-format = "colorized"
good-names = ["f"]
Expand Down Expand Up @@ -290,20 +287,17 @@ known-local-folder = ["pathutils"]
"typing.Mapping".msg = "Use collections.abc.Mapping instead."
"typing.Sequence".msg = "Use collections.abc.Sequence instead."
"typing.Set".msg = "Use collections.abc.Set instead."
"typing.Literal".msg = "Use scikit_build_core._compat.typing.Literal instead."
"typing.Protocol".msg = "Use scikit_build_core._compat.typing.Protocol instead."
"typing.Self".msg = "Use scikit_build_core._compat.typing.Self instead."
"typing_extensions.Self".msg = "Use scikit_build_core._compat.typing.Self instead."
"typing.runtime_checkable".msg = "Add and use scikit_build_core._compat.typing.runtime_checkable instead."
"typing.Final".msg = "Add scikit_build_core._compat.typing.Final instead."
"typing.NotRequired".msg = "Add scikit_build_core._compat.typing.NotRequired instead."
"typing.OrderedDict".msg = "Add scikit_build_core._compat.typing.OrderedDict instead."
"typing.TypedDict".msg = "Add scikit_build_core._compat.typing.TypedDict instead."
"typing.assert_never".msg = "Add scikit_build_core._compat.typing.assert_never instead."
"tomli".msg = "Use scikit_build_core._compat.tomllib instead."
"tomllib".msg = "Use scikit_build_core._compat.tomllib instead."
"importlib.metadata".msg = "Use scikit_build_core._compat.importlib.metadata instead."
"importlib_metadata".msg = "Use scikit_build_core._compat.importlib.metadata instead."
"importlib_metadata".msg = "Use importlib.metadata directly instead."
"importlib.metadata.entry_points".msg = "Use scikit_build_core._compat.importlib.metadata.entry_points instead."
"importlib.resources".msg = "Use scikit_build_core._compat.importlib.resources instead."
"importlib_resources".msg = "Use scikit_build_core._compat.importlib.resources instead."
"pyproject_metadata".msg = "Use scikit_build_core._vendor.pyproject_metadata instead."
Expand Down
26 changes: 6 additions & 20 deletions src/scikit_build_core/_compat/importlib/metadata.py
Original file line number Diff line number Diff line change
@@ -1,40 +1,26 @@
from __future__ import annotations

import importlib.metadata
import sys
import typing

if sys.version_info < (3, 8):
import importlib_metadata as _metadata
from importlib_metadata import PathDistribution, version
else:
import importlib.metadata as _metadata
from importlib.metadata import PathDistribution, version


if typing.TYPE_CHECKING:
if sys.version_info < (3, 8):
from importlib_metadata import EntryPoints
elif sys.version_info < (3, 10):
if sys.version_info < (3, 10):
from importlib.metadata import EntryPoint

EntryPoints = typing.List[EntryPoint]
else:
from importlib.metadata import EntryPoints

__all__ = ["PathDistribution", "entry_points", "version"]
__all__ = ["entry_points"]


def entry_points(*, group: str) -> EntryPoints:
if sys.version_info >= (3, 10):
return _metadata.entry_points(group=group)

epg = _metadata.entry_points()

if sys.version_info < (3, 8) and hasattr(epg, "select"):
return epg.select(group=group) # type: ignore[no-any-return, no-untyped-call]
return importlib.metadata.entry_points(group=group)

# pylint: disable-next=no-member
return epg.get(group, [])
epg = importlib.metadata.entry_points()
return epg.get(group, []) # pylint: disable=no-member


def __dir__() -> list[str]:
Expand Down
10 changes: 0 additions & 10 deletions src/scikit_build_core/_compat/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,6 @@
import sys
import typing

if sys.version_info < (3, 8):
from typing_extensions import (
Literal,
Protocol,
)
else:
from typing import Literal, Protocol

if sys.version_info < (3, 9):
from typing_extensions import Annotated, get_args, get_origin
else:
Expand All @@ -31,8 +23,6 @@ def assert_never(_: object) -> None:

__all__ = [
"Annotated",
"Literal",
"Protocol",
"Self",
"assert_never",
"get_args",
Expand Down
Loading
Loading