Skip to content

Commit

Permalink
Support abi3 wheels
Browse files Browse the repository at this point in the history
abi3 is also known as the stable ABI https://docs.python.org/3/c-api/stable.html#stable-abi

abi3 wheels are forwards compatible, meaning an abi3-py39 wheel will
work with Python 3.9, 3.10, 3.11, 3.12, and so on.
  • Loading branch information
tomjakubowski committed Sep 6, 2024
1 parent 1cd330f commit 2a7d6b5
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions pyodide_lock/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,6 +321,9 @@ def _check_wheel_compatible(path: Path, info: InfoSpec) -> None:
raise RuntimeError(f"Wheel filename {path.name} is not valid") from e
python_binary_abi = f"cp{target_python.major}{target_python.minor}"
tags = list(tags)
abi3_compat = {
f"cp{target_python.major}{minor}" for minor in range(2, target_python.minor)
}

tag_match = False
for t in tags:
Expand All @@ -331,6 +334,12 @@ def _check_wheel_compatible(path: Path, info: InfoSpec) -> None:
and t.platform == target_platform
):
tag_match = True
elif (
target_python.major == 3
and t.abi == "abi3"
and t.interpreter in abi3_compat
):
tag_match = True
elif t.abi == "none" and t.platform == "any":
match = re.match(rf"py{target_python.major}(\d*)", t.interpreter)
if match:
Expand Down

0 comments on commit 2a7d6b5

Please sign in to comment.