Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support abi3 wheels #32

Merged
merged 2 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,19 @@
# Changelog

All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## Unreleased

## [0.1.0a8] - 2024-09-17

### Added

- Support stable ABI (`abi3`) wheels in lock file.
[#32](https://github.com/pyodide/pyodide-lock/pull/32)

## [0.1.0a7] - 2024-08-08

### Added
Expand Down Expand Up @@ -57,10 +65,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

### Added

- Add `check_wheel_filenames` method to `PyodideLockSpec` that checks that the
package name in version are consistent between the wheel filename and the
corresponding pyodide-lock.json fields
[#11](https://github.com/pyodide/pyodide-lock/pull/11)
- Add `check_wheel_filenames` method to `PyodideLockSpec` that checks that the
package name in version are consistent between the wheel filename and the
corresponding pyodide-lock.json fields
[#11](https://github.com/pyodide/pyodide-lock/pull/11)

## [0.1.0a1] - 2023-06-23

Expand Down
5 changes: 5 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(target_python.minor + 1)
}

tag_match = False
for t in tags:
Expand All @@ -331,6 +334,8 @@ def _check_wheel_compatible(path: Path, info: InfoSpec) -> None:
and t.platform == target_platform
):
tag_match = True
elif 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
18 changes: 18 additions & 0 deletions tests/test_wheel.py
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,17 @@ def test_wheel_compatibility_checking(example_lock_spec):
Path(f"test_wheel-1.0.0-{cpython_tag}-{cpython_tag}-{emscripten_tag}.whl"),
example_lock_spec.info,
)
# abi3, current version
_check_wheel_compatible(
Path(f"test_wheel-1.0.0-{cpython_tag}-abi3-{emscripten_tag}.whl"),
example_lock_spec.info,
)
# abi3, past version
past_cpython_tag = f"cp{target_python.major}{target_python.minor-1}"
_check_wheel_compatible(
Path(f"test_wheel-1.0.0-{past_cpython_tag}-abi3-{emscripten_tag}.whl"),
example_lock_spec.info,
)
with pytest.raises(RuntimeError):
# cpython emscripten incorrect version
_check_wheel_compatible(
Expand All @@ -177,6 +188,13 @@ def test_wheel_compatibility_checking(example_lock_spec):
),
example_lock_spec.info,
)
with pytest.raises(RuntimeError):
# abi3, interpreter version too large
future_cpython_tag = f"cp{target_python.major}{target_python.minor+1}"
_check_wheel_compatible(
Path(f"test_wheel-1.0.0-{future_cpython_tag}-abi3-{emscripten_tag}.whl"),
example_lock_spec.info,
)
with pytest.raises(RuntimeError):
# a linux wheel
_check_wheel_compatible(
Expand Down
Loading