From 8d076b5b08f4145952d43eab590161d95771b0af Mon Sep 17 00:00:00 2001 From: Anurag Singh Date: Wed, 2 Dec 2026 14:58:37 +0530 Subject: [PATCH] CI: test cp315 wheels without the dev group The locked dev group has no CPython 3.15 wheels, so cibuildwheel skipped the cp315 tests entirely. Move the test setup into pyproject.toml and override it for cp315 with a small zstd Avro roundtrip that only needs the wheel and its runtime dependencies. --- .github/workflows/pypi-build-artifacts.yml | 7 ---- .github/workflows/python-ci.yml | 10 ++--- dev/cibw_smoke_test.py | 48 ++++++++++++++++++++++ pyproject.toml | 11 +++++ 4 files changed, 64 insertions(+), 12 deletions(-) create mode 100644 dev/cibw_smoke_test.py diff --git a/.github/workflows/pypi-build-artifacts.yml b/.github/workflows/pypi-build-artifacts.yml index 23200b0d93..6cb973929a 100644 --- a/.github/workflows/pypi-build-artifacts.yml +++ b/.github/workflows/pypi-build-artifacts.yml @@ -81,15 +81,8 @@ jobs: # Ignore 32 bit architectures CIBW_ARCHS: "auto64" CIBW_PROJECT_REQUIRES_PYTHON: ">=3.11,<3.16" - # Keep these in sync with Python CI job `cibw-dev-env-smoke-test` - # in .github/workflows/python-ci.yml to catch import-time regressions early. - CIBW_BEFORE_TEST: "uv sync --directory {project} --only-group dev --no-install-project" - CIBW_TEST_COMMAND: "uv run --directory {project} pytest tests/avro/test_decoder.py" # Skip free-threaded (PEP 703) builds until we evaluate decoder_fast support CIBW_SKIP: "cp3*t-*" - # The locked dev group (pyarrow 25.0.1, numpy 2.4.6) has no CPython 3.15 wheels yet: - # build the cp315 wheels, and test them once it does - CIBW_TEST_SKIP: "cp315-*" - name: Add source distribution diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 1860083f6e..8159092b4b 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -110,12 +110,12 @@ jobs: # Catch import-time regressions (e.g., global conftest optional deps) # in the same dev-only environment used by cibuildwheel wheel tests. # Keep this in sync with wheel build test setup in - # .github/workflows/pypi-build-artifacts.yml: - # CIBW_BEFORE_TEST: uv sync --directory {project} --only-group dev --no-install-project - # CIBW_TEST_COMMAND: uv run --directory {project} pytest tests/avro/test_decoder.py - - name: Mirror wheel CIBW_BEFORE_TEST + # pyproject.toml: + # before-test = "uv sync --directory {project} --only-group dev --no-install-project" + # test-command = "uv run --directory {project} pytest tests/avro/test_decoder.py" + - name: Mirror wheel before-test run: uv sync --directory . --only-group dev --no-install-project - - name: Mirror wheel CIBW_TEST_COMMAND + - name: Mirror wheel test-command run: uv run --directory . pytest tests/avro/test_decoder.py python-ci-required: diff --git a/dev/cibw_smoke_test.py b/dev/cibw_smoke_test.py new file mode 100644 index 0000000000..2a6cf39485 --- /dev/null +++ b/dev/cibw_smoke_test.py @@ -0,0 +1,48 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. +"""Smoke test for the wheel test environment, without the dev dependency group. + +Run from a cibuildwheel test environment for CPython versions that the locked +dev group cannot install on yet. +""" + +import tempfile +from pathlib import Path + +import pyiceberg.avro.decoder_fast # noqa: F401 +from pyiceberg.avro.file import AvroFile, AvroOutputFile +from pyiceberg.io.fsspec import FsspecFileIO +from pyiceberg.schema import Schema +from pyiceberg.typedef import Record +from pyiceberg.types import LongType, NestedField, StringType + +schema = Schema( + NestedField(field_id=1, name="id", field_type=LongType(), required=True), + NestedField(field_id=2, name="data", field_type=StringType(), required=True), + schema_id=1, +) +records = [Record(index, f"value-{index}") for index in range(16)] + +with tempfile.TemporaryDirectory() as tmpdir: + avro_file = str(Path(tmpdir) / "zstd.avro") + io = FsspecFileIO({}) + + with AvroOutputFile[Record](io.new_output(avro_file), schema, "zstd", metadata={"avro.codec": "zstd"}) as output: + output.write_block(records) + + with AvroFile[Record](io.new_input(avro_file), schema, {-1: Record}) as reader: + assert list(reader) == records diff --git a/pyproject.toml b/pyproject.toml index 300a3895f0..01f38d04a9 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -152,6 +152,17 @@ default-groups = [ "dev", ] +[tool.cibuildwheel] +before-test = "uv sync --directory {project} --only-group dev --no-install-project" +test-command = "uv run --directory {project} pytest tests/avro/test_decoder.py" + +# The locked dev group (pyarrow 25.0.1, numpy 2.4.6) has no CPython 3.15 wheels +# yet, so test the cp315 wheels against the wheel and its runtime dependencies. +[[tool.cibuildwheel.overrides]] +select = "cp315-*" +before-test = "" +test-command = "python {project}/dev/cibw_smoke_test.py" + [build-system] requires = ["setuptools>=83.0.0", "wheel", "Cython>=3.0.0"] build-backend = "setuptools.build_meta"