This is an automated email from the ASF dual-hosted git repository.
raulcd pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 222fac73a0 GH-48983: [Packaging][Python] Build wheel from sdist using
build and add check to validate LICENSE.txt and NOTICE.txt are part of the
wheel contents (#48988)
222fac73a0 is described below
commit 222fac73a0425e6c273ba8e0b5a427091ee56245
Author: Raúl Cumplido <[email protected]>
AuthorDate: Thu Jan 29 15:10:59 2026 +0100
GH-48983: [Packaging][Python] Build wheel from sdist using build and add
check to validate LICENSE.txt and NOTICE.txt are part of the wheel contents
(#48988)
### Rationale for this change
Currently the files are missing from the published wheels.
### What changes are included in this PR?
- Ensure the license and notice files are part of the wheels
- Use build frontend to build wheels
- Build wheel from sdist
### Are these changes tested?
Yes, via archery.
I've validated all wheels will fail with the new check if LICENSE.txt or
NOTICE.txt are missing:
```
AssertionError: LICENSE.txt is missing from the wheel.
```
### Are there any user-facing changes?
No
* GitHub Issue: #48983
Lead-authored-by: Raúl Cumplido <[email protected]>
Co-authored-by: Antoine Pitrou <[email protected]>
Co-authored-by: Rok Mihevc <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
---
.env | 4 ++--
ci/scripts/python_wheel_macos_build.sh | 2 +-
ci/scripts/python_wheel_validate_contents.py | 4 ++++
ci/scripts/python_wheel_windows_build.bat | 2 +-
ci/scripts/python_wheel_xlinux_build.sh | 2 +-
python/requirements-wheel-build.txt | 1 +
6 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/.env b/.env
index 2440e9b025..14ed93bfe9 100644
--- a/.env
+++ b/.env
@@ -99,8 +99,8 @@ VCPKG="4334d8b4c8916018600212ab4dd4bbdc343065d1" #
2025.09.17 Release
# ci/docker/python-*-windows-*.dockerfile or the vcpkg config.
# This is a workaround for our CI problem that "archery docker build" doesn't
# use pulled built images in dev/tasks/python-wheels/github.windows.yml.
-PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2026-01-22
-PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION=2026-01-22
+PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2026-01-27
+PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION=2026-01-27
# Use conanio/${CONAN_BASE}:{CONAN_VERSION} for "docker compose run --rm
conan".
# See https://github.com/conan-io/conan-docker-tools#readme and
diff --git a/ci/scripts/python_wheel_macos_build.sh
b/ci/scripts/python_wheel_macos_build.sh
index bd61154430..2234fc6f31 100755
--- a/ci/scripts/python_wheel_macos_build.sh
+++ b/ci/scripts/python_wheel_macos_build.sh
@@ -177,7 +177,7 @@ export CMAKE_PREFIX_PATH=${build_dir}/install
export SETUPTOOLS_SCM_PRETEND_VERSION=${PYARROW_VERSION}
pushd ${source_dir}/python
-python setup.py bdist_wheel
+python -m build --sdist --wheel . --no-isolation
popd
echo "=== (${PYTHON_VERSION}) Show dynamic libraries the wheel depend on ==="
diff --git a/ci/scripts/python_wheel_validate_contents.py
b/ci/scripts/python_wheel_validate_contents.py
index 84fcaba42e..75815dadb8 100644
--- a/ci/scripts/python_wheel_validate_contents.py
+++ b/ci/scripts/python_wheel_validate_contents.py
@@ -33,6 +33,10 @@ def validate_wheel(path):
)
]
assert not outliers, f"Unexpected contents in wheel: {sorted(outliers)}"
+ for filename in ('LICENSE.txt', 'NOTICE.txt'):
+ assert any(info.filename.split("/")[-1] == filename
+ for info in f.filelist), \
+ f"{filename} is missing from the wheel."
print(f"The wheel: {wheels[0]} seems valid.")
diff --git a/ci/scripts/python_wheel_windows_build.bat
b/ci/scripts/python_wheel_windows_build.bat
index b4b7fed99f..fc256d7278 100644
--- a/ci/scripts/python_wheel_windows_build.bat
+++ b/ci/scripts/python_wheel_windows_build.bat
@@ -133,7 +133,7 @@ set CMAKE_PREFIX_PATH=C:\arrow-dist
pushd C:\arrow\python
@REM Build wheel
-%PYTHON_CMD% setup.py bdist_wheel || exit /B 1
+%PYTHON_CMD% -m build --sdist --wheel . --no-isolation || exit /B 1
@REM Repair the wheel with delvewheel
@REM
diff --git a/ci/scripts/python_wheel_xlinux_build.sh
b/ci/scripts/python_wheel_xlinux_build.sh
index a3fbeb3c0b..ceebbc5ad0 100755
--- a/ci/scripts/python_wheel_xlinux_build.sh
+++ b/ci/scripts/python_wheel_xlinux_build.sh
@@ -167,7 +167,7 @@ export ARROW_HOME=/tmp/arrow-dist
export CMAKE_PREFIX_PATH=/tmp/arrow-dist
pushd /arrow/python
-python setup.py bdist_wheel
+python -m build --sdist --wheel . --no-isolation
echo "=== Strip symbols from wheel ==="
mkdir -p dist/temp-fix-wheel
diff --git a/python/requirements-wheel-build.txt
b/python/requirements-wheel-build.txt
index ac6388762b..769435f4dd 100644
--- a/python/requirements-wheel-build.txt
+++ b/python/requirements-wheel-build.txt
@@ -1,3 +1,4 @@
+build
cython>=3.1
numpy>=2.0.0
setuptools_scm