Skip to content

Commit 0dcb4da

Browse files
committed
chore(lambda-layer): adapt build for pyarrow 24 (scikit-build-core, drop py3.9)
PyArrow 24 dropped setup.py and moved to pyproject.toml + scikit-build-core. The legacy `setup.py build_ext --bundle-arrow-cpp bdist_wheel` invocation fails because arrow/python/setup.py no longer exists. - Use `python -m build --wheel --no-isolation` and export PYARROW_BUNDLE_ARROW_CPP=ON (replaces the --bundle-arrow-cpp flag). - Drop the PYARROW_WITH_{PLASMA,CSV,JSON,COMPUTE,FILESYSTEM} and ARROW_PRE_0_15_IPC_FORMAT exports — pyarrow 24's CMakeLists no longer defines those options. - Install build deps (build, scikit-build-core, libcst>=1.8.6) and pin cython>=3.1 in both Dockerfiles. - Drop the Python 3.9 layer build: pyarrow 24 requires Python >= 3.10.
1 parent 937aa34 commit 0dcb4da

5 files changed

Lines changed: 17 additions & 40 deletions

File tree

building/build-lambda-layers.sh

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,17 +21,6 @@ pushd lambda
2121
# Building all related docker images
2222
./build-docker-images.sh $PYTHON_VERSION
2323

24-
# Python 3.9
25-
if [[ $PYTHON_VERSION == "ALL" || $PYTHON_VERSION == "3.9" ]]
26-
then
27-
docker run \
28-
--volume "$DIR_NAME":/aws-sdk-pandas/ \
29-
--workdir /aws-sdk-pandas/building/lambda \
30-
--rm \
31-
awswrangler-build-py39 \
32-
build-lambda-layer.sh "${VERSION}-py3.9${ARCH_SUFFIX}" "ninja-build"
33-
fi
34-
3524
# Python 3.10
3625
if [[ $PYTHON_VERSION == "ALL" || $PYTHON_VERSION == "3.10" ]]
3726
then

building/lambda/Dockerfile

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ RUN ln -s /usr/bin/gcc10-ld /usr/bin/ld
3535
FROM ${python_version}
3636
COPY pyproject.toml uv.lock ./
3737

38-
# Setuptools is a build dependency of arrow and runtime dependency of some of our dependencies (mainly redshift-connector).
39-
# Remove when arrow version shipped with lambda layers and dependencies are updated.
38+
# Setuptools is a runtime dependency of some of our dependencies (mainly redshift-connector).
4039
RUN pip3 install --upgrade pip wheel setuptools>=78.1.1 setuptools_scm>=8
4140
RUN pip3 install --upgrade urllib3==1.26.16 # temporary to avoid https://github.com/urllib3/urllib3/issues/2168 (TODO remove when the AL2 image updates to support OpenSSL 1.1.1+)
42-
# In new CMake 4, compatibility with CMake < 3.5 has been removed.
41+
# In new CMake 4, compatibility with CMake < 3.5 has been removed.
4342
# Unpin CMake when arrow version shipped with lambda layers is updated.
4443
RUN pip3 install --upgrade cmake==3.31.6
45-
RUN pip3 install --upgrade six cython hypothesis uv
44+
# pyarrow 24+ build deps: scikit-build-core replaces setuptools; cython>=3.1 and
45+
# libcst (used for build-time stub docstring extraction) are required.
46+
RUN pip3 install --upgrade six "cython>=3.1" hypothesis uv build scikit-build-core "libcst>=1.8.6"
4647

4748
ENV PIP_NO_BINARY="numpy,pandas"
4849
ENV UV_PROJECT_ENVIRONMENT="/var/lang"

building/lambda/Dockerfile.al2023

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,14 @@ WORKDIR /root
2424
FROM ${python_version}
2525
COPY pyproject.toml uv.lock ./
2626

27-
# Setuptools is a build dependency of arrow and runtime dependency of some of our dependencies (mainly redshift-connector).
28-
# Remove when arrow version shipped with lambda layers and dependencies are updated.
27+
# Setuptools is a runtime dependency of some of our dependencies (mainly redshift-connector).
2928
RUN pip3 install --upgrade pip wheel setuptools>=78.1.1 setuptools_scm>=8
30-
# In new CMake 4, compatibility with CMake < 3.5 has been removed.
29+
# In new CMake 4, compatibility with CMake < 3.5 has been removed.
3130
# Unpin CMake when arrow version shipped with lambda layers is updated.
3231
RUN pip3 install --upgrade cmake==3.31.6
33-
RUN pip3 install --upgrade six cython hypothesis uv
32+
# pyarrow 24+ build deps: scikit-build-core replaces setuptools; cython>=3.1 and
33+
# libcst (used for build-time stub docstring extraction) are required.
34+
RUN pip3 install --upgrade six "cython>=3.1" hypothesis uv build scikit-build-core "libcst>=1.8.6"
3435

3536
ENV PIP_NO_BINARY="numpy,pandas"
3637
ENV UV_PROJECT_ENVIRONMENT="/var/lang"

building/lambda/build-docker-images.sh

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,6 @@ export DOCKER_BUILDKIT=1
88

99
PYTHON_VERSION=${1:-ALL}
1010

11-
# Python 3.9
12-
if [[ $PYTHON_VERSION == "ALL" || $PYTHON_VERSION == "3.9" ]]
13-
then
14-
docker build \
15-
--pull \
16-
--tag awswrangler-build-py39 \
17-
--build-arg base_image=public.ecr.aws/lambda/python:3.9 \
18-
.
19-
fi
20-
2111
# Python 3.10
2212
if [[ $PYTHON_VERSION == "ALL" || $PYTHON_VERSION == "3.10" ]]
2313
then

building/lambda/build-lambda-layer.sh

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -59,24 +59,20 @@ popd
5959
pushd arrow/python
6060

6161
export CMAKE_PREFIX_PATH=${ARROW_HOME}${CMAKE_PREFIX_PATH:+:${CMAKE_PREFIX_PATH}}
62-
export ARROW_PRE_0_15_IPC_FORMAT=0
62+
export PYARROW_BUNDLE_ARROW_CPP=ON
6363
export PYARROW_WITH_HDFS=0
6464
export PYARROW_WITH_FLIGHT=0
6565
export PYARROW_WITH_GANDIVA=0
6666
export PYARROW_WITH_ORC=0
6767
export PYARROW_WITH_CUDA=0
68-
export PYARROW_WITH_PLASMA=0
6968
export PYARROW_WITH_PARQUET=1
7069
export PYARROW_WITH_DATASET=1
71-
export PYARROW_WITH_FILESYSTEM=1
72-
export PYARROW_WITH_CSV=1
73-
export PYARROW_WITH_JSON=1
74-
export PYARROW_WITH_COMPUTE=1
75-
76-
python3 setup.py build_ext \
77-
--build-type=release \
78-
--bundle-arrow-cpp \
79-
bdist_wheel
70+
71+
# pyarrow 24+ dropped setup.py in favour of scikit-build-core via pyproject.toml.
72+
# --no-isolation reuses build deps already installed in the image (scikit-build-core,
73+
# cython>=3.1, libcst, setuptools_scm, numpy) instead of pip resolving them again.
74+
python3 -m build --wheel . --no-isolation \
75+
-C cmake.build-type=Release
8076

8177
pip3 install dist/pyarrow-*.whl -t /aws-sdk-pandas/dist/pyarrow_files
8278

0 commit comments

Comments
 (0)