Repository: scikit-build/scikit-build-core
Pull request #986 (2025-02-05 23:38:33)

feat: 0.11+ default to metadata 2.2
This has big performance benefits, and should be well supported now.



Patch:
diff --git a/src/scikit_build_core/build/metadata.py b/src/scikit_build_core/build/metadata.py
index 83b390f..a35dcb6 100644
--- a/src/scikit_build_core/build/metadata.py
+++ b/src/scikit_build_core/build/metadata.py
@@ -104,4 +104,10 @@ def get_standard_metadata(
                 "Packaging 24.2+ required for license normalization. Please update (Python 3.8+ required)"
             )
 
+    # For scikit-build-core >= 0.11, we set METADATA 2.2 as minimum
+    if (
+        settings.minimum_version is None or settings.minimum_version >= Version("0.11")
+    ) and metadata.auto_metadata_version == "2.1":
+        metadata.metadata_version = "2.2"
+
     return metadata
diff --git a/src/scikit_build_core/resources/find_python/FindPython/Support.cmake b/src/scikit_build_core/resources/find_python/FindPython/Support.cmake
index 95f8ba3..daf4261 100644
--- a/src/scikit_build_core/resources/find_python/FindPython/Support.cmake
+++ b/src/scikit_build_core/resources/find_python/FindPython/Support.cmake
@@ -34,7 +34,7 @@ if (NOT DEFINED _${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR)
   message (FATAL_ERROR "FindPython: INTERNAL ERROR")
 endif()
 if (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "3")
-  set(_${_PYTHON_PREFIX}_VERSIONS 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
+  set(_${_PYTHON_PREFIX}_VERSIONS 3.14 3.13 3.12 3.11 3.10 3.9 3.8 3.7 3.6 3.5 3.4 3.3 3.2 3.1 3.0)
 elseif (_${_PYTHON_PREFIX}_REQUIRED_VERSION_MAJOR EQUAL "2")
   set(_${_PYTHON_PREFIX}_VERSIONS 2.7 2.6 2.5 2.4 2.3 2.2 2.1 2.0)
 else()


Test patch:
diff --git a/tests/conftest.py b/tests/conftest.py
index c769b6c..1cfbbd5 100644
--- a/tests/conftest.py
+++ b/tests/conftest.py
@@ -211,10 +211,10 @@ def package_simple_pyproject_ext(
 ) -> PackageInfo:
     package = PackageInfo(
         "simple_pyproject_ext",
-        "72cd37019e113cbabebdceb79bc867f8e1a4fc7323b6a272e6a77d6ea384d3e8",
-        "be15157c8659f258b73eb474616473d60945c4d45693796b55234ec83893263a",
-        "d97cd496aa6c46df2caf5064a7765588c831b8db9d7b46a536026ed951ce724a",
-        "b1182a2aa7a2b81365b3ad7ae1839b20d983ef10b6c3de16b681c23f536ca1b7",
+        "58a92cd71f7750633296b0a44363e661ed83a908985158b83c187043ace6de4a",
+        "83c81c1b9ce2e065ac30d129d48628e01a37248f15035a8427a045a7d8e40c43",
+        "d04620a35f173ce8c94dbfdc48543e7b9f33474d6ee51221eec78b49f38b8766",
+        "d8b64bff613747b421f7c705bd9ce41b95164772a5b96789b27df79d83836148",
     )
     process_package(package, tmp_path, monkeypatch)
     return package
diff --git a/tests/test_prepare_metadata.py b/tests/test_prepare_metadata.py
index b40ea1a..1c6c737 100644
--- a/tests/test_prepare_metadata.py
+++ b/tests/test_prepare_metadata.py
@@ -35,7 +35,7 @@ def test_prepare_metadata_for_build(fp, editable):
     assert (
         textwrap.dedent(
             """\
-        Metadata-Version: 2.1
+        Metadata-Version: 2.2
         Name: simplest
         Version: 0.0.1"""
         )
diff --git a/tests/test_pyproject_pep517.py b/tests/test_pyproject_pep517.py
index 046a676..9ed9c11 100644
--- a/tests/test_pyproject_pep517.py
+++ b/tests/test_pyproject_pep517.py
@@ -47,7 +47,7 @@ def test_pep517_sdist():
     expected_metadata = (
         inspect.cleandoc(
             """
-            Metadata-Version: 2.1
+            Metadata-Version: 2.2
             Name: CMake.Example
             Version: 0.0.1
             Requires-Python: >=3.7
@@ -226,7 +226,7 @@ def test_pep517_wheel(virtualenv):
 
     print(entry_points == ENTRYPOINTS)
     assert 'Requires-Dist: pytest>=6.0; extra == "test"' in metadata
-    assert "Metadata-Version: 2.1" in metadata
+    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
@@ -279,7 +279,7 @@ def test_pep517_wheel_source_dir(virtualenv):
 
     print(entry_points == ENTRYPOINTS)
     assert 'Requires-Dist: pytest>=6.0; extra == "test"' in metadata
-    assert "Metadata-Version: 2.1" in metadata
+    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
@@ -331,7 +331,7 @@ def test_pep517_wheel_time_hash(monkeypatch):
 def test_prepare_metdata_for_build_wheel():
     metadata = build.util.project_wheel_metadata(str(Path.cwd()), isolated=False)
     answer = {
-        "Metadata-Version": "2.1",
+        "Metadata-Version": "2.2",
         "Name": "CMake.Example",
         "Version": "0.0.1",
         "Requires-Python": ">=3.7",
@@ -353,7 +353,7 @@ def test_prepare_metdata_for_build_wheel_by_hand(tmp_path):
     print("Metadata dir:", (mddir / out).resolve())
     metadata = PathDistribution(mddir / out).metadata
     answer = {
-        "Metadata-Version": "2.1",
+        "Metadata-Version": "2.2",
         "Name": "CMake.Example",
         "Version": "0.0.1",
         "Requires-Python": ">=3.7",
diff --git a/tests/test_pyproject_pep518.py b/tests/test_pyproject_pep518.py
index 49794b2..4b31cd1 100644
--- a/tests/test_pyproject_pep518.py
+++ b/tests/test_pyproject_pep518.py
@@ -28,7 +28,7 @@ def compute_uncompressed_hash(inp: Path):
 def test_pep518_sdist(isolated, package_simple_pyproject_ext):
     correct_metadata = textwrap.dedent(
         """\
-        Metadata-Version: 2.1
+        Metadata-Version: 2.2
         Name: CMake.Example
         Version: 0.0.1
         Requires-Python: >=3.7
@@ -74,7 +74,7 @@ def test_pep518_sdist_with_cmake_config(isolated, cleanup_overwrite):
 
     correct_metadata = textwrap.dedent(
         """\
-        Metadata-Version: 2.1
+        Metadata-Version: 2.2
         Name: sdist_config
         Version: 0.1.0
 
diff --git a/tests/test_pyproject_pep660.py b/tests/test_pyproject_pep660.py
index e83d325..500d8d5 100644
--- a/tests/test_pyproject_pep660.py
+++ b/tests/test_pyproject_pep660.py
@@ -45,7 +45,7 @@ def test_pep660_wheel(editable_mode: str):
         assert "_simplest_editable.py" not in file_names
     assert "_simplest_editable.pth" in file_names
 
-    assert "Metadata-Version: 2.1" in metadata
+    assert "Metadata-Version: 2.2" in metadata
     assert "Name: simplest" in metadata
     assert "Version: 0.0.1" in metadata
 
diff --git a/tests/test_wheelfile_utils.py b/tests/test_wheelfile_utils.py
index b38d7b0..995dfe9 100644
--- a/tests/test_wheelfile_utils.py
+++ b/tests/test_wheelfile_utils.py
@@ -24,7 +24,8 @@ def test_wheel_writer_simple(tmp_path, monkeypatch):
                 "name": "something",
                 "version": "1.2.3",
             },
-        }
+        },
+        metadata_version="2.3",
     )
     out_dir = tmp_path / "out"
 
@@ -46,7 +47,7 @@ def test_wheel_writer_simple(tmp_path, monkeypatch):
 
     dist_info = wheel.dist_info_contents()
     assert dist_info == {
-        "METADATA": b"Metadata-Version: 2.1\nName: something\nVersion: 1.2.3\n\n",
+        "METADATA": b"Metadata-Version: 2.3\nName: something\nVersion: 1.2.3\n\n",
         "WHEEL": b"Wheel-Version: 1.0\nGenerator: scikit-build-core 1.2.3\nRoot-Is-Purelib: false\nTag: py3-none-any\n\n",
     }