Skip to content

feat: drop Python 3.8#1281

Draft
henryiii wants to merge 1 commit into
mainfrom
henryiii/feat/drop38
Draft

feat: drop Python 3.8#1281
henryiii wants to merge 1 commit into
mainfrom
henryiii/feat/drop38

Conversation

@henryiii

Copy link
Copy Markdown
Collaborator

Getting ready to drop 3.8.

🤖 Assisted-by: Copilot:Kimi-K2.6

Signed-off-by: Henry Schreiner <henryfs@princeton.edu>
Assisted-by: Copilot:Kimi-K2.6
@LecrisUT LecrisUT self-requested a review April 29, 2026 23:12
@henryiii henryiii requested a review from Copilot May 1, 2026 05:10

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Note

Copilot was unable to run its full agentic suite in this review.

Updates the project to require Python 3.9+ by removing Python 3.8 compatibility code paths, adjusting ABI3 defaults, and updating docs/CI to match the new minimum supported version.

Changes:

  • Bumps requires-python / python_requires constraints across project and test packages to >=3.9.
  • Removes Python 3.8-specific compatibility branches (typing backports, distutils.sysconfig, importlib_resources) and modernizes type annotations to built-in generics.
  • Updates CI matrix, docs, and ABI3 examples/tests to target cp39/SABI 3.9.

Reviewed changes

Copilot reviewed 57 out of 57 changed files in this pull request and generated 4 comments.

Show a summary per file
File Description
tests/test_setuptools_pep517.py Updates expected metadata to Requires-Python: >=3.9.
tests/test_setuptools_abi3.py Updates expected ABI3 wheel tag from cp38 to cp39.
tests/test_settings.py Modernizes typing annotations to built-in generics for 3.9+.
tests/test_pyproject_pep660.py Removes pre-3.8.7 branching and simplifies Windows extension fallback.
tests/test_pyproject_pep518.py Updates expected metadata to Requires-Python: >=3.9.
tests/test_pyproject_pep517.py Updates expected metadata to Requires-Python: >=3.9.
tests/test_pyproject_abi3.py Updates expected ABI3 wheel tag assertions to cp39.
tests/test_module_dir.py Changes Generator import strategy for typing.
tests/test_json_schema.py Switches typing inputs in schema conversion tests to built-in generics.
tests/test_editable_unit.py Removes version gating for resource-file imports in editable tests.
tests/test_editable.py Removes Python <3.9 skip for importlib.resources.files.
tests/packages/toml_setuptools_ext/pyproject.toml Bumps requires-python to >=3.9.
tests/packages/simple_setuptools_ext/setup.py Bumps python_requires to >=3.9.
tests/packages/simple_pyproject_source_dir/pyproject.toml Bumps requires-python to >=3.9.
tests/packages/simple_pyproject_script_with_flags/pyproject.toml Bumps requires-python to >=3.9.
tests/packages/simple_pyproject_ext/pyproject.toml Bumps requires-python to >=3.9.
tests/packages/navigate_editable/python/shared_pkg/py_module.py Drops importlib_resources fallback and uses stdlib importlib.resources.
tests/packages/navigate_editable/pyproject.toml Removes conditional importlib-resources dependency for <3.9.
tests/packages/mixed_setuptools/setup.cfg Bumps python_requires to >=3.9.
tests/packages/fortran_example/pyproject.toml Bumps requires-python to >=3.9.
tests/packages/filepath_pure/pyproject.toml Bumps requires-python to >=3.9.
tests/packages/abi3_setuptools_ext/setup.cfg Bumps python_requires and updates limited API to cp39.
tests/packages/abi3_setuptools_ext/CMakeLists.txt Updates USE_SABI from 3.8 to 3.9.
tests/packages/abi3_pyproject_ext/pyproject.toml Updates ABI3 config tag from cp38 to cp39.
tests/packages/abi3_pyproject_ext/CMakeLists.txt Updates SABI version check and failure message for 3.9.
tests/conftest.py Simplifies sdist hash selection by removing 3.8/3.9 branching.
src/scikit_build_core/settings/skbuild_model.py Replaces typing.List/Dict with built-in generics; updates cp38 references.
src/scikit_build_core/file_api/reply.py Updates typing to built-in generics and type[T] annotations.
src/scikit_build_core/file_api/model/toolchains.py Switches model field types to built-in generics.
src/scikit_build_core/file_api/model/index.py Switches model field types to built-in generics.
src/scikit_build_core/file_api/model/directory.py Switches model field types to built-in generics.
src/scikit_build_core/file_api/model/common.py Updates __dir__ return type to built-in generic.
src/scikit_build_core/file_api/model/codemodel.py Switches model field types to built-in generics.
src/scikit_build_core/file_api/model/cmakefiles.py Switches model field types to built-in generics.
src/scikit_build_core/file_api/model/cache.py Switches model field types to built-in generics.
src/scikit_build_core/file_api/_cattrs_converter.py Updates typing to built-in generics and type[T] annotations.
src/scikit_build_core/cmake.py Refactors context manager usage and updates comment re: missing_ok.
src/scikit_build_core/builder/sysconfig.py Uses Python 3.9+ APIs (removeprefix, sysconfig only).
src/scikit_build_core/build/_file_processor.py Removes 3.9 workaround and uses Path.is_relative_to directly.
src/scikit_build_core/_logging.py Uses functools.cache (3.9+) in place of lru_cache(maxsize=None).
src/scikit_build_core/_compat/typing.py Drops pre-3.9 conditional imports for Annotated/get_args/get_origin.
src/scikit_build_core/_compat/importlib/resources.py Drops importlib_resources fallback for <3.9.
src/scikit_build_core/_compat/importlib/metadata.py Uses built-in generics for EntryPoints alias.
pyproject.toml Bumps min Python to 3.9, updates deps/extras, and updates pylint py-version.
docs/reference/configs.md Updates docs to reference cp39 for stable ABI configuration.
docs/guide/cmakelists.md Updates example wheel.py-api from cp38 to cp39.
docs/examples/getting_started/nanobind/CMakeLists.txt Updates minimum Python in CMake find_package to 3.9.
docs/examples/getting_started/abi3/pyproject.toml Updates example wheel.py-api from cp38 to cp39.
docs/examples/getting_started/abi3/CMakeLists.txt Updates USE_SABI from 3.8 to 3.9.
docs/examples/downstream/pybind11_example/pyproject.toml Updates example requires-python and classifiers to drop 3.8.
docs/examples/downstream/pybind11_example/README.md Updates stated minimum Python version to 3.9+.
docs/examples/downstream/nanobind_example/pyproject.toml Updates example requires-python to >=3.9.
docs/examples/downstream/nanobind_example/CMakeLists.txt Updates minimum Python in CMake find_package to 3.9.
docs/configuration/index.md Updates ABI3 example to cp39 and edits known limitations text.
README.md Updates stated minimum supported Python version to 3.9.
.github/workflows/ci.yml Removes 3.8 from CI, updates PyPy baseline, and shifts job entries to 3.9+.
.github/CONTRIBUTING.md Updates contributor examples to require Python 3.9+.
Comments suppressed due to low confidence (1)

