diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index 7118b71f3..3f79526d9 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -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"] @@ -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", ) ``` diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 2ad7da963..f9e01c83e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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" @@ -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 @@ -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] diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 8ff379160..0ab61c42e 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -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 diff --git a/README.md b/README.md index 151108917..b6a978865 100644 --- a/README.md +++ b/README.md @@ -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: @@ -218,7 +218,7 @@ sdist.cmake = false wheel.packages = ["src/", "python/", ""] # 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. diff --git a/docs/cmakelists.md b/docs/cmakelists.md index 062ec2da2..6fa989b69 100644 --- a/docs/cmakelists.md +++ b/docs/cmakelists.md @@ -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 diff --git a/docs/conf.py b/docs/conf.py index b9b96c3d5..6e3b2088c 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -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: @@ -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! " diff --git a/docs/configuration.md b/docs/configuration.md index 3a5bc4864..3984a7359 100644 --- a/docs/configuration.md +++ b/docs/configuration.md @@ -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 @@ -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 diff --git a/docs/examples/downstream/pybind11_example/README.md b/docs/examples/downstream/pybind11_example/README.md index a399572b8..e33800689 100644 --- a/docs/examples/downstream/pybind11_example/README.md +++ b/docs/examples/downstream/pybind11_example/README.md @@ -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 diff --git a/docs/examples/downstream/pybind11_example/pyproject.toml b/docs/examples/downstream/pybind11_example/pyproject.toml index 166229618..d967838f2 100644 --- a/docs/examples/downstream/pybind11_example/pyproject.toml +++ b/docs/examples/downstream/pybind11_example/pyproject.toml @@ -11,16 +11,17 @@ readme = "README.md" authors = [ { name = "My Name", email = "me@email.com" }, ] -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] diff --git a/docs/examples/getting_started/abi3/CMakeLists.txt b/docs/examples/getting_started/abi3/CMakeLists.txt index 5e6778e95..c4f4e3f36 100644 --- a/docs/examples/getting_started/abi3/CMakeLists.txt +++ b/docs/examples/getting_started/abi3/CMakeLists.txt @@ -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 .) diff --git a/docs/examples/getting_started/abi3/pyproject.toml b/docs/examples/getting_started/abi3/pyproject.toml index 4e0c78b0d..a86bc3503 100644 --- a/docs/examples/getting_started/abi3/pyproject.toml +++ b/docs/examples/getting_started/abi3/pyproject.toml @@ -7,4 +7,4 @@ name = "example" version = "0.0.1" [tool.scikit-build-core] -wheel.py-api = "cp37" +wheel.py-api = "cp38" diff --git a/docs/plugins/hatchling.md b/docs/plugins/hatchling.md index da886e633..a7d44e8f6 100644 --- a/docs/plugins/hatchling.md +++ b/docs/plugins/hatchling.md @@ -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 diff --git a/pyproject.toml b/pyproject.toml index c17ea6a0d..d5cfe2d8b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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", @@ -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", @@ -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", @@ -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'", ] @@ -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"] @@ -290,11 +287,8 @@ 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." @@ -302,8 +296,8 @@ known-local-folder = ["pathutils"] "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." diff --git a/src/scikit_build_core/_compat/importlib/metadata.py b/src/scikit_build_core/_compat/importlib/metadata.py index e313a6404..de215ddb4 100644 --- a/src/scikit_build_core/_compat/importlib/metadata.py +++ b/src/scikit_build_core/_compat/importlib/metadata.py @@ -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]: diff --git a/src/scikit_build_core/_compat/typing.py b/src/scikit_build_core/_compat/typing.py index b017982a8..e91286e82 100644 --- a/src/scikit_build_core/_compat/typing.py +++ b/src/scikit_build_core/_compat/typing.py @@ -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: @@ -31,8 +23,6 @@ def assert_never(_: object) -> None: __all__ = [ "Annotated", - "Literal", - "Protocol", "Self", "assert_never", "get_args", diff --git a/src/scikit_build_core/_logging.py b/src/scikit_build_core/_logging.py index c928026c3..cfa6bf6fe 100644 --- a/src/scikit_build_core/_logging.py +++ b/src/scikit_build_core/_logging.py @@ -9,12 +9,12 @@ import platform import sys from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, NoReturn +from typing import TYPE_CHECKING, Any, Literal, NoReturn if TYPE_CHECKING: from collections.abc import Iterator - from ._compat.typing import Literal, Self + from ._compat.typing import Self StrMapping = Mapping[str, "Style"] else: @@ -77,37 +77,31 @@ def __repr__(self) -> str: ) -if sys.version_info < (3, 8): - opts: Any = {} -else: - opts: Any = {"stacklevel": 2} - - class ScikitBuildLogger: # pylint: disable-next=redefined-outer-name def __init__(self, logger: logging.Logger) -> None: self.logger = logger def debug(self, msg: str, *args: object, **kwargs: object) -> None: - self.logger.debug(FStringMessage(msg, *args, **kwargs), **opts) + self.logger.debug(FStringMessage(msg, *args, **kwargs), stacklevel=2) def info(self, msg: str, *args: object, **kwargs: object) -> None: - self.logger.info(FStringMessage(msg, *args, **kwargs), **opts) + self.logger.info(FStringMessage(msg, *args, **kwargs), stacklevel=2) def warning(self, msg: str, *args: object, **kwargs: object) -> None: - self.logger.warning(FStringMessage(msg, *args, **kwargs), **opts) + self.logger.warning(FStringMessage(msg, *args, **kwargs), stacklevel=2) def error(self, msg: str, *args: object, **kwargs: object) -> None: - self.logger.error(FStringMessage(msg, *args, **kwargs), **opts) + self.logger.error(FStringMessage(msg, *args, **kwargs), stacklevel=2) def critical(self, msg: str, *args: object, **kwargs: object) -> None: - self.logger.critical(FStringMessage(msg, *args, **kwargs), **opts) + self.logger.critical(FStringMessage(msg, *args, **kwargs), stacklevel=2) def exception(self, msg: str, *args: object, **kwargs: object) -> None: - self.logger.exception(FStringMessage(msg, *args, **kwargs), **opts) + self.logger.exception(FStringMessage(msg, *args, **kwargs), stacklevel=2) def log(self, level: int, msg: str, *args: object, **kwargs: object) -> None: - self.logger.log(level, FStringMessage(msg, *args, **kwargs), **opts) + self.logger.log(level, FStringMessage(msg, *args, **kwargs), stacklevel=2) def setLevel(self, level: int) -> None: # noqa: N802 self.logger.setLevel(level) diff --git a/src/scikit_build_core/_shutil.py b/src/scikit_build_core/_shutil.py index e898587cf..612b96e86 100644 --- a/src/scikit_build_core/_shutil.py +++ b/src/scikit_build_core/_shutil.py @@ -1,17 +1,15 @@ from __future__ import annotations -import contextlib import dataclasses import os import stat import subprocess -import sys from typing import TYPE_CHECKING, ClassVar from ._logging import logger if TYPE_CHECKING: - from collections.abc import Generator, Iterable + from collections.abc import Iterable __all__ = ["Run"] @@ -100,12 +98,3 @@ def _fix_all_permissions(directory: str) -> None: mode = stat.S_IMODE(entry.stat().st_mode) if not mode & stat.S_IWRITE: os.chmod(entry.path, mode | stat.S_IWRITE) # noqa: PTH101 - - -@contextlib.contextmanager -def fix_win_37_all_permissions(tmpdir: str) -> Generator[None, None, None]: - try: - yield - finally: - if sys.version_info < (3, 8) and sys.platform.startswith("win"): - _fix_all_permissions(tmpdir) diff --git a/src/scikit_build_core/build/wheel.py b/src/scikit_build_core/build/wheel.py index d46999ce6..c3e9a394d 100644 --- a/src/scikit_build_core/build/wheel.py +++ b/src/scikit_build_core/build/wheel.py @@ -8,15 +8,14 @@ import tempfile from collections.abc import Mapping from pathlib import Path -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Literal from packaging.requirements import Requirement from packaging.utils import canonicalize_name from .._compat import tomllib -from .._compat.typing import Literal, assert_never +from .._compat.typing import assert_never from .._logging import LEVEL_VALUE, logger, rich_error, rich_print -from .._shutil import fix_win_37_all_permissions from ..builder.builder import Builder, archs_to_tags, get_archs from ..builder.wheel_tag import WheelTag from ..cmake import CMake, CMaker @@ -261,7 +260,7 @@ def _build_wheel_impl_impl( f"{{red}}({state})", ) - with tempfile.TemporaryDirectory() as tmpdir, fix_win_37_all_permissions(tmpdir): + with tempfile.TemporaryDirectory() as tmpdir: build_tmp_folder = Path(tmpdir) wheel_dir = build_tmp_folder / "wheel" diff --git a/src/scikit_build_core/builder/get_requires.py b/src/scikit_build_core/builder/get_requires.py index 9142d8886..be22448de 100644 --- a/src/scikit_build_core/builder/get_requires.py +++ b/src/scikit_build_core/builder/get_requires.py @@ -5,7 +5,7 @@ import importlib.util import os import sysconfig -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Literal from packaging.tags import sys_tags @@ -24,7 +24,7 @@ if TYPE_CHECKING: from collections.abc import Generator, Mapping - from .._compat.typing import Literal, Self + from .._compat.typing import Self from ..settings.skbuild_model import ScikitBuildSettings __all__ = ["GetRequires"] diff --git a/src/scikit_build_core/builder/sysconfig.py b/src/scikit_build_core/builder/sysconfig.py index 47aa64424..cd354946e 100644 --- a/src/scikit_build_core/builder/sysconfig.py +++ b/src/scikit_build_core/builder/sysconfig.py @@ -5,7 +5,7 @@ import sys import sysconfig from pathlib import Path -from typing import TYPE_CHECKING +from typing import TYPE_CHECKING, Literal import packaging.tags @@ -14,8 +14,6 @@ if TYPE_CHECKING: from collections.abc import Mapping - from .._compat.typing import Literal - __all__ = [ "get_abi_flags", "get_cmake_platform", @@ -129,13 +127,6 @@ def get_host_platform() -> str: Return a string that identifies the current platform. This mimics setuptools get_host_platform (without 3.8 aix compat). """ - - if sys.version_info < (3, 8) and os.name == "nt": - if "(arm)" in sys.version.lower(): - return "win-arm32" - if "(arm64)" in sys.version.lower(): - return "win-arm64" - return sysconfig.get_platform() @@ -176,7 +167,7 @@ def get_soabi(env: Mapping[str, str], *, abi3: bool = False) -> str: if setuptools_ext_suffix: return setuptools_ext_suffix.rsplit(".", 1)[0].lstrip(".") - if sys.version_info < (3, 8, 7): + if sys.version_info < (3, 8, 7): # noqa: UP036 # See https://github.com/python/cpython/issues/84006 import distutils.sysconfig # pylint: disable=deprecated-module diff --git a/src/scikit_build_core/builder/wheel_tag.py b/src/scikit_build_core/builder/wheel_tag.py index cf517eb15..44f50a2fc 100644 --- a/src/scikit_build_core/builder/wheel_tag.py +++ b/src/scikit_build_core/builder/wheel_tag.py @@ -164,7 +164,7 @@ def as_tags_set(self) -> frozenset[packaging.tags.Tag]: parser.add_argument( "--abi", default="", - help="Specify py-api, like 'cp37' or 'py3'", + help="Specify py-api, like 'cp38' or 'py3'", ) parser.add_argument( "--purelib", diff --git a/src/scikit_build_core/hatch/plugin.py b/src/scikit_build_core/hatch/plugin.py index f3199284f..2af6bbb80 100644 --- a/src/scikit_build_core/hatch/plugin.py +++ b/src/scikit_build_core/hatch/plugin.py @@ -3,6 +3,7 @@ from __future__ import annotations import copy +import importlib.metadata import os import shutil import sys @@ -10,15 +11,13 @@ import tempfile import typing from pathlib import Path -from typing import Any +from typing import Any, Literal from hatchling.builders.hooks.plugin.interface import BuildHookInterface from packaging.version import Version from scikit_build_core.settings.skbuild_model import ScikitBuildSettings -from .._compat.importlib.metadata import version as pkg_version -from .._compat.typing import Literal from .._logging import logger, rich_print from ..build._init import setup_logging from ..builder.builder import Builder, archs_to_tags, get_archs @@ -222,7 +221,7 @@ def _initialize(self, *, build_data: dict[str, Any]) -> None: f"SKBUILD_{k.upper()}_DIR": v for k, v in wheel_dirs.items() } cache_entries["SKBUILD_STATE"] = state - cache_entries["SKBUILD_HATCHLING"] = pkg_version("hatchling") + cache_entries["SKBUILD_HATCHLING"] = importlib.metadata.version("hatchling") builder.configure( defines=defines, cache_entries=cache_entries, diff --git a/src/scikit_build_core/program_search.py b/src/scikit_build_core/program_search.py index a906fb4ef..48ecae9b8 100644 --- a/src/scikit_build_core/program_search.py +++ b/src/scikit_build_core/program_search.py @@ -6,7 +6,7 @@ import subprocess import sys from pathlib import Path -from typing import TYPE_CHECKING, NamedTuple +from typing import TYPE_CHECKING, Literal, NamedTuple from packaging.version import InvalidVersion, Version @@ -18,7 +18,6 @@ from packaging.specifiers import SpecifierSet - from ._compat.typing import Literal __all__ = [ "Program", diff --git a/src/scikit_build_core/resources/scikit-build.schema.json b/src/scikit_build_core/resources/scikit-build.schema.json index 8d13b7124..d8e87df88 100644 --- a/src/scikit_build_core/resources/scikit-build.schema.json +++ b/src/scikit_build_core/resources/scikit-build.schema.json @@ -200,7 +200,7 @@ "py-api": { "type": "string", "default": "", - "description": "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 / 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." + "description": "The Python tags. The default (empty string) will use the default Python 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-macos-universal-tags": { "type": "boolean", diff --git a/src/scikit_build_core/settings/_load_provider.py b/src/scikit_build_core/settings/_load_provider.py index d53964b10..d992e4218 100644 --- a/src/scikit_build_core/settings/_load_provider.py +++ b/src/scikit_build_core/settings/_load_provider.py @@ -3,9 +3,7 @@ import importlib import sys from pathlib import Path -from typing import TYPE_CHECKING, Any, Union - -from .._compat.typing import Protocol +from typing import TYPE_CHECKING, Any, Protocol, Union if TYPE_CHECKING: from collections.abc import Generator, Iterable, Mapping diff --git a/src/scikit_build_core/settings/documentation.py b/src/scikit_build_core/settings/documentation.py index 798671f85..cd6fc1cb8 100644 --- a/src/scikit_build_core/settings/documentation.py +++ b/src/scikit_build_core/settings/documentation.py @@ -3,7 +3,6 @@ import ast import dataclasses import inspect -import sys import textwrap from pathlib import Path from typing import TYPE_CHECKING @@ -24,10 +23,6 @@ def __dir__() -> list[str]: def _get_value(value: ast.expr) -> str: - if sys.version_info < (3, 8): - assert isinstance(value, ast.Str) - return value.s - assert isinstance(value, ast.Constant) assert isinstance(value.value, str) return value.value diff --git a/src/scikit_build_core/settings/json_schema.py b/src/scikit_build_core/settings/json_schema.py index 326861964..4ecf888fe 100644 --- a/src/scikit_build_core/settings/json_schema.py +++ b/src/scikit_build_core/settings/json_schema.py @@ -3,13 +3,13 @@ import dataclasses import sys from pathlib import Path -from typing import Any, Union +from typing import Any, Literal, Union from packaging.specifiers import SpecifierSet from packaging.version import Version from .._compat.builtins import ExceptionGroup -from .._compat.typing import Annotated, Literal, get_args, get_origin +from .._compat.typing import Annotated, get_args, get_origin from .documentation import pull_docs __all__ = ["FailedConversionError", "convert_type", "to_json_schema"] diff --git a/src/scikit_build_core/settings/skbuild_model.py b/src/scikit_build_core/settings/skbuild_model.py index e32ad38a1..af1c7c4f2 100644 --- a/src/scikit_build_core/settings/skbuild_model.py +++ b/src/scikit_build_core/settings/skbuild_model.py @@ -1,11 +1,11 @@ import dataclasses from pathlib import Path -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Literal, Optional, Union from packaging.specifiers import SpecifierSet from packaging.version import Version -from .._compat.typing import Annotated, Literal +from .._compat.typing import Annotated __all__ = [ "BackportSettings", @@ -177,7 +177,7 @@ class WheelSettings: py_api: str = "" """ 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 + 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. diff --git a/src/scikit_build_core/settings/skbuild_overrides.py b/src/scikit_build_core/settings/skbuild_overrides.py index 2147aa4e8..67268f4f3 100644 --- a/src/scikit_build_core/settings/skbuild_overrides.py +++ b/src/scikit_build_core/settings/skbuild_overrides.py @@ -5,7 +5,7 @@ import re import sys from pathlib import Path -from typing import TYPE_CHECKING, Any +from typing import TYPE_CHECKING, Any, Literal import packaging.tags from packaging.specifiers import SpecifierSet @@ -28,8 +28,6 @@ def __dir__() -> list[str]: if TYPE_CHECKING: from collections.abc import Mapping - from .._compat.typing import Literal - def strtobool(value: str) -> bool: """ diff --git a/src/scikit_build_core/settings/skbuild_read_settings.py b/src/scikit_build_core/settings/skbuild_read_settings.py index f38453778..a3bd624f1 100644 --- a/src/scikit_build_core/settings/skbuild_read_settings.py +++ b/src/scikit_build_core/settings/skbuild_read_settings.py @@ -5,7 +5,7 @@ import difflib import sys from pathlib import Path -from typing import TYPE_CHECKING, Any, TypeVar +from typing import TYPE_CHECKING, Any, Literal, TypeVar from packaging.specifiers import SpecifierSet from packaging.version import Version @@ -24,7 +24,6 @@ import os from collections.abc import Generator, Mapping - from .._compat.typing import Literal __all__ = ["SettingsReader"] diff --git a/src/scikit_build_core/settings/sources.py b/src/scikit_build_core/settings/sources.py index 522584585..7cfb3c8ef 100644 --- a/src/scikit_build_core/settings/sources.py +++ b/src/scikit_build_core/settings/sources.py @@ -50,10 +50,10 @@ import dataclasses import os import typing -from typing import Any, TypeVar, Union +from typing import Any, Literal, Protocol, TypeVar, Union from .._compat.builtins import ExceptionGroup -from .._compat.typing import Annotated, Literal, Protocol, get_args, get_origin +from .._compat.typing import Annotated, get_args, get_origin if typing.TYPE_CHECKING: from collections.abc import Generator, Iterator, Mapping, Sequence @@ -67,34 +67,34 @@ def __dir__() -> list[str]: return __all__ -def _dig_strict(__dict: Mapping[str, Any], *names: str) -> Any: +def _dig_strict(_dict: Mapping[str, Any], /, *names: str) -> Any: for name in names: - __dict = __dict[name] - return __dict + _dict = _dict[name] + return _dict def _process_bool(value: str) -> bool: return value.strip().lower() not in {"0", "false", "off", "no", ""} -def _dig_not_strict(__dict: Mapping[str, Any], *names: str) -> Any: +def _dig_not_strict(_dict: Mapping[str, Any], /, *names: str) -> Any: for name in names: - __dict = __dict.get(name, {}) - return __dict + _dict = _dict.get(name, {}) + return _dict -def _dig_fields(__opt: Any, *names: str) -> Any: +def _dig_fields(opt: Any, /, *names: str) -> Any: for name in names: - fields = dataclasses.fields(__opt) + fields = dataclasses.fields(opt) types = [x.type for x in fields if x.name == name] if len(types) != 1: msg = f"Could not access {'.'.join(names)}" raise KeyError(msg) - (__opt,) = types - return __opt + (opt,) = types + return opt -def _process_union(target: type[Any]) -> Any: +def _process_union(target: type[Any], /) -> Any: """ Filters None out of Unions. If a Union only has one item, return that item. """ @@ -110,7 +110,7 @@ def _process_union(target: type[Any]) -> Any: return target -def _process_annotated(target: type[Any]) -> tuple[Any, tuple[Any, ...]]: +def _process_annotated(target: type[Any], /) -> tuple[Any, tuple[Any, ...]]: """ Splits annotated into raw type and annotations. If not annotated, the annotations will be empty. """ @@ -122,7 +122,7 @@ def _process_annotated(target: type[Any]) -> tuple[Any, tuple[Any, ...]]: return target, () -def _get_target_raw_type(target: type[Any] | Any) -> Any: +def _get_target_raw_type(target: type[Any] | Any, /) -> Any: """ Takes a type like ``Optional[str]`` and returns str, or ``Optional[Dict[str, int]]`` and returns dict. Returns Union for a Union with more than one @@ -135,14 +135,14 @@ def _get_target_raw_type(target: type[Any] | Any) -> Any: return origin or target -def _get_inner_type(__target: type[Any]) -> type[Any]: +def _get_inner_type(_target: type[Any], /) -> type[Any]: """ Takes a types like ``List[str]`` and returns str, or ``Dict[str, int]`` and returns int. """ - raw_target = _get_target_raw_type(__target) - target = _process_union(__target) + raw_target = _get_target_raw_type(_target) + target = _process_union(_target) if raw_target is list: return get_args(target)[0] # type: ignore[no-any-return] if raw_target is dict: @@ -152,20 +152,20 @@ def _get_inner_type(__target: type[Any]) -> type[Any]: def _nested_dataclass_to_names( - __target: type[Any] | Any, *inner: str + target: type[Any] | Any, /, *inner: str ) -> Iterator[list[str]]: """ Yields each entry, like ``("a", "b", "c")`` for ``a.b.c``. """ - if isinstance(__target, type) and dataclasses.is_dataclass(__target): - for field in dataclasses.fields(__target): + if isinstance(target, type) and dataclasses.is_dataclass(target): + for field in dataclasses.fields(target): yield from _nested_dataclass_to_names(field.type, *inner, field.name) else: yield list(inner) -def _dict_with_envvar(target: Any) -> Any: +def _dict_with_envvar(target: Any, /) -> Any: """ This produces values. Supports "env" and "default" keys. """ diff --git a/src/scikit_build_core/setuptools/build_cmake.py b/src/scikit_build_core/setuptools/build_cmake.py index 5654c7ca2..cdb48d528 100644 --- a/src/scikit_build_core/setuptools/build_cmake.py +++ b/src/scikit_build_core/setuptools/build_cmake.py @@ -3,7 +3,7 @@ import shutil import sys from pathlib import Path -from typing import TYPE_CHECKING, ClassVar +from typing import TYPE_CHECKING, ClassVar, Literal import setuptools import setuptools.errors @@ -19,7 +19,6 @@ if TYPE_CHECKING: from setuptools.dist import Distribution - from .._compat.typing import Literal from ..settings.skbuild_model import ScikitBuildSettings __all__ = [ diff --git a/tests/conftest.py b/tests/conftest.py index 1cfbbd5cd..ac394ca81 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -8,18 +8,12 @@ import subprocess import sys import sysconfig +from importlib import metadata from pathlib import Path -from typing import Any +from typing import Any, Literal, overload import virtualenv as _virtualenv -if sys.version_info < (3, 8): - import importlib_metadata as metadata - from typing_extensions import Literal, overload -else: - from importlib import metadata - from typing import Literal, overload - if sys.version_info < (3, 11): import tomli as tomllib else: @@ -211,10 +205,10 @@ def package_simple_pyproject_ext( ) -> PackageInfo: package = PackageInfo( "simple_pyproject_ext", - "58a92cd71f7750633296b0a44363e661ed83a908985158b83c187043ace6de4a", - "83c81c1b9ce2e065ac30d129d48628e01a37248f15035a8427a045a7d8e40c43", - "d04620a35f173ce8c94dbfdc48543e7b9f33474d6ee51221eec78b49f38b8766", - "d8b64bff613747b421f7c705bd9ce41b95164772a5b96789b27df79d83836148", + "71b4e95854ef8d04886758d24d18fe55ebe63648310acf58c7423387cca73508", + "ed930179fbf5adc2e71a64a6f9686c61fdcce477c85bc94dd51598641be886a7", + "0178462b64b4eb9c41ae70eb413a9cc111c340e431b240af1b218fe81b0c2ecb", + "de79895a9d5c2112257715214ab419d3635e841716655e8a55390e5d52445819", ) process_package(package, tmp_path, monkeypatch) return package diff --git a/tests/packages/abi3_pyproject_ext/CMakeLists.txt b/tests/packages/abi3_pyproject_ext/CMakeLists.txt index 33b13a2ac..43c6e5bef 100644 --- a/tests/packages/abi3_pyproject_ext/CMakeLists.txt +++ b/tests/packages/abi3_pyproject_ext/CMakeLists.txt @@ -14,10 +14,10 @@ if(NOT "${SKBUILD_SABI_VERSION}" STREQUAL "") python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI USE_SABI ${SKBUILD_SABI_VERSION}) - if(NOT SKBUILD_SABI_VERSION STREQUAL "3.7") + if(NOT SKBUILD_SABI_VERSION STREQUAL "3.8") message( FATAL_ERROR - "TEST FAILED: SKBUILD_SABI_VERSION (${SKBUILD_SABI_VERSION}) is not 3.7" + "TEST FAILED: SKBUILD_SABI_VERSION (${SKBUILD_SABI_VERSION}) is not 3.8" ) endif() else() diff --git a/tests/packages/abi3_pyproject_ext/pyproject.toml b/tests/packages/abi3_pyproject_ext/pyproject.toml index c62f98bfb..874a20cbf 100644 --- a/tests/packages/abi3_pyproject_ext/pyproject.toml +++ b/tests/packages/abi3_pyproject_ext/pyproject.toml @@ -7,5 +7,5 @@ name = "abi3-example" version = "0.0.1" [tool.scikit-build] -wheel.py-api = "cp37" +wheel.py-api = "cp38" messages.after-success = "This is a message after success" diff --git a/tests/packages/abi3_setuptools_ext/CMakeLists.txt b/tests/packages/abi3_setuptools_ext/CMakeLists.txt index 3456c488b..5fc6ad6c7 100644 --- a/tests/packages/abi3_setuptools_ext/CMakeLists.txt +++ b/tests/packages/abi3_setuptools_ext/CMakeLists.txt @@ -10,6 +10,6 @@ find_package( COMPONENTS Interpreter Development.SABIModule REQUIRED) -python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI USE_SABI 3.7) +python_add_library(abi3_example MODULE abi3_example.c WITH_SOABI USE_SABI 3.8) install(TARGETS abi3_example DESTINATION .) diff --git a/tests/packages/abi3_setuptools_ext/setup.cfg b/tests/packages/abi3_setuptools_ext/setup.cfg index f7a140186..fa5e0601b 100644 --- a/tests/packages/abi3_setuptools_ext/setup.cfg +++ b/tests/packages/abi3_setuptools_ext/setup.cfg @@ -4,8 +4,8 @@ version = 0.0.1 [options] zip_safe = False -python_requires = >=3.7 +python_requires = >=3.8 [bdist_wheel] -py_limited_api = cp37 +py_limited_api = cp38 diff --git a/tests/packages/filepath_pure/pyproject.toml b/tests/packages/filepath_pure/pyproject.toml index 96c9c103d..6f6afb932 100644 --- a/tests/packages/filepath_pure/pyproject.toml +++ b/tests/packages/filepath_pure/pyproject.toml @@ -5,7 +5,7 @@ build-backend = "scikit_build_core.build" [project] name = "cmake_dirs" version = "0.0.1" -requires-python = ">=3.7" +requires-python = ">=3.8" [project.optional-dependencies] test = ["pytest>=6.0"] diff --git a/tests/packages/fortran_example/pyproject.toml b/tests/packages/fortran_example/pyproject.toml index 2b89b2681..f3a18080f 100644 --- a/tests/packages/fortran_example/pyproject.toml +++ b/tests/packages/fortran_example/pyproject.toml @@ -6,7 +6,7 @@ build-backend = "scikit_build_core.build" name = "fibby" version = "0.0.1" description = "a minimal example package (fortran version)" -requires-python = ">=3.7" +requires-python = ">=3.8" classifiers = [ "License :: OSI Approved :: BSD License", ] diff --git a/tests/packages/hatchling/src/hatchling_example/_core.pyi b/tests/packages/hatchling/src/hatchling_example/_core.pyi index 7b97e109b..23f13a5b9 100644 --- a/tests/packages/hatchling/src/hatchling_example/_core.pyi +++ b/tests/packages/hatchling/src/hatchling_example/_core.pyi @@ -1,2 +1,2 @@ -def add(__a: int, __b: int) -> int: ... -def subtract(__a: int, __b: int) -> int: ... +def add(a: int, b: int, /) -> int: ... +def subtract(a: int, b: int, /) -> int: ... diff --git a/tests/packages/mixed_setuptools/setup.cfg b/tests/packages/mixed_setuptools/setup.cfg index 5b8282ab1..2696830cc 100644 --- a/tests/packages/mixed_setuptools/setup.cfg +++ b/tests/packages/mixed_setuptools/setup.cfg @@ -4,7 +4,7 @@ version = 3.1.4 [options] zip_safe = False -python_requires = >=3.7 +python_requires = >=3.8 packages = find: package_dir = =src diff --git a/tests/packages/mixed_setuptools/src/mixed_setuptools/_core.pyi b/tests/packages/mixed_setuptools/src/mixed_setuptools/_core.pyi index 1d7a916b8..4182d8b42 100644 --- a/tests/packages/mixed_setuptools/src/mixed_setuptools/_core.pyi +++ b/tests/packages/mixed_setuptools/src/mixed_setuptools/_core.pyi @@ -1 +1 @@ -def add(__a: int, __b: int) -> int: ... +def add(a: int, b: int, /) -> int: ... diff --git a/tests/packages/simple_pyproject_ext/pyproject.toml b/tests/packages/simple_pyproject_ext/pyproject.toml index 810a28773..4094a60b0 100644 --- a/tests/packages/simple_pyproject_ext/pyproject.toml +++ b/tests/packages/simple_pyproject_ext/pyproject.toml @@ -8,7 +8,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"] diff --git a/tests/packages/simple_pyproject_script_with_flags/pyproject.toml b/tests/packages/simple_pyproject_script_with_flags/pyproject.toml index 6f329e1b0..bc5d667fe 100644 --- a/tests/packages/simple_pyproject_script_with_flags/pyproject.toml +++ b/tests/packages/simple_pyproject_script_with_flags/pyproject.toml @@ -7,7 +7,7 @@ build-backend = "scikit_build_core.build" [project] name = "CMake.Example" version = "0.0.1" -requires-python = ">=3.7" +requires-python = ">=3.8" [tool.scikit-build] wheel.py-api = "py3" diff --git a/tests/packages/simple_pyproject_source_dir/pyproject.toml b/tests/packages/simple_pyproject_source_dir/pyproject.toml index c4426a36a..f47d01af0 100644 --- a/tests/packages/simple_pyproject_source_dir/pyproject.toml +++ b/tests/packages/simple_pyproject_source_dir/pyproject.toml @@ -11,7 +11,7 @@ cmake.source-dir = "src" [project] name = "CMake.Example" version = "0.0.1" -requires-python = ">=3.7" +requires-python = ">=3.8" [project.optional-dependencies] test = ["pytest>=6.0"] diff --git a/tests/packages/simple_setuptools_ext/setup.py b/tests/packages/simple_setuptools_ext/setup.py index 90b2ef675..09b82b814 100644 --- a/tests/packages/simple_setuptools_ext/setup.py +++ b/tests/packages/simple_setuptools_ext/setup.py @@ -8,6 +8,6 @@ package_dir={"": "src"}, packages=find_packages(), extras_require={"test": ["pytest>=6.0"]}, - python_requires=">=3.7", + python_requires=">=3.8", license_files=["LICENSE"], ) diff --git a/tests/packages/simplest_c/src/simplest/_module.pyi b/tests/packages/simplest_c/src/simplest/_module.pyi index bc64b0575..73c9910cf 100644 --- a/tests/packages/simplest_c/src/simplest/_module.pyi +++ b/tests/packages/simplest_c/src/simplest/_module.pyi @@ -1 +1 @@ -def square(__x: float) -> float: ... +def square(x: float, /) -> float: ... diff --git a/tests/packages/toml_setuptools_ext/pyproject.toml b/tests/packages/toml_setuptools_ext/pyproject.toml index 04c41e85e..ba419b17f 100644 --- a/tests/packages/toml_setuptools_ext/pyproject.toml +++ b/tests/packages/toml_setuptools_ext/pyproject.toml @@ -9,7 +9,7 @@ build-backend = "scikit_build_core.setuptools.build_meta" [project] name = "cmake-example" version = "0.0.1" -requires-python = ">=3.7" +requires-python = ">=3.8" [tool.scikit-build] cmake.source-dir = "." diff --git a/tests/test_auto.py b/tests/test_auto.py index f4453e869..f9ab81a00 100644 --- a/tests/test_auto.py +++ b/tests/test_auto.py @@ -32,8 +32,8 @@ def test_auto_requires_pkg_version(spec: str, version: Version): def test_auto_requires_with_marker(): reqlist = [ - "scikit_build_core>=0.1; python_version < '3.7'", - "scikit_build_core>=0.2; python_version >= '3.7'", + "scikit_build_core>=0.1; python_version < '3.8'", + "scikit_build_core>=0.2; python_version >= '3.8'", ] assert get_min_requires("scikit-build-core", reqlist) == Version("0.2") diff --git a/tests/test_builder.py b/tests/test_builder.py index 49e02748a..10e4b0e3d 100644 --- a/tests/test_builder.py +++ b/tests/test_builder.py @@ -251,13 +251,13 @@ def test_wheel_tag_with_abi_darwin(monkeypatch): else: assert str(tags) == "cp39-abi3-macosx_10_10_x86_64" - tags = WheelTag.compute_best(["x86_64"], py_api="cp37") + tags = WheelTag.compute_best(["x86_64"], py_api="cp38") if sys.implementation.name != "cpython": assert "macosx_10_10_x86_64" in str(tags) assert "abi3" not in str(tags) - assert "cp37" not in str(tags) + assert "cp38" not in str(tags) else: - assert str(tags) == "cp37-abi3-macosx_10_10_x86_64" + assert str(tags) == "cp38-abi3-macosx_10_10_x86_64" tags = WheelTag.compute_best(["x86_64"], py_api="py3") assert str(tags) == "py3-none-macosx_10_10_x86_64" diff --git a/tests/test_custom_modules.py b/tests/test_custom_modules.py index 84a614d21..386ad1d1e 100644 --- a/tests/test_custom_modules.py +++ b/tests/test_custom_modules.py @@ -23,10 +23,9 @@ def test_ep(isolated): contents = Path(script).read_text(encoding="utf-8") assert contents.startswith(f"#!{pysys}") - if sys.version_info >= (3, 8): - assert ( - isolated.execute( - "from importlib import metadata; print(metadata.version('custom_modules'), end='')" - ) - == "2.3.4" + assert ( + isolated.execute( + "from importlib import metadata; print(metadata.version('custom_modules'), end='')" ) + == "2.3.4" + ) diff --git a/tests/test_dynamic_metadata.py b/tests/test_dynamic_metadata.py index d96d91388..de0f0054e 100644 --- a/tests/test_dynamic_metadata.py +++ b/tests/test_dynamic_metadata.py @@ -3,7 +3,6 @@ import importlib import shutil import subprocess -import sys import textwrap import types import zipfile @@ -239,11 +238,10 @@ def test_pep517_wheel(virtualenv): assert wheel == dist / out virtualenv.install(wheel) - if sys.version_info >= (3, 8): - license = virtualenv.execute( - "from importlib.metadata import metadata; print(metadata('dynamic')['License'])" - ) - assert license == "MIT License" + license = virtualenv.execute( + "from importlib.metadata import metadata; print(metadata('dynamic')['License'])" + ) + assert license == "MIT License" with zipfile.ZipFile(wheel) as zf: file_paths = {Path(n) for n in zf.namelist()} diff --git a/tests/test_file_processor.py b/tests/test_file_processor.py index 1ce36f22d..52647fbc9 100644 --- a/tests/test_file_processor.py +++ b/tests/test_file_processor.py @@ -8,10 +8,6 @@ from scikit_build_core.build._file_processor import each_unignored_file -@pytest.mark.skipif( - sys.version_info < (3, 8) and sys.platform.startswith("win"), - reason="Python 3.8+ required for symlinks on Windows", -) @pytest.mark.skipif( sys.implementation.name == "pypy" and sys.platform.startswith("win"), reason="PyPy on Windows does not support symlinks", diff --git a/tests/test_hatchling.py b/tests/test_hatchling.py index 143177bcb..b0de07cbd 100644 --- a/tests/test_hatchling.py +++ b/tests/test_hatchling.py @@ -1,4 +1,3 @@ -import sys import sysconfig import tarfile import zipfile @@ -30,9 +29,6 @@ def test_hatchling_sdist(isolated) -> None: } -@pytest.mark.skipif( - sys.version_info < (3, 8), reason="Full hatchling support requires Python 3.8+" -) @pytest.mark.network @pytest.mark.compile @pytest.mark.configure diff --git a/tests/test_pyproject_abi3.py b/tests/test_pyproject_abi3.py index a36a228b9..3e029d9a0 100644 --- a/tests/test_pyproject_abi3.py +++ b/tests/test_pyproject_abi3.py @@ -38,9 +38,9 @@ def test_abi3_wheel(tmp_path, monkeypatch, virtualenv, capsys): ) if abi3: - assert "-cp37-abi3-" in out + assert "-cp38-abi3-" in out else: - assert "-cp37-abi3-" not in out + assert "-cp38-abi3-" not in out with zipfile.ZipFile(wheel) as zf: file_names = {Path(n).parts[0] for n in zf.namelist()} diff --git a/tests/test_pyproject_pep517.py b/tests/test_pyproject_pep517.py index 9ed9c117b..5c276f502 100644 --- a/tests/test_pyproject_pep517.py +++ b/tests/test_pyproject_pep517.py @@ -6,12 +6,12 @@ import tarfile import time import zipfile +from importlib.metadata import PathDistribution from pathlib import Path import build.util import pytest -from scikit_build_core._compat.importlib.metadata import PathDistribution from scikit_build_core.build import ( _file_processor, build_sdist, @@ -50,7 +50,7 @@ def test_pep517_sdist(): Metadata-Version: 2.2 Name: CMake.Example Version: 0.0.1 - Requires-Python: >=3.7 + Requires-Python: >=3.8 Provides-Extra: test Requires-Dist: pytest>=6.0; extra == "test" """ @@ -229,7 +229,7 @@ def test_pep517_wheel(virtualenv): assert "Metadata-Version: 2.2" in metadata assert "Name: CMake.Example" in metadata assert "Version: 0.0.1" in metadata - assert "Requires-Python: >=3.7" in metadata + assert "Requires-Python: >=3.8" in metadata assert "Provides-Extra: test" in metadata virtualenv.install(wheel) @@ -282,7 +282,7 @@ def test_pep517_wheel_source_dir(virtualenv): assert "Metadata-Version: 2.2" in metadata assert "Name: CMake.Example" in metadata assert "Version: 0.0.1" in metadata - assert "Requires-Python: >=3.7" in metadata + assert "Requires-Python: >=3.8" in metadata assert "Provides-Extra: test" in metadata assert "Build: 1foo" in wheel_metadata @@ -334,7 +334,7 @@ def test_prepare_metdata_for_build_wheel(): "Metadata-Version": "2.2", "Name": "CMake.Example", "Version": "0.0.1", - "Requires-Python": ">=3.7", + "Requires-Python": ">=3.8", "Provides-Extra": "test", "Requires-Dist": 'pytest>=6.0; extra == "test"', } @@ -356,7 +356,7 @@ def test_prepare_metdata_for_build_wheel_by_hand(tmp_path): "Metadata-Version": "2.2", "Name": "CMake.Example", "Version": "0.0.1", - "Requires-Python": ">=3.7", + "Requires-Python": ">=3.8", "Provides-Extra": "test", "Requires-Dist": 'pytest>=6.0; extra == "test"', } diff --git a/tests/test_pyproject_pep518.py b/tests/test_pyproject_pep518.py index 4b31cd1ac..17bd21b7a 100644 --- a/tests/test_pyproject_pep518.py +++ b/tests/test_pyproject_pep518.py @@ -31,7 +31,7 @@ def test_pep518_sdist(isolated, package_simple_pyproject_ext): Metadata-Version: 2.2 Name: CMake.Example Version: 0.0.1 - Requires-Python: >=3.7 + Requires-Python: >=3.8 Provides-Extra: test Requires-Dist: pytest>=6.0; extra == "test" diff --git a/tests/test_pyproject_pep660.py b/tests/test_pyproject_pep660.py index 500d8d5cb..6ba12e3a4 100644 --- a/tests/test_pyproject_pep660.py +++ b/tests/test_pyproject_pep660.py @@ -97,7 +97,7 @@ def test_pep660_pip_isolated(isolated, isolate, editable_mode: str): "import simplest._module; print(simplest._module.__file__)" ) - if sys.version_info < (3, 8, 7): + if sys.version_info < (3, 8, 7): # noqa: UP036 import distutils.sysconfig # pylint: disable=deprecated-module ext_suffix = distutils.sysconfig.get_config_var("EXT_SUFFIX") diff --git a/tests/test_schema.py b/tests/test_schema.py index a8d3b543b..e68c9decc 100644 --- a/tests/test_schema.py +++ b/tests/test_schema.py @@ -1,6 +1,5 @@ from __future__ import annotations -import sys from pathlib import Path from typing import Any @@ -29,10 +28,7 @@ def test_compare_schemas(): ] -@pytest.mark.parametrize( - "filepath", - [s for s in SCHEMAS if sys.version_info >= (3, 8) or "pep639" not in str(s)], -) +@pytest.mark.parametrize("filepath", SCHEMAS) def test_valid_schemas_files(filepath: Path) -> None: api = pytest.importorskip("validate_pyproject.api") diff --git a/tests/test_settings.py b/tests/test_settings.py index de5cbddea..079f3806c 100644 --- a/tests/test_settings.py +++ b/tests/test_settings.py @@ -1,13 +1,12 @@ import dataclasses import re from pathlib import Path -from typing import Any, Dict, List, Optional, Union +from typing import Any, Dict, List, Literal, Optional, Union import pytest from packaging.version import Version from scikit_build_core._compat.builtins import ExceptionGroup -from scikit_build_core._compat.typing import Literal from scikit_build_core.settings.sources import ( ConfSource, EnvSource, diff --git a/tests/test_settings_overrides.py b/tests/test_settings_overrides.py index 9b8248141..098414a52 100644 --- a/tests/test_settings_overrides.py +++ b/tests/test_settings_overrides.py @@ -852,7 +852,7 @@ def test_skbuild_overrides_matched_version_if_any_dual( [[tool.scikit-build.overrides]] if.scikit-build-version = ">=0.10" if.any.not-real = true - if.any.python-version = ">=3.7" + if.any.python-version = ">=3.8" also-not-real = true """ ) @@ -875,7 +875,7 @@ def test_skbuild_overrides_matched_version_if_any_match( [[tool.scikit-build.overrides]] if.any.scikit-build-version = ">=0.10" if.any.not-real = true - if.python-version = ">=3.7" + if.python-version = ">=3.8" experimental = true """ ) diff --git a/tests/test_setuptools_abi3.py b/tests/test_setuptools_abi3.py index 0bb3b971a..61231778e 100644 --- a/tests/test_setuptools_abi3.py +++ b/tests/test_setuptools_abi3.py @@ -43,7 +43,7 @@ def test_abi3_wheel(tmp_path, monkeypatch, virtualenv): out = build_wheel(str(dist)) (wheel,) = dist.glob("abi3_example-0.0.1-*.whl") assert wheel == dist / out - assert "-cp37-abi3-" in out + assert "-cp38-abi3-" in out assert virtualenv.execute("print('hello')") == "hello" diff --git a/tests/test_setuptools_pep517.py b/tests/test_setuptools_pep517.py index 03d745fed..b76f3e911 100644 --- a/tests/test_setuptools_pep517.py +++ b/tests/test_setuptools_pep517.py @@ -1,3 +1,4 @@ +import importlib.metadata import tarfile import textwrap import zipfile @@ -6,11 +7,10 @@ import pytest from packaging.version import Version -from scikit_build_core._compat.importlib import metadata from scikit_build_core.setuptools.build_meta import build_sdist, build_wheel pytestmark = pytest.mark.setuptools -setuptools_version = Version(metadata.version("setuptools")) +setuptools_version = Version(importlib.metadata.version("setuptools")) @pytest.mark.usefixtures("package_simple_setuptools_ext") @@ -19,7 +19,7 @@ def test_pep517_sdist(): """\ Name: cmake-example Version: 0.0.1 - Requires-Python: >=3.7 + Requires-Python: >=3.8 Provides-Extra: test """ # TODO: why is this missing? @@ -106,7 +106,7 @@ def test_toml_pep517_sdist(): """\ Name: cmake-example Version: 0.0.1 - Requires-Python: >=3.7 + Requires-Python: >=3.8 """ # This was removed in https://github.com/pypa/setuptools/pull/4698 as part of 2.2 support: # Metadata-Version: 2.1 diff --git a/tests/test_shutil.py b/tests/test_shutil.py index 120925ee7..feb7a66c3 100644 --- a/tests/test_shutil.py +++ b/tests/test_shutil.py @@ -3,12 +3,14 @@ import shutil import stat import sys -import tempfile -from pathlib import Path +from typing import TYPE_CHECKING import pytest -from scikit_build_core._shutil import _fix_all_permissions, fix_win_37_all_permissions +from scikit_build_core._shutil import _fix_all_permissions + +if TYPE_CHECKING: + from pathlib import Path def _make_dir_with_ro(tmp_path: Path) -> Path: @@ -46,8 +48,3 @@ def test_broken_all_permissions(make_dir_with_ro: Path) -> None: def test_fix_all_permissions(make_dir_with_ro: Path) -> None: _fix_all_permissions(str(make_dir_with_ro)) shutil.rmtree(make_dir_with_ro) - - -def test_tmpdir(): - with tempfile.TemporaryDirectory() as tmp, fix_win_37_all_permissions(tmp): - _make_dir_with_ro(Path(tmp))