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 78bc71160d GH-50493: [Python] Use scikit-build-core force-include and
remove custom build-backend to copy license files (#50494)
78bc71160d is described below
commit 78bc71160d3f8273984f32722e250907dbc1b64f
Author: Raúl Cumplido <[email protected]>
AuthorDate: Mon Jul 20 12:06:36 2026 +0200
GH-50493: [Python] Use scikit-build-core force-include and remove custom
build-backend to copy license files (#50494)
### Rationale for this change
`scikit-build-core` 1.0 added `[tool.scikit-build.sdist.force-include]` in
order to force the inclusion of files out of the source tree.
This allows us to remove our workaround with a custom build-backend to
solve adding our license files from the main Arrow repository.
### What changes are included in this PR?
Add configuration to force-include `LICENSE.txt` and `NOTICE.txt` and
remove custom build-backend.
### Are these changes tested?
Yes, CI and local
### Are there any user-facing changes?
No
* GitHub Issue: #50493
Authored-by: Raúl Cumplido <[email protected]>
Signed-off-by: Raúl Cumplido <[email protected]>
---
.env | 4 +--
ci/conda_env_python.txt | 2 +-
python/_build_backend/__init__.py | 68 -------------------------------------
python/pyproject.toml | 11 +++---
python/requirements-build.txt | 2 +-
python/requirements-wheel-build.txt | 2 +-
6 files changed, 11 insertions(+), 78 deletions(-)
diff --git a/.env b/.env
index 44b9db8aef..6051a43387 100644
--- a/.env
+++ b/.env
@@ -98,5 +98,5 @@ VCPKG="9b965a116838c6cdcd36bca60d1b81b030c8ab8d" #
2026.05.27 (not release, u
# 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-06-03
-PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION=2026-06-03
+PYTHON_WHEEL_WINDOWS_IMAGE_REVISION=2026-07-13
+PYTHON_WHEEL_WINDOWS_TEST_IMAGE_REVISION=2026-07-13
diff --git a/ci/conda_env_python.txt b/ci/conda_env_python.txt
index dd16d66b72..a0dca4eac1 100644
--- a/ci/conda_env_python.txt
+++ b/ci/conda_env_python.txt
@@ -29,5 +29,5 @@ numpy>=1.16.6
pytest
pytest-faulthandler
s3fs>=2023.10.0
-scikit-build-core
+scikit-build-core>=1.0
setuptools_scm>=8
diff --git a/python/_build_backend/__init__.py
b/python/_build_backend/__init__.py
deleted file mode 100644
index 6e5c328a69..0000000000
--- a/python/_build_backend/__init__.py
+++ /dev/null
@@ -1,68 +0,0 @@
-# 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.
-
-"""
-Build backend wrapper that resolves license symlinks before delegating
-to scikit-build-core.
-
-Arrow's LICENSE.txt and NOTICE.txt live at the repository root, one level
-above python/. They are symlinked into python/ so that license-files in
-pyproject.toml can reference them otherwise project metadata fails validation.
-This is done before any build backend is invoked that's why symlinks are
necessary.
-But when building sdist tarballs symlinks are not copied and we end up with
-broken LICENSE.txt and NOTICE.txt.
-
-This custom build backend replaces the symlinks with actual file copies before
-scikit_build_core.build.build_sdist so that the sdist contains the real file
content.
-The symlinks are restored afterwards to keep the git working tree clean.
-"""
-
-from contextlib import contextmanager
-import os
-from pathlib import Path
-import shutil
-import sys
-
-from scikit_build_core.build import * # noqa: F401,F403
-from scikit_build_core.build import build_sdist as scikit_build_sdist
-
-LICENSE_FILES = ("LICENSE.txt", "NOTICE.txt")
-PYTHON_DIR = Path(__file__).resolve().parent.parent
-
-
-@contextmanager
-def prepare_licenses():
- # Temporarily copy the files so they are included on sdist.
- for name in LICENSE_FILES:
- parent_license = PYTHON_DIR.parent / name
- pyarrow_license = PYTHON_DIR / name
- pyarrow_license.unlink(missing_ok=True)
- shutil.copy2(parent_license, pyarrow_license)
- try:
- yield
- finally:
- if sys.platform != "win32":
- # Copy back the original symlinks so git status is clean.
- for name in LICENSE_FILES:
- filepath = PYTHON_DIR / name
- os.unlink(filepath)
- os.symlink(f"../{name}", filepath)
-
-
-def build_sdist(sdist_directory, config_settings=None):
- with prepare_licenses():
- return scikit_build_sdist(sdist_directory, config_settings)
diff --git a/python/pyproject.toml b/python/pyproject.toml
index 86c907a3db..ab6f2e6061 100644
--- a/python/pyproject.toml
+++ b/python/pyproject.toml
@@ -17,17 +17,14 @@
[build-system]
requires = [
- "scikit-build-core",
+ "scikit-build-core >= 1.0",
"cython >= 3.1",
# Needed for build-time stub docstring extraction
"libcst>=1.8.6",
"numpy>=1.25",
"setuptools_scm[toml]>=8",
]
-# We use a really simple build backend wrapper over scikit-build-core
-# to solve licenses to work around links not being included in sdists.
-build-backend = "_build_backend"
-backend-path = ["."]
+build-backend = "scikit_build_core.build"
[project]
name = "pyarrow"
@@ -94,6 +91,10 @@ wheel.install-dir = "pyarrow"
# in-tree for CI type-checking.
wheel.exclude = ["pyarrow/py.typed"]
+[tool.scikit-build.sdist.force-include]
+"../LICENSE.txt" = "LICENSE.txt"
+"../NOTICE.txt" = "NOTICE.txt"
+
[tool.scikit-build.cmake.define]
PYARROW_BUNDLE_ARROW_CPP = {env = "PYARROW_BUNDLE_ARROW_CPP", default = "OFF"}
PYARROW_BUNDLE_CYTHON_CPP = {env = "PYARROW_BUNDLE_CYTHON_CPP", default =
"OFF"}
diff --git a/python/requirements-build.txt b/python/requirements-build.txt
index fdd3e68a1b..2ed711613b 100644
--- a/python/requirements-build.txt
+++ b/python/requirements-build.txt
@@ -2,5 +2,5 @@ build
cython>=3.1
libcst>=1.8.6
numpy>=1.25
-scikit-build-core
+scikit-build-core>=1.0
setuptools_scm>=8
diff --git a/python/requirements-wheel-build.txt
b/python/requirements-wheel-build.txt
index a3ac139677..3d1d1c9b8d 100644
--- a/python/requirements-wheel-build.txt
+++ b/python/requirements-wheel-build.txt
@@ -3,6 +3,6 @@ cython>=3.1
# Needed for build-time stub docstring extraction
libcst>=1.8.6
numpy>=2.0.0
-scikit-build-core
+scikit-build-core>=1.0
setuptools_scm
wheel