Skip to content

Commit dfd48e6

Browse files
raulcdpitrourok
committed
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)
Currently the files are missing from the published wheels. - Ensure the license and notice files are part of the wheels - Use build frontend to build wheels - Build wheel from sdist 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. ``` No * GitHub Issue: #48983 Lead-authored-by: Raúl Cumplido <raulcumplido@gmail.com> Co-authored-by: Antoine Pitrou <pitrou@free.fr> Co-authored-by: Rok Mihevc <rok@mihevc.org> Signed-off-by: Raúl Cumplido <raulcumplido@gmail.com>
1 parent b63025d commit dfd48e6

File tree

6 files changed

+10
-5
lines changed

6 files changed

+10
-5
lines changed

.env

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -102,8 +102,8 @@ VCPKG="4334d8b4c8916018600212ab4dd4bbdc343065d1" # 2025.09.17 Release
102102
# ci/docker/python-*-windows-*.dockerfile or the vcpkg config.
103103
# This is a workaround for our CI problem that "archery docker build" doesn't
104104
# use pulled built images in dev/tasks/python-wheels/github.windows.yml.
105-
PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2025-10-13
106-
PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION=2025-10-13
105+
PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2026-01-27
106+
PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION=2026-01-27
107107

108108
# Use conanio/${CONAN_BASE}:{CONAN_VERSION} for "docker compose run --rm conan".
109109
# See https://github.com/conan-io/conan-docker-tools#readme and

ci/scripts/python_wheel_macos_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ export CMAKE_PREFIX_PATH=${build_dir}/install
177177
export SETUPTOOLS_SCM_PRETEND_VERSION=${PYARROW_VERSION}
178178

179179
pushd ${source_dir}/python
180-
python setup.py bdist_wheel
180+
python -m build --sdist --wheel . --no-isolation
181181
popd
182182

183183
echo "=== (${PYTHON_VERSION}) Show dynamic libraries the wheel depend on ==="

ci/scripts/python_wheel_validate_contents.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,10 @@ def validate_wheel(path):
3333
)
3434
]
3535
assert not outliers, f"Unexpected contents in wheel: {sorted(outliers)}"
36+
for filename in ('LICENSE.txt', 'NOTICE.txt'):
37+
assert any(info.filename.split("/")[-1] == filename
38+
for info in f.filelist), \
39+
f"{filename} is missing from the wheel."
3640
print(f"The wheel: {wheels[0]} seems valid.")
3741

3842

ci/scripts/python_wheel_windows_build.bat

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ set CMAKE_PREFIX_PATH=C:\arrow-dist
133133
pushd C:\arrow\python
134134

135135
@REM Build wheel
136-
%PYTHON_CMD% setup.py bdist_wheel || exit /B 1
136+
%PYTHON_CMD% -m build --sdist --wheel . --no-isolation || exit /B 1
137137

138138
@REM Repair the wheel with delvewheel
139139
@REM

ci/scripts/python_wheel_xlinux_build.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ export ARROW_HOME=/tmp/arrow-dist
167167
export CMAKE_PREFIX_PATH=/tmp/arrow-dist
168168

169169
pushd /arrow/python
170-
python setup.py bdist_wheel
170+
python -m build --sdist --wheel . --no-isolation
171171

172172
echo "=== Strip symbols from wheel ==="
173173
mkdir -p dist/temp-fix-wheel

python/requirements-wheel-build.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
build
12
cython>=3.1
23
numpy>=2.0.0
34
setuptools_scm

0 commit comments

Comments
 (0)