mirror of
https://github.com/lancedb/lancedb.git
synced 2026-08-18 12:08:35 +00:00
16e1967efc
## Summary - align the PyO3 runtime and build ABI floor with the declared Python 3.10 minimum - add a regression test that keeps both ABI features synchronized with `requires-python` ## Root cause The Python 3.10 support-floor update originally changed PyO3 to `abi3-py310`, but a later dependency update reverted both PyO3 features to `abi3-py39`. Published Windows wheels were consequently tagged `cp39-abi3` while importing `PyCMethod_New`, a stable-ABI procedure absent from CPython 3.9.0 and 3.9.1. Windows reports that mismatch as “The specified procedure could not be found” while loading `_lancedb`. Restoring `abi3-py310` makes the wheel tag and native imports agree with the package metadata and prevents future wheels from advertising unsupported Python 3.9 compatibility. ## Validation - `uv run --extra tests pytest python/tests/test_package_metadata.py -q` - `uv run --extra tests --extra dev ruff format --check .` - `uv run --extra tests --extra dev ruff check .` - `cargo fmt --all` - `cargo check --quiet -p lancedb-python` - `uvx --from maturin==1.12.4 maturin build --profile ci` (built `lancedb-0.37.1b0-cp310-abi3-manylinux_2_34_x86_64.whl`) Fixes #2051 <!-- lance-gatekeeper-fix:v1 agent=d66c984498190d2207d1c5126cba5047 generation=1 --> --------- Co-authored-by: Gatefixer <313497061+lancedb-gatefixer[bot]@users.noreply.github.com>
43 lines
1.4 KiB
Python
43 lines
1.4 KiB
Python
# SPDX-License-Identifier: Apache-2.0
|
|
# SPDX-FileCopyrightText: Copyright The LanceDB Authors
|
|
|
|
import importlib
|
|
import re
|
|
import sys
|
|
from pathlib import Path
|
|
|
|
import pytest
|
|
|
|
|
|
def test_pyo3_abi_matches_minimum_supported_python():
|
|
project_dir = Path(__file__).parents[2]
|
|
pyproject = (project_dir / "pyproject.toml").read_text()
|
|
cargo_manifest = (project_dir / "Cargo.toml").read_text()
|
|
|
|
minimum_python = re.search(
|
|
r'^requires-python\s*=\s*">=(\d+)\.(\d+)"$', pyproject, re.MULTILINE
|
|
)
|
|
assert minimum_python is not None
|
|
|
|
major, minor = minimum_python.groups()
|
|
expected_abi = f"abi3-py{major}{minor}"
|
|
configured_abis = re.findall(r'"(abi3-py\d+)"', cargo_manifest)
|
|
|
|
assert configured_abis == [expected_abi, expected_abi], (
|
|
"the pyo3 runtime and build ABI features must both match requires-python"
|
|
)
|
|
|
|
|
|
@pytest.mark.skipif(sys.platform != "win32", reason="Windows wheel regression test")
|
|
def test_windows_wheel_tag_and_native_import():
|
|
project_dir = Path(__file__).parents[2]
|
|
wheels = list((project_dir.parent / "target" / "wheels").glob("lancedb-*.whl"))
|
|
if not wheels:
|
|
pytest.skip("no wheel artifact is available in this development environment")
|
|
|
|
assert len(wheels) == 1
|
|
assert wheels[0].name.endswith("-cp310-abi3-win_amd64.whl")
|
|
|
|
native_module = importlib.import_module("lancedb._lancedb")
|
|
assert Path(native_module.__file__).suffix == ".pyd"
|