Repository: scikit-build/scikit-build-core
Pull request #655 (2024-02-28 00:30:09)

fix: Ensure wheel.platlib being false sets <abi>-<platform> as "none-any"
* [x] Add regression test or update existing one

jcfr: This will be rebased once #657 is integrated :rocket: 
codecov[bot]: ## [Codecov](https://app.codecov.io/gh/scikit-build/scikit-build-core/pull/655?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build) Report
Attention: Patch coverage is `66.66667%` with `2 lines` in your changes are missing coverage. Please review.
> Project coverage is 86.24%. Comparing base [(`18061b7`)](https://app.codecov.io/gh/scikit-build/scikit-build-core/commit/18061b78f704215b151ff4132bf6ace801163717?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build) to head [(`8d50bf1`)](https://app.codecov.io/gh/scikit-build/scikit-build-core/pull/655?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build).

| [Files](https://app.codecov.io/gh/scikit-build/scikit-build-core/pull/655?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build) | Patch % | Lines |
|---|---|---|
| [src/scikit\_build\_core/builder/wheel\_tag.py](https://app.codecov.io/gh/scikit-build/scikit-build-core/pull/655?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build#diff-c3JjL3NjaWtpdF9idWlsZF9jb3JlL2J1aWxkZXIvd2hlZWxfdGFnLnB5) | 66.66% | [2 Missing :warning: ](https://app.codecov.io/gh/scikit-build/scikit-build-core/pull/655?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build) |

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main     #655      +/-   ##
==========================================
- Coverage   86.28%   86.24%   -0.04%     
==========================================
  Files          63       63              
  Lines        3230     3236       +6     
==========================================
+ Hits         2787     2791       +4     
- Misses        443      445       +2     
```



</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/scikit-build/scikit-build-core/pull/655?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=scikit-build).

jcfr: @henryiii This is pending review & approval :pray:

Once this is integrated, what do you think of releasing `0.8.2` ?

Patch:
diff --git a/src/scikit_build_core/build/wheel.py b/src/scikit_build_core/build/wheel.py
index 6d467c2..974d71c 100644
--- a/src/scikit_build_core/build/wheel.py
+++ b/src/scikit_build_core/build/wheel.py
@@ -173,6 +173,7 @@ def _build_wheel_impl(
             archs_to_tags(get_archs(os.environ)),
             settings.wheel.py_api,
             expand_macos=settings.wheel.expand_macos_universal_tags,
+            root_is_purelib=targetlib == "purelib",
             build_tag=settings.wheel.build_tag,
         )
 
diff --git a/src/scikit_build_core/builder/wheel_tag.py b/src/scikit_build_core/builder/wheel_tag.py
index 3e6a006..09c5506 100644
--- a/src/scikit_build_core/builder/wheel_tag.py
+++ b/src/scikit_build_core/builder/wheel_tag.py
@@ -37,6 +37,7 @@ class WheelTag:
         py_api: str = "",
         *,
         expand_macos: bool = False,
+        root_is_purelib: bool = False,
         build_tag: str = "",
     ) -> Self:
         if build_tag:
@@ -77,12 +78,20 @@ class WheelTag:
             # Remove duplicates (e.g. universal2 if macOS > 11.0 and expanded)
             plats = list(dict.fromkeys(plats))
 
+        if root_is_purelib:
+            plats = ["any"]
+            abi = "none"
+
         if py_api:
             pyvers_new = py_api.split(".")
             if all(x.startswith("cp3") and x[3:].isdecimal() for x in pyvers_new):
                 if len(pyvers_new) != 1:
                     msg = "Unexpected py-api, must be a single cp version (e.g. cp39), not {py_api}"
                     raise AssertionError(msg)
+                if root_is_purelib:
+                    msg = f"Unexpected py-api, since platlib is set to false, must be Pythonless (e.g. py2.py3), not {py_api}"
+                    raise AssertionError(msg)
+
                 minor = int(pyvers_new[0][3:])
                 if (
                     sys.implementation.name == "cpython"


Test patch:
diff --git a/tests/test_pyproject_purelib.py b/tests/test_pyproject_purelib.py
index 5c1dc53..e726215 100644
--- a/tests/test_pyproject_purelib.py
+++ b/tests/test_pyproject_purelib.py
@@ -11,7 +11,7 @@ from scikit_build_core.build import build_wheel
 def test_pep517_wheel(virtualenv):
     dist = Path("dist")
     out = build_wheel("dist", {})
-    (wheel,) = dist.glob("purelib_example-0.0.1-*.whl")
+    (wheel,) = dist.glob("purelib_example-0.0.1-*-none-any.whl")
     assert wheel == dist / out
 
     virtualenv.install(wheel)