tests/test_module_dir.py:1

  • Importing Generator only under TYPE_CHECKING will break at runtime if it is referenced in annotations in this module (since annotations are evaluated eagerly without from __future__ import annotations). Either import Generator unconditionally (preferably from collections.abc) or add from __future__ import annotations and keep the TYPE_CHECKING import.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +113 to 117
with (
contextlib.suppress(FileNotFoundError),
skbuild_info.open("r", encoding="utf-8") as f,
):
info = json.load(f)

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This parenthesized multi-context-manager with (...) syntax is only supported starting in Python 3.10. Since this PR sets the minimum supported version to 3.9, this will be a syntax error on Python 3.9. Use a Python 3.9-compatible with statement (single line, backslash continuation, or nested with) instead.

Suggested change
with (
contextlib.suppress(FileNotFoundError),
skbuild_info.open("r", encoding="utf-8") as f,
):
info = json.load(f)
with contextlib.suppress(FileNotFoundError):
with skbuild_info.open("r", encoding="utf-8") as f:
info = json.load(f)

Copilot uses AI. Check for mistakes.
type: str
paths: Paths
sources = List[Source]
sources = list[Source]

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This line assigns list[Source] to a class attribute instead of declaring a dataclass field. If sources is intended to be part of the CMake codemodel Target schema, it should be a proper type annotation (e.g., sources: list[Source] = ... or sources: list[Source]) so dataclasses will treat it as a field.

Suggested change
sources = list[Source]
sources: list[Source] = dataclasses.field(default_factory=list)

Copilot uses AI. Check for mistakes.

input_dict: Dict[str, Type[Any]] = {}
exceptions: List[Exception] = []
input_dict: dict[str, type[Any]] = {}

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

input_dict appears to be used as the kwargs dict passed into target(**input_dict), so its values are instances (converted field values), not types. The annotation dict[str, type[Any]] is misleading and will cause type-checker noise; it should be dict[str, Any] (or more specific per-field typing if desired).

Suggested change
input_dict: dict[str, type[Any]] = {}
input_dict: InputDict = {}

Copilot uses AI. Check for mistakes.
Comment on lines +572 to +573
Currently experimentally supported except on Python 3.9 (3.10, 3.11, 3.12, and
3.13 work).

Copilot AI May 1, 2026

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that Python 3.9 is the minimum supported version, calling out that a feature is 'not properly supported' specifically on 3.9 is high impact but lacks actionable guidance. Consider adding a brief explanation/workaround (or a link to an issue) and clarifying whether this limitation still applies after dropping 3.8.

Copilot uses AI. Check for mistakes.
@LecrisUT

LecrisUT commented May 4, 2026

Copy link
Copy Markdown
Collaborator

Let me know when you need the additional pair of eyes on this. I noticed some errors at first glance (not caught by copilot), hence why added myself in the reviewer

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants