This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new fc9d6724 chore(python): test with numpy and pyarrow when testing
(some) wheels (#1030)
fc9d6724 is described below
commit fc9d67247a288f07b22a13e8b2c49d2bf59ce4dc
Author: Edgar Ramírez Mondragón
<[email protected]>
AuthorDate: Wed Nov 25 08:58:31 2026 -0600
chore(python): test with numpy and pyarrow when testing (some) wheels
(#1030)
## Links
-
https://packaging.python.org/en/latest/specifications/dependency-groups/
-
https://packaging.python.org/en/latest/specifications/pyproject-toml/#pyproject-toml-license
- https://pip.pypa.io/en/stable/cli/pip_install/#cmdoption-group
---
- **chore(python): use PEP 735 dependency groups**
- **test(python): xfail test for sparse union slices against pyarrow <
25**
- **chore(python): split dependency groups**
- ~**fix(python): explicitly mark package as free-threading compatible
with Cython `freethreading_compatible=True` directive**~
---------
Signed-off-by: Edgar Ramírez Mondragón <[email protected]>
---
.github/workflows/build-and-test-device.yaml | 3 ++-
.github/workflows/python-wheels.yaml | 7 +++++--
.github/workflows/python.yaml | 5 +++--
dev/release/verify-release-candidate.sh | 4 ++--
python/README.ipynb | 3 ++-
python/README.md | 3 ++-
python/pyproject.toml | 19 ++++++++++++++-----
python/tests/test_iterator.py | 10 +++++++++-
8 files changed, 39 insertions(+), 15 deletions(-)
diff --git a/.github/workflows/build-and-test-device.yaml
b/.github/workflows/build-and-test-device.yaml
index f66859de..59f6d1a4 100644
--- a/.github/workflows/build-and-test-device.yaml
+++ b/.github/workflows/build-and-test-device.yaml
@@ -162,7 +162,8 @@ jobs:
NANOARROW_PYTHON_CUDA_HOME: "/usr/local/cuda"
run: |
cd python
- python3 -m pip install ".[test]" -vv
+ python3 -m pip install -U pip
+ python3 -m pip install . --group test -vv
python3 -m pip install cupy-cuda12x
- name: Test Python bindings with CUDA
diff --git a/.github/workflows/python-wheels.yaml
b/.github/workflows/python-wheels.yaml
index 59c19ae6..ae01c816 100644
--- a/.github/workflows/python-wheels.yaml
+++ b/.github/workflows/python-wheels.yaml
@@ -92,6 +92,7 @@ jobs:
name: ${{ matrix.config.label }}
runs-on: ${{ matrix.config.os }}
strategy:
+ fail-fast: false
matrix:
config:
- {os: "ubuntu-latest", label: "pyodide", platform: "pyodide", arch:
"auto"}
@@ -139,7 +140,7 @@ jobs:
arch: x86
- name: Install cibuildwheel
- run: python -m pip install cibuildwheel==4.3.1
+ run: python -m pip install cibuildwheel==4.3.5
- name: Set nanoarrow Python dev version
if: github.ref == 'refs/heads/main'
@@ -153,7 +154,9 @@ jobs:
# The PKG_CONFIG_PATH is set by setup-python; however, its presence
causes
# an issue for pyodide which picks up the wrong Python headers if
this is set.
PKG_CONFIG_PATH: ""
- CIBW_TEST_REQUIRES: pytest
+ CIBW_TEST_GROUPS: test
+ CIBW_TEST_GROUPS_PYODIDE: test-base
+ CIBW_TEST_GROUPS_WINDOWS: test-base
CIBW_TEST_COMMAND: pytest {package}/tests -vv
CIBW_PLATFORM: ${{ matrix.config.platform }}
CIBW_ARCHS: ${{ matrix.config.arch }}
diff --git a/.github/workflows/python.yaml b/.github/workflows/python.yaml
index 7038a5d6..6a1ada15 100644
--- a/.github/workflows/python.yaml
+++ b/.github/workflows/python.yaml
@@ -59,11 +59,12 @@ jobs:
- name: Install nanoarrow
run: |
pushd python
+ pip install -U pip
if [[ "${{ matrix.python-version }}" == "3.13" ]]; then
pip install -r requirements-stubs.txt 'meson>=1.3.0' meson-python
- pip install --no-build-isolation '.[test]'
+ pip install --no-build-isolation . --group test
else
- pip install '.[test]'
+ pip install . --group test
fi
popd
pip list
diff --git a/dev/release/verify-release-candidate.sh
b/dev/release/verify-release-candidate.sh
index 14cecfd5..7ea929e6 100755
--- a/dev/release/verify-release-candidate.sh
+++ b/dev/release/verify-release-candidate.sh
@@ -324,7 +324,7 @@ test_python() {
activate_or_create_venv
show_info "Installing build utilities"
- python -m pip install --upgrade build
+ python -m pip install --upgrade build pip
pushd "${NANOARROW_SOURCE_DIR}/python"
@@ -343,7 +343,7 @@ test_python() {
fi
show_info "Installing Python package"
- python -m pip install --force-reinstall "${PYTHON_WHEEL_PATH}[verify]"
+ python -m pip install --force-reinstall "${PYTHON_WHEEL_PATH}" --group verify
show_info "Testing wheel"
python -m pytest -vv
diff --git a/python/README.ipynb b/python/README.ipynb
index 014f5bc8..ea14e8b9 100644
--- a/python/README.ipynb
+++ b/python/README.ipynb
@@ -679,6 +679,7 @@
"cd arrow-nanoarrow/python\n",
"# Build dependencies:\n",
"# pip install meson meson-python cython\n",
+ "pip install -U pip\n",
"pip install -e . --no-build-isolation\n",
"```\n",
"\n",
@@ -686,7 +687,7 @@
"\n",
"```shell\n",
"# Install dependencies\n",
- "pip install -e \".[test]\"\n",
+ "pip install -e . --group test\n",
"\n",
"# Run tests\n",
"pytest -vvx\n",
diff --git a/python/README.md b/python/README.md
index f16fa1ac..b3ed150b 100644
--- a/python/README.md
+++ b/python/README.md
@@ -431,7 +431,8 @@ Tests use [pytest](https://docs.pytest.org/):
```shell
# Install dependencies
-pip install -e ".[test]"
+pip install -U pip
+pip install -e . --group test
# Run tests
pytest -vvx
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 1976e19d..603c82f1 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -23,15 +23,24 @@ readme = "README.md"
description = "Python bindings to the nanoarrow C library"
authors = [{name = "Apache Arrow Developers", email = "[email protected]"}]
maintainers = [{name = "Apache Arrow Developers", email =
"[email protected]"}]
-license = {text = "Apache-2.0"}
+license = "Apache-2.0"
requires-python = ">=3.9"
-[project.optional-dependencies]
-test = ["pyarrow", "python-dateutil", "pytest", "numpy"]
-verify = ["python-dateutil", "pytest", "numpy"]
+[dependency-groups]
+test-base = ["python-dateutil", "pytest"]
+test = [
+ { include-group = "test-base" },
+ "numpy",
+ "pyarrow",
+]
+verify = [
+ { include-group = "test-base" },
+ "numpy",
+]
[project.urls]
Homepage = "https://arrow.apache.org"
+Documentation = "https://arrow.apache.org/nanoarrow"
Repository = "https://github.com/apache/arrow-nanoarrow"
Issues = "https://github.com/apache/arrow-nanoarrow/issues"
Changelog = "https://github.com/apache/arrow-nanoarrow/blob/main/CHANGELOG.md"
@@ -39,7 +48,7 @@ Changelog =
"https://github.com/apache/arrow-nanoarrow/blob/main/CHANGELOG.md"
[build-system]
requires = [
"meson>=1.3.0",
- "meson-python",
+ "meson-python>=0.18.0",
"Cython"
]
build-backend = "mesonpy"
diff --git a/python/tests/test_iterator.py b/python/tests/test_iterator.py
index bc4e0cfb..74154b06 100644
--- a/python/tests/test_iterator.py
+++ b/python/tests/test_iterator.py
@@ -667,9 +667,17 @@ def test_iterator_sparse_union():
@pytest.mark.parametrize("mode", ["sparse", "dense"])
@pytest.mark.parametrize("type_codes", [[0, 1], [3, 7]])
@pytest.mark.parametrize("child_offset", [0, 2])
-def test_iterator_union_slices(mode, type_codes, child_offset):
+def test_iterator_union_slices(request, mode, type_codes, child_offset):
pa = pytest.importorskip("pyarrow")
+ request.applymarker(
+ pytest.mark.xfail(
+ mode == "sparse" and int(pa.__version__.split(".")[0]) < 25,
+ reason="pyarrow < 25 returns wrong values for sliced sparse
unions",
+ strict=True,
+ )
+ )
+
type_ids = pa.array([type_codes[i] for i in [0, 0, 1, 1, 0, 1]], pa.int8())
if mode == "sparse":
children = [