Skip to content

Apache DataFusion SQL Query Engine

ARROW-11212: [Packaging][Python] Use vcpkg as dependency source for manylinux and windows wheels

Krisztián Szűcsb26b2cf17cf9
diff --git a/.env b/.env
index d2b817d9b3..f8a086c563 100644
--- a/.env
+++ b/.env
@@ -18,6 +18,15 @@
# All of the following environment variables are required to set default values
# for the parameters in docker-compose.yml.
+# empty prefix means that the docker-compose configuration will use named
+# volumes which potentially improves the performance on docker for macos and
+# docker for windows, it also prevents the contamination of the source
+# directory
+# a non-empty prefix means that directories from the host are bind-mounted
+# into the container, it should be set to ".docker/" on github actions to keep
+# the cache plugin functional
+DOCKER_VOLUME_PREFIX=""
+
ULIMIT_CORE=-1
REPO=apache/arrow-dev
ARCH=amd64
@@ -49,3 +58,6 @@ R_IMAGE=ubuntu-gcc-release
R_TAG=latest
# -1 does not attempt to install a devtoolset version, any positive integer will install devtoolset-n
DEVTOOLSET_VERSION=-1
+
+# Used for the manylinux and windows wheels
+VCPKG=c7e96f2a5b73b3278b004aa88abec2f8ebfb43b5
diff --git a/.github/workflows/cpp.yml b/.github/workflows/cpp.yml
index f484521493..48f74f7cd8 100644
--- a/.github/workflows/cpp.yml
+++ b/.github/workflows/cpp.yml
@@ -39,6 +39,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARROW_ENABLE_TIMING_TESTS: OFF
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
diff --git a/.github/workflows/cpp_cron.yml b/.github/workflows/cpp_cron.yml
index 700fb3e16d..5cd692b126 100644
--- a/.github/workflows/cpp_cron.yml
+++ b/.github/workflows/cpp_cron.yml
@@ -31,6 +31,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARROW_ENABLE_TIMING_TESTS: OFF
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
diff --git a/.github/workflows/integration.yml b/.github/workflows/integration.yml
index ead90ef8b1..7cf2ddfaa2 100644
--- a/.github/workflows/integration.yml
+++ b/.github/workflows/integration.yml
@@ -45,6 +45,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/java.yml b/.github/workflows/java.yml
index 385d021012..38f58847df 100644
--- a/.github/workflows/java.yml
+++ b/.github/workflows/java.yml
@@ -37,6 +37,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/java_jni.yml b/.github/workflows/java_jni.yml
index ef406426bf..46dae212a0 100644
--- a/.github/workflows/java_jni.yml
+++ b/.github/workflows/java_jni.yml
@@ -37,6 +37,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml
index 169a718b03..254d949423 100644
--- a/.github/workflows/python.yml
+++ b/.github/workflows/python.yml
@@ -33,6 +33,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
@@ -50,7 +51,6 @@ jobs:
- conda-python-3.8-nopandas
- conda-python-3.6-pandas-0.23
- conda-python-3.7-pandas-latest
- - centos-python-3.6-manylinux1
include:
- name: conda-python-3.8-nopandas
cache: conda-python-3.8
@@ -69,10 +69,6 @@ jobs:
title: AMD64 Conda Python 3.7 Pandas latest
python: 3.7
pandas: latest
- - name: centos-python-3.6-manylinux1
- cache: manylinux1
- image: centos-python-manylinux1
- title: AMD64 CentOS 5.11 Python 3.6 manylinux1
env:
PYTHON: ${{ matrix.python || 3.7 }}
UBUNTU: ${{ matrix.ubuntu || 18.04 }}
diff --git a/.github/workflows/python_cron.yml b/.github/workflows/python_cron.yml
index 256856bd19..88007bac2b 100644
--- a/.github/workflows/python_cron.yml
+++ b/.github/workflows/python_cron.yml
@@ -30,6 +30,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/r.yml b/.github/workflows/r.yml
index 37aee19688..3b200c10b8 100644
--- a/.github/workflows/r.yml
+++ b/.github/workflows/r.yml
@@ -41,6 +41,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/.github/workflows/ruby.yml b/.github/workflows/ruby.yml
index 03f4f0eb0d..6ade7d853b 100644
--- a/.github/workflows/ruby.yml
+++ b/.github/workflows/ruby.yml
@@ -45,6 +45,7 @@ on:
env:
DOCKER_BUILDKIT: 0
+ DOCKER_VOLUME_PREFIX: ".docker/"
COMPOSE_DOCKER_CLI_BUILD: 1
ARCHERY_DOCKER_USER: ${{ secrets.DOCKERHUB_USER }}
ARCHERY_DOCKER_PASSWORD: ${{ secrets.DOCKERHUB_TOKEN }}
diff --git a/ci/docker/python-wheel-manylinux-201x.dockerfile b/ci/docker/python-wheel-manylinux-201x.dockerfile
new file mode 100644
index 0000000000..0a17d86490
--- /dev/null
+++ b/ci/docker/python-wheel-manylinux-201x.dockerfile
@@ -0,0 +1,103 @@
+# 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.
+
+ARG base
+FROM ${base}
+
+RUN yum install -y git flex curl autoconf zip wget
+
+# Install CMake
+ARG cmake=3.19.2
+RUN wget -q https://github.com/Kitware/CMake/releases/download/v${cmake}/cmake-${cmake}-Linux-x86_64.tar.gz -O - | \
+ tar -xzf - --directory /usr/local --strip-components=1
+
+# Install Ninja
+ARG ninja=1.10.2
+RUN mkdir /tmp/ninja && \
+ wget -q https://github.com/ninja-build/ninja/archive/v${ninja}.tar.gz -O - | \
+ tar -xzf - --directory /tmp/ninja --strip-components=1 && \
+ cd /tmp/ninja && \
+ ./configure.py --bootstrap && \
+ mv ninja /usr/local/bin && \
+ rm -rf /tmp/ninja
+
+# Install ccache
+ARG ccache=4.1
+RUN mkdir /tmp/ccache && \
+ wget -q https://github.com/ccache/ccache/archive/v${ccache}.tar.gz -O - | \
+ tar -xzf - --directory /tmp/ccache --strip-components=1 && \
+ cd /tmp/ccache && \
+ mkdir build && \
+ cd build && \
+ cmake -GNinja -DCMAKE_BUILD_TYPE=Release -DZSTD_FROM_INTERNET=ON .. && \
+ ninja install && \
+ rm -rf /tmp/ccache
+
+# Install vcpkg
+ARG vcpkg
+RUN git clone https://github.com/microsoft/vcpkg /opt/vcpkg && \
+ git -C /opt/vcpkg checkout ${vcpkg} && \
+ /opt/vcpkg/bootstrap-vcpkg.sh --useSystemBinaries --disableMetrics && \
+ ln -s /opt/vcpkg/vcpkg /usr/bin/vcpkg
+
+# Patch ports files as needed
+COPY ci/vcpkg arrow/ci/vcpkg
+RUN cd /opt/vcpkg && patch -p1 -i /arrow/ci/vcpkg/ports.patch
+
+ARG build_type=release
+ENV CMAKE_BUILD_TYPE=${build_type} \
+ VCPKG_FORCE_SYSTEM_BINARIES=1 \
+ VCPKG_OVERLAY_TRIPLETS=/arrow/ci/vcpkg \
+ VCPKG_DEFAULT_TRIPLET=x64-linux-static-${build_type}
+
+# TODO(kszucs): factor out the package enumeration to a text file and reuse it
+# from the windows image and potentially in a future macos wheel build
+RUN vcpkg install --clean-after-build \
+ abseil \
+ aws-sdk-cpp[config,cognito-identity,core,identity-management,s3,sts,transfer] \
+ boost-filesystem \
+ boost-regex \
+ brotli \
+ bzip2 \
+ c-ares \
+ curl \
+ flatbuffers \
+ gflags \
+ glog \
+ grpc \
+ lz4 \
+ openssl \
+ orc \
+ protobuf \
+ rapidjson \
+ re2 \
+ snappy \
+ thrift \
+ utf8proc \
+ zlib \
+ zstd
+
+ARG python=3.6
+ENV PYTHON_VERSION=${python}
+RUN PYTHON_ROOT=$(find /opt/python -name cp${PYTHON_VERSION/./}-*) && \
+ echo "export PATH=$PYTHON_ROOT/bin:\$PATH" >> /etc/profile.d/python.sh
+
+SHELL ["/bin/bash", "-i", "-c"]
+ENTRYPOINT ["/bin/bash", "-i", "-c"]
+
+COPY python/requirements-wheel-build.txt /arrow/python/
+RUN pip install -r /arrow/python/requirements-wheel-build.txt
diff --git a/ci/docker/python-wheel-windows-vs2017.dockerfile b/ci/docker/python-wheel-windows-vs2017.dockerfile
new file mode 100644
index 0000000000..50372bd8e5
--- /dev/null
+++ b/ci/docker/python-wheel-windows-vs2017.dockerfile
@@ -0,0 +1,99 @@
+# 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.
+
+# based on mcr.microsoft.com/windows/servercore:ltsc2019
+# contains choco and vs2017 preinstalled
+FROM abrarov/msvc-2017:2.10.0
+
+# Install CMake and Ninja
+RUN choco install --no-progress -r -y cmake --installargs 'ADD_CMAKE_TO_PATH=System' && \
+ choco install --no-progress -r -y gzip wget ninja
+
+# Add unix tools to path
+RUN setx path "%path%;C:\Program Files\Git\usr\bin"
+
+# Install vcpkg
+ARG vcpkg
+RUN git clone https://github.com/Microsoft/vcpkg && \
+ git -C vcpkg checkout %vcpkg% && \
+ vcpkg\bootstrap-vcpkg.bat -disableMetrics -win64 && \
+ setx PATH "%PATH%;C:\vcpkg"
+
+# Patch ports files as needed
+COPY ci/vcpkg arrow/ci/vcpkg
+RUN cd vcpkg && patch -p1 -i C:/arrow/ci/vcpkg/ports.patch
+
+# Configure vcpkg and install dependencies
+# NOTE: use windows batch environment notation for build arguments in RUN
+# statements but bash notation in ENV statements
+# VCPKG_FORCE_SYSTEM_BINARIES=1 spare around ~750MB of image size if the system
+# cmake's and ninja's versions are recent enough
+COPY ci/vcpkg arrow/ci/vcpkg
+ARG build_type=release
+ENV CMAKE_BUILD_TYPE=${build_type} \
+ VCPKG_OVERLAY_TRIPLETS=C:\\arrow\\ci\\vcpkg \
+ VCPKG_DEFAULT_TRIPLET=x64-windows-static-md-${build_type}
+RUN vcpkg install --clean-after-build \
+ abseil \
+ aws-sdk-cpp[config,cognito-identity,core,identity-management,s3,sts,transfer] \
+ boost-filesystem \
+ boost-multiprecision \
+ boost-regex \
+ boost-system \
+ brotli \
+ bzip2 \
+ c-ares \
+ curl \
+ flatbuffers \
+ gflags \
+ glog \
+ grpc \
+ lz4 \
+ openssl \
+ orc \
+ protobuf \
+ rapidjson \
+ re2 \
+ snappy \
+ thrift \
+ utf8proc \
+ zlib \
+ zstd
+
+# Remove previous installations of python from the base image
+RUN wmic product where "name like 'python%%'" call uninstall /nointeractive && \
+ rm -rf Python*
+
+# Define the full version number otherwise choco falls back to patch number 0 (3.7 => 3.7.0)
+ARG python=3.6
+RUN (if "%python%"=="3.6" setx PYTHON_VERSION 3.6.8) & \
+ (if "%python%"=="3.7" setx PYTHON_VERSION 3.7.4) & \
+ (if "%python%"=="3.8" setx PYTHON_VERSION 3.8.6) & \
+ (if "%python%"=="3.9" setx PYTHON_VERSION 3.9.1)
+RUN choco install -r -y --no-progress python --version=%PYTHON_VERSION%
+RUN python -m pip install -U pip
+
+COPY python/requirements-wheel-build.txt arrow/python/
+RUN pip install -r arrow/python/requirements-wheel-build.txt
+
+# TODO(kszucs): set clcache as the compiler
+ENV CLCACHE_DIR="C:\clcache"
+RUN pip install clcache
+
+# For debugging purposes
+# RUN wget --no-check-certificate https://github.com/lucasg/Dependencies/releases/download/v1.10/Dependencies_x64_Release.zip
+# RUN unzip Dependencies_x64_Release.zip -d Dependencies && setx path "%path%;C:\Depencencies"
diff --git a/ci/scripts/python_wheel_manylinux_build.sh b/ci/scripts/python_wheel_manylinux_build.sh
new file mode 100755
index 0000000000..68e75c39ab
--- /dev/null
+++ b/ci/scripts/python_wheel_manylinux_build.sh
@@ -0,0 +1,142 @@
+#!/usr/bin/env bash
+#
+# 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.
+
+set -ex
+
+function check_arrow_visibility {
+ nm --demangle --dynamic /tmp/arrow-dist/lib/libarrow.so > nm_arrow.log
+
+ # Filter out Arrow symbols and see if anything remains.
+ # '_init' and '_fini' symbols may or not be present, we don't care.
+ # (note we must ignore the grep exit status when no match is found)
+ grep ' T ' nm_arrow.log | grep -v -E '(arrow|\b_init\b|\b_fini\b)' | cat - > visible_symbols.log
+
+ if [[ -f visible_symbols.log && `cat visible_symbols.log | wc -l` -eq 0 ]]; then
+ return 0
+ else
+ echo "== Unexpected symbols exported by libarrow.so =="
+ cat visible_symbols.log
+ echo "================================================"
+
+ exit 1
+ fi
+}
+
+echo "=== (${PYTHON_VERSION}) Clear output directories and leftovers ==="
+# Clear output directories and leftovers
+rm -rf /tmp/arrow-build
+rm -rf /arrow/python/dist
+rm -rf /arrow/python/build
+rm -rf /arrow/python/repaired_wheels
+rm -rf /arrow/python/pyarrow/*.so
+rm -rf /arrow/python/pyarrow/*.so.*
+
+echo "=== (${PYTHON_VERSION}) Building Arrow C++ libraries ==="
+: ${ARROW_DATASET:=ON}
+: ${ARROW_FLIGHT:=ON}
+: ${ARROW_GANDIVA:=OFF}
+: ${ARROW_HDFS:=ON}
+: ${ARROW_JEMALLOC:=ON}
+: ${ARROW_MIMALLOC:=ON}
+: ${ARROW_ORC:=ON}
+: ${ARROW_PARQUET:=ON}
+: ${ARROW_PLASMA:=ON}
+: ${ARROW_S3:=ON}
+: ${ARROW_TENSORFLOW:=ON}
+: ${ARROW_WITH_BROTLI:=ON}
+: ${ARROW_WITH_BZ2:=ON}
+: ${ARROW_WITH_LZ4:=ON}
+: ${ARROW_WITH_SNAPPY:=ON}
+: ${ARROW_WITH_ZLIB:=ON}
+: ${ARROW_WITH_ZSTD:=ON}
+: ${CMAKE_BUILD_TYPE:=release}
+: ${CMAKE_GENERATOR:=Ninja}
+
+mkdir /tmp/arrow-build
+pushd /tmp/arrow-build
+cmake \
+ -DARROW_BROTLI_USE_SHARED=OFF \
+ -DARROW_BUILD_SHARED=ON \
+ -DARROW_BUILD_STATIC=OFF \
+ -DARROW_BUILD_TESTS=OFF \
+ -DARROW_DATASET=${ARROW_DATASET} \
+ -DARROW_DEPENDENCY_SOURCE="SYSTEM" \
+ -DARROW_DEPENDENCY_USE_SHARED=OFF \
+ -DARROW_FLIGHT==${ARROW_FLIGHT} \
+ -DARROW_GANDIVA=${ARROW_GANDIVA} \
+ -DARROW_HDFS=${ARROW_HDFS} \
+ -DARROW_JEMALLOC=${ARROW_JEMALLOC} \
+ -DARROW_MIMALLOC=${ARROW_MIMALLOC} \
+ -DARROW_ORC=${ARROW_ORC} \
+ -DARROW_PACKAGE_KIND="manylinux${MANYLINUX_VERSION}" \
+ -DARROW_PARQUET=${ARROW_PARQUET} \
+ -DARROW_PLASMA=${ARROW_PLASMA} \
+ -DARROW_PYTHON=ON \
+ -DARROW_RPATH_ORIGIN=ON \
+ -DARROW_S3=${ARROW_S3} \
+ -DARROW_TENSORFLOW=${ARROW_TENSORFLOW} \
+ -DARROW_USE_CCACHE=ON \
+ -DARROW_UTF8PROC_USE_SHARED=OFF \
+ -DARROW_WITH_BROTLI=${ARROW_WITH_BROTLI} \
+ -DARROW_WITH_BZ2=${ARROW_WITH_BZ2} \
+ -DARROW_WITH_LZ4=${ARROW_WITH_LZ4} \
+ -DARROW_WITH_SNAPPY=${ARROW_WITH_SNAPPY} \
+ -DARROW_WITH_ZLIB=${ARROW_WITH_ZLIB} \
+ -DARROW_WITH_ZSTD=${ARROW_WITH_ZSTD} \
+ -DCMAKE_BUILD_TYPE=${CMAKE_BUILD_TYPE} \
+ -DCMAKE_INSTALL_LIBDIR=lib \
+ -DCMAKE_INSTALL_PREFIX=/tmp/arrow-dist \
+ -DCMAKE_TOOLCHAIN_FILE=/opt/vcpkg/scripts/buildsystems/vcpkg.cmake \
+ -DCMAKE_UNITY_BUILD=ON \
+ -DOPENSSL_USE_STATIC_LIBS=ON \
+ -DThrift_ROOT=/opt/vcpkg/installed/x64-linux/lib \
+ -DVCPKG_TARGET_TRIPLET=x64-linux-static-${CMAKE_BUILD_TYPE} \
+ -G ${CMAKE_GENERATOR} \
+ /arrow/cpp
+cmake --build . --target install
+popd
+
+# Check that we don't expose any unwanted symbols
+check_arrow_visibility
+
+echo "=== (${PYTHON_VERSION}) Building wheel ==="
+export PYARROW_BUILD_TYPE=${CMAKE_BUILD_TYPE}
+export PYARROW_BUNDLE_ARROW_CPP=1
+export PYARROW_CMAKE_GENERATOR=${CMAKE_GENERATOR}
+export PYARROW_INSTALL_TESTS=1
+export PYARROW_WITH_DATASET=${ARROW_DATASET}
+export PYARROW_WITH_FLIGHT=${ARROW_FLIGHT}
+export PYARROW_WITH_GANDIVA=${ARROW_GANDIVA}
+export PYARROW_WITH_HDFS=${ARROW_HDFS}
+export PYARROW_WITH_ORC=${ARROW_ORC}
+export PYARROW_WITH_PARQUET=${ARROW_PARQUET}
+export PYARROW_WITH_PLASMA=${ARROW_PLASMA}
+export PYARROW_WITH_S3=${ARROW_S3}
+# PyArrow build configuration
+export PKG_CONFIG_PATH=/usr/lib/pkgconfig:/tmp/arrow-dist/lib/pkgconfig
+
+pushd /arrow/python
+python setup.py bdist_wheel
+
+echo "=== (${PYTHON_VERSION}) Tag the wheel with manylinux${MANYLINUX_VERSION} ==="
+auditwheel repair \
+ --plat "manylinux${MANYLINUX_VERSION}_x86_64" \
+ -L . dist/pyarrow-*.whl \
+ -w repaired_wheels
+popd
diff --git a/dev/tasks/python-wheels/manylinux-test.sh b/ci/scripts/python_wheel_manylinux_test.sh
similarity index 61%
rename from dev/tasks/python-wheels/manylinux-test.sh
rename to ci/scripts/python_wheel_manylinux_test.sh
index e1a6659a4f..d603f7c6a7 100755
--- a/dev/tasks/python-wheels/manylinux-test.sh
+++ b/ci/scripts/python_wheel_manylinux_test.sh
@@ -1,5 +1,5 @@
-#!/bin/bash
-
+#!/usr/bin/env bash
+#
# 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
@@ -17,36 +17,43 @@
# specific language governing permissions and limitations
# under the License.
-set -e
+set -ex
-export ARROW_TEST_DATA=/arrow/testing/data
export PYARROW_TEST_CYTHON=OFF
+export PYARROW_TEST_DATASET=ON
+export PYARROW_TEST_GANDIVA=OFF
+export PYARROW_TEST_HDFS=ON
+export PYARROW_TEST_ORC=ON
+export PYARROW_TEST_PANDAS=ON
+export PYARROW_TEST_PARQUET=ON
+export PYARROW_TEST_PLASMA=ON
+export PYARROW_TEST_S3=ON
+export PYARROW_TEST_TENSORFLOW=ON
+export PYARROW_TEST_FLIGHT=ON
-python --version
-# Install built wheel
-pip install -q /arrow/python/$WHEEL_DIR/dist/*.whl
-# Install test dependencies
-pip install -q -r /arrow/python/requirements-wheel-test.txt
-# Run pyarrow tests
-pytest -rs --pyargs pyarrow
+export ARROW_TEST_DATA=/arrow/testing/data
+export PARQUET_TEST_DATA=/arrow/submodules/parquet-testing/data
-if [[ "$1" == "--remove-system-libs" ]]; then
- # Run import tests after removing the bundled dependencies from the system
- # (be careful not to remove libz.so, required for some Python stdlib modules)
- echo "Removing the following libraries to fail loudly if they are bundled incorrectly:"
- ldconfig -p | grep "lib\(bz2\|lz4\|z[^.]\|boost\)" | awk -F'> ' '{print $2}' | sort | xargs rm -v -f
-fi
+# Install the built wheels
+pip install /arrow/python/repaired_wheels/*.whl
-# Test import and optional dependencies
+# Test that the modules are importable
python -c "
import pyarrow
+import pyarrow._hdfs
+import pyarrow._s3fs
import pyarrow.csv
import pyarrow.dataset
import pyarrow.flight
import pyarrow.fs
-import pyarrow._hdfs
import pyarrow.json
+import pyarrow.orc
import pyarrow.parquet
import pyarrow.plasma
-import pyarrow._s3fs
"
+
+# Install testing dependencies
+pip install -r /arrow/python/requirements-wheel-test.txt
+
+# Execute unittest
+pytest -v -r s --pyargs pyarrow
diff --git a/ci/scripts/python_wheel_windows_build.bat b/ci/scripts/python_wheel_windows_build.bat
new file mode 100644
index 0000000000..a9a596be89
--- /dev/null
+++ b/ci/scripts/python_wheel_windows_build.bat
@@ -0,0 +1,111 @@
+@rem Licensed to the Apache Software Foundation (ASF) under one
+@rem or more contributor license agreements. See the NOTICE file
+@rem distributed with this work for additional information
+@rem regarding copyright ownership. The ASF licenses this file
+@rem to you under the Apache License, Version 2.0 (the
+@rem "License"); you may not use this file except in compliance
+@rem with the License. You may obtain a copy of the License at
+@rem
+@rem http://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing,
+@rem software distributed under the License is distributed on an
+@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@rem KIND, either express or implied. See the License for the
+@rem specific language governing permissions and limitations
+@rem under the License.
+
+@echo on
+
+echo "Building windows wheel..."
+
+call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
+
+echo "=== (%PYTHON_VERSION%) Clear output directories and leftovers ==="
+del /s /q C:\arrow-build
+del /s /q C:\arrow-dist
+del /s /q C:\arrow\python\dist
+del /s /q C:\arrow\python\build
+del /s /q C:\arrow\python\pyarrow\*.so
+del /s /q C:\arrow\python\pyarrow\*.so.*
+
+echo "=== (%PYTHON_VERSION%) Building Arrow C++ libraries ==="
+set ARROW_DATASET=ON
+set ARROW_FLIGHT=ON
+set ARROW_GANDIVA=OFF
+set ARROW_HDFS=ON
+set ARROW_ORC=OFF
+set ARROW_PARQUET=ON
+set ARROW_MIMALLOC=ON
+set ARROW_S3=ON
+set ARROW_TENSORFLOW=ON
+set ARROW_WITH_BROTLI=ON
+set ARROW_WITH_BZ2=ON
+set ARROW_WITH_LZ4=ON
+set ARROW_WITH_SNAPPY=ON
+set ARROW_WITH_ZLIB=ON
+set ARROW_WITH_ZSTD=ON
+set CMAKE_UNITY_BUILD=ON
+set CMAKE_GENERATOR=Visual Studio 15 2017 Win64
+
+mkdir C:\arrow-build
+pushd C:\arrow-build
+cmake ^
+ -DARROW_BUILD_SHARED=ON ^
+ -DARROW_BUILD_STATIC=OFF ^
+ -DARROW_BUILD_TESTS=OFF ^
+ -DARROW_CXXFLAGS="/MP" ^
+ -DARROW_DATASET=%ARROW_DATASET% ^
+ -DARROW_DEPENDENCY_SOURCE=SYSTEM ^
+ -DARROW_DEPENDENCY_USE_SHARED=OFF ^
+ -DARROW_FLIGHT=%ARROW_FLIGHT% ^
+ -DARROW_GANDIVA=%ARROW_GANDIVA% ^
+ -DARROW_HDFS=%ARROW_HDFS% ^
+ -DARROW_MIMALLOC=%ARROW_MIMALLOC% ^
+ -DARROW_ORC=%ARROW_ORC% ^
+ -DARROW_PACKAGE_KIND="wheel-windows" ^
+ -DARROW_PARQUET=%ARROW_PARQUET% ^
+ -DARROW_PYTHON=ON ^
+ -DARROW_S3=%ARROW_S3% ^
+ -DARROW_TENSORFLOW=%ARROW_TENSORFLOW% ^
+ -DARROW_WITH_BROTLI=%ARROW_WITH_BROTLI% ^
+ -DARROW_WITH_BZ2=%ARROW_WITH_BZ2% ^
+ -DARROW_WITH_LZ4=%ARROW_WITH_LZ4% ^
+ -DARROW_WITH_SNAPPY=%ARROW_WITH_SNAPPY% ^
+ -DARROW_WITH_ZLIB=%ARROW_WITH_ZLIB% ^
+ -DARROW_WITH_ZSTD=%ARROW_WITH_ZSTD% ^
+ -DCMAKE_BUILD_TYPE=%CMAKE_BUILD_TYPE% ^
+ -DLZ4_MSVC_LIB_PREFIX="" ^
+ -DLZ4_MSVC_STATIC_LIB_SUFFIX="" ^
+ -DZSTD_MSVC_LIB_PREFIX="" ^
+ -DCMAKE_CXX_COMPILER=clcache ^
+ -DCMAKE_INSTALL_PREFIX=C:\arrow-dist ^
+ -DCMAKE_TOOLCHAIN_FILE=C:\vcpkg\scripts\buildsystems\vcpkg.cmake ^
+ -DCMAKE_UNITY_BUILD=%CMAKE_UNITY_BUILD% ^
+ -DMSVC_LINK_VERBOSE=ON ^
+ -DVCPKG_TARGET_TRIPLET=x64-windows-static-md-%CMAKE_BUILD_TYPE% ^
+ -G "%CMAKE_GENERATOR%" ^
+ C:\arrow\cpp || exit /B
+cmake --build . --config %CMAKE_BUILD_TYPE% --target install || exit /B
+popd
+
+echo "=== (%PYTHON_VERSION%) Building wheel ==="
+set PYARROW_BUILD_TYPE=%CMAKE_BUILD_TYPE%
+set PYARROW_BUNDLE_ARROW_CPP=ON
+set PYARROW_BUNDLE_BOOST=OFF
+set PYARROW_CMAKE_GENERATOR=%CMAKE_GENERATOR%
+set PYARROW_INSTALL_TESTS=ON
+set PYARROW_WITH_DATASET=%ARROW_DATASET%
+set PYARROW_WITH_FLIGHT=%ARROW_FLIGHT%
+set PYARROW_WITH_GANDIVA=%ARROW_GANDIVA%
+set PYARROW_WITH_HDFS=%ARROW_HDFS%
+set PYARROW_WITH_ORC=%ARROW_ORC%
+set PYARROW_WITH_PARQUET=%ARROW_PARQUET%
+set PYARROW_WITH_S3=%ARROW_S3%
+set ARROW_HOME=C:\arrow-dist
+
+pushd C:\arrow\python
+@REM bundle the msvc runtime
+cp "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Redist\MSVC\14.16.27012\x64\Microsoft.VC141.CRT\msvcp140.dll" pyarrow\
+python setup.py bdist_wheel || exit /B
+popd
diff --git a/ci/scripts/python_wheel_windows_test.bat b/ci/scripts/python_wheel_windows_test.bat
new file mode 100755
index 0000000000..8352e58622
--- /dev/null
+++ b/ci/scripts/python_wheel_windows_test.bat
@@ -0,0 +1,54 @@
+@rem Licensed to the Apache Software Foundation (ASF) under one
+@rem or more contributor license agreements. See the NOTICE file
+@rem distributed with this work for additional information
+@rem regarding copyright ownership. The ASF licenses this file
+@rem to you under the Apache License, Version 2.0 (the
+@rem "License"); you may not use this file except in compliance
+@rem with the License. You may obtain a copy of the License at
+@rem
+@rem http://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing,
+@rem software distributed under the License is distributed on an
+@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+@rem KIND, either express or implied. See the License for the
+@rem specific language governing permissions and limitations
+@rem under the License.
+
+@echo on
+
+set PYARROW_TEST_CYTHON=OFF
+set PYARROW_TEST_DATASET=ON
+set PYARROW_TEST_GANDIVA=OFF
+set PYARROW_TEST_HDFS=ON
+set PYARROW_TEST_ORC=OFF
+set PYARROW_TEST_PANDAS=ON
+set PYARROW_TEST_PARQUET=ON
+set PYARROW_TEST_PLASMA=OFF
+set PYARROW_TEST_S3=OFF
+set PYARROW_TEST_TENSORFLOW=ON
+set PYARROW_TEST_FLIGHT=ON
+
+set ARROW_TEST_DATA=C:\arrow\testing\data
+set PARQUET_TEST_DATA=C:\arrow\submodules\parquet-testing\data
+
+@REM Install the built wheels
+python -m pip install numpy
+python -m pip install --no-index --find-links=C:\arrow\python\dist\ pyarrow || exit /B
+
+@REM Test that the modules are importable
+python -c "import pyarrow"
+python -c "import pyarrow._hdfs"
+python -c "import pyarrow._s3fs"
+python -c "import pyarrow.csv"
+python -c "import pyarrow.dataset"
+python -c "import pyarrow.flight"
+python -c "import pyarrow.fs"
+python -c "import pyarrow.json"
+python -c "import pyarrow.parquet"
+
+@REM Install testing dependencies
+pip install -r C:\arrow\python\requirements-wheel-test.txt
+
+@REM Execute unittest
+pytest -r s --pyargs pyarrow
diff --git a/ci/vcpkg/ports.patch b/ci/vcpkg/ports.patch
new file mode 100644
index 0000000000..106bf723ed
--- /dev/null
+++ b/ci/vcpkg/ports.patch
@@ -0,0 +1,48 @@
+diff --git a/ports/curl/portfile.cmake b/ports/curl/portfile.cmake
+index 6e18aecd0..2ccecf33c 100644
+--- a/ports/curl/portfile.cmake
++++ b/ports/curl/portfile.cmake
+@@ -76,6 +76,8 @@ vcpkg_configure_cmake(
+ -DCMAKE_DISABLE_FIND_PACKAGE_Perl=ON
+ -DENABLE_DEBUG=ON
+ -DCURL_CA_FALLBACK=ON
++ -DCURL_CA_PATH=none
++ -DCURL_CA_BUNDLE=none
+ )
+
+ vcpkg_install_cmake()
+diff --git a/ports/snappy/portfile.cmake b/ports/snappy/portfile.cmake
+index 75dd13302..84345c7ca 100644
+--- a/ports/snappy/portfile.cmake
++++ b/ports/snappy/portfile.cmake
+@@ -4,6 +4,7 @@ vcpkg_from_github(
+ REF 537f4ad6240e586970fe554614542e9717df7902 # 1.1.8
+ SHA512 555d3b69a6759592736cbaae8f41654f0cf14e8be693b5dde37640191e53daec189f895872557b173e905d10681ef502f3e6ed8566811add963ffef96ce4016d
+ HEAD_REF master
++ PATCHES "snappy-disable-bmi.patch"
+ )
+
+ vcpkg_configure_cmake(
+diff --git a/ports/snappy/snappy-disable-bmi.patch b/ports/snappy/snappy-disable-bmi.patch
+new file mode 100644
+index 000000000..2cbb1533a
+--- /dev/null
++++ b/ports/snappy/snappy-disable-bmi.patch
+@@ -0,0 +1,17 @@
++--- snappy.cc 2020-06-27 17:38:49.718993748 -0500
+++++ snappy.cc 2020-06-27 17:37:57.543268213 -0500
++@@ -717,14 +717,10 @@
++ static inline uint32 ExtractLowBytes(uint32 v, int n) {
++ assert(n >= 0);
++ assert(n <= 4);
++-#if SNAPPY_HAVE_BMI2
++- return _bzhi_u32(v, 8 * n);
++-#else
++ // This needs to be wider than uint32 otherwise `mask << 32` will be
++ // undefined.
++ uint64 mask = 0xffffffff;
++ return v & ~(mask << (8 * n));
++-#endif
++ }
++
++ static inline bool LeftShiftOverflows(uint8 value, uint32 shift) {
diff --git a/ci/vcpkg/x64-linux-static-debug.cmake b/ci/vcpkg/x64-linux-static-debug.cmake
new file mode 100644
index 0000000000..3acee2ee46
--- /dev/null
+++ b/ci/vcpkg/x64-linux-static-debug.cmake
@@ -0,0 +1,24 @@
+# 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.
+
+set(VCPKG_TARGET_ARCHITECTURE x64)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+set(VCPKG_CMAKE_SYSTEM_NAME Linux)
+
+set(VCPKG_BUILD_TYPE debug)
diff --git a/ci/vcpkg/x64-linux-static-release.cmake b/ci/vcpkg/x64-linux-static-release.cmake
new file mode 100644
index 0000000000..c2caa49fa1
--- /dev/null
+++ b/ci/vcpkg/x64-linux-static-release.cmake
@@ -0,0 +1,24 @@
+# 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.
+
+set(VCPKG_TARGET_ARCHITECTURE x64)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+set(VCPKG_CMAKE_SYSTEM_NAME Linux)
+
+set(VCPKG_BUILD_TYPE release)
diff --git a/ci/vcpkg/x64-windows-static-md-debug.cmake b/ci/vcpkg/x64-windows-static-md-debug.cmake
new file mode 100644
index 0000000000..3eae3cfdaa
--- /dev/null
+++ b/ci/vcpkg/x64-windows-static-md-debug.cmake
@@ -0,0 +1,22 @@
+# 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.
+
+set(VCPKG_TARGET_ARCHITECTURE x64)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+set(VCPKG_BUILD_TYPE debug)
diff --git a/ci/vcpkg/x64-windows-static-md-release.cmake b/ci/vcpkg/x64-windows-static-md-release.cmake
new file mode 100644
index 0000000000..b8dfbc8848
--- /dev/null
+++ b/ci/vcpkg/x64-windows-static-md-release.cmake
@@ -0,0 +1,22 @@
+# 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.
+
+set(VCPKG_TARGET_ARCHITECTURE x64)
+set(VCPKG_CRT_LINKAGE dynamic)
+set(VCPKG_LIBRARY_LINKAGE static)
+
+set(VCPKG_BUILD_TYPE release)
diff --git a/dev/archery/archery/bot.py b/dev/archery/archery/bot.py
index d222d1ef37..d81be5ce18 100644
--- a/dev/archery/archery/bot.py
+++ b/dev/archery/archery/bot.py
@@ -244,7 +244,7 @@ def actions(ctx):
@actions.group()
[email protected]('--crossbow', '-c', default='ursa-labs/crossbow',
[email protected]('--crossbow', '-c', default='ursacomputing/crossbow',
help='Crossbow repository on github to use')
@click.pass_obj
def crossbow(obj, crossbow):
diff --git a/dev/archery/archery/cli.py b/dev/archery/archery/cli.py
index 827f4355c9..def4c9efe4 100644
--- a/dev/archery/archery/cli.py
+++ b/dev/archery/archery/cli.py
@@ -707,12 +707,32 @@ def trigger_bot(event_name, event_payload, arrow_token, crossbow_token):
bot.handle(event_name, event_payload)
+def _mock_compose_calls(compose):
+ from types import MethodType
+ from subprocess import CompletedProcess
+
+ def _mock(compose, executable):
+ def _execute(self, *args, **kwargs):
+ params = ['{}={}'.format(k, v)
+ for k, v in self.config.params.items()]
+ command = ' '.join(params + [executable] + list(args))
+ click.echo(command)
+ return CompletedProcess([], 0)
+ return MethodType(_execute, compose)
+
+ compose._execute_docker = _mock(compose, executable='docker')
+ compose._execute_compose = _mock(compose, executable='docker-compose')
+
+
@archery.group('docker')
@click.option("--src", metavar="<arrow_src>", default=None,
callback=validate_arrow_sources,
help="Specify Arrow source directory.")
[email protected]('--dry-run/--execute', default=False,
+ help="Display the docker-compose commands instead of executing "
+ "them.")
@click.pass_obj
-def docker_compose(obj, src):
+def docker_compose(obj, src, dry_run):
"""Interact with docker-compose based builds."""
from .docker import DockerCompose
@@ -725,7 +745,51 @@ def docker_compose(obj, src):
# take the docker-compose parameters like PYTHON, PANDAS, UBUNTU from the
# environment variables to keep the usage similar to docker-compose
- obj['compose'] = DockerCompose(config_path, params=os.environ)
+ compose = DockerCompose(config_path, params=os.environ)
+ if dry_run:
+ _mock_compose_calls(compose)
+ obj['compose'] = compose
+
+
+@docker_compose.command('build')
[email protected]('--force-pull/--no-pull', default=True,
+ help="Whether to force pull the image and its ancestor images")
[email protected]('--using-docker-cli', default=False, is_flag=True,
+ envvar='ARCHERY_USE_DOCKER_CLI',
+ help="Use docker CLI directly for building instead of calling "
+ "docker-compose. This may help to reuse cached layers.")
[email protected]('--use-cache/--no-cache', default=True,
+ help="Whether to use cache when building the image and its "
+ "ancestor images")
[email protected]('--use-leaf-cache/--no-leaf-cache', default=True,
+ help="Whether to use cache when building only the (leaf) image "
+ "passed as the argument. To disable caching for both the "
+ "image and its ancestors use --no-cache option.")
+def docker_compose_build(obj, image, *, force_pull, using_docker_cli,
+ use_cache, use_leaf_cache):
+ """
+ Execute docker-compose builds.
+ """
+ from .docker import UndefinedImage
+
+ compose = obj['compose']
+
+ try:
+ if force_pull:
+ compose.pull(image, pull_leaf=use_leaf_cache,
+ using_docker=using_docker_cli)
+ compose.build(image, use_cache=use_cache,
+ use_leaf_cache=use_leaf_cache,
+ using_docker=using_docker_cli)
+ except UndefinedImage as e:
+ raise click.ClickException(
+ "There is no service/image defined in docker-compose.yml with "
+ "name: {}".format(str(e))
+ )
+ except RuntimeError as e:
+ raise click.ClickException(str(e))
@docker_compose.command('run')
@@ -741,6 +805,10 @@ def docker_compose(obj, src):
help="Whether to force build the image and its ancestor images")
@click.option('--build-only', default=False, is_flag=True,
help="Pull and/or build the image, but do not run it")
[email protected]('--using-docker-cli', default=False, is_flag=True,
+ envvar='ARCHERY_USE_DOCKER_CLI',
+ help="Use docker CLI directly for building instead of calling "
+ "docker-compose. This may help to reuse cached layers.")
@click.option('--use-cache/--no-cache', default=True,
help="Whether to use cache when building the image and its "
"ancestor images")
@@ -748,15 +816,12 @@ def docker_compose(obj, src):
help="Whether to use cache when building only the (leaf) image "
"passed as the argument. To disable caching for both the "
"image and its ancestors use --no-cache option.")
[email protected]('--dry-run/--execute', default=False,
- help="Display the docker-compose commands instead of executing "
- "them.")
@click.option('--volume', '-v', multiple=True,
help="Set volume within the container")
@click.pass_obj
def docker_compose_run(obj, image, command, *, env, user, force_pull,
- force_build, build_only, use_cache, use_leaf_cache,
- dry_run, volume):
+ force_build, build_only, using_docker_cli, use_cache,
+ use_leaf_cache, volume):
"""Execute docker-compose builds.
To see the available builds run `archery docker images`.
@@ -791,28 +856,23 @@ def docker_compose_run(obj, image, command, *, env, user, force_pull,
compose = obj['compose']
- if dry_run:
- from types import MethodType
-
- def _print_command(self, *args, **kwargs):
- params = ['{}={}'.format(k, v) for k, v in self.params.items()]
- command = ' '.join(params + ['docker-compose'] + list(args))
- click.echo(command)
-
- compose._execute_compose = MethodType(_print_command, compose)
-
env = dict(kv.split('=', 1) for kv in env)
try:
+ if force_pull:
+ compose.pull(image, pull_leaf=use_leaf_cache,
+ using_docker=using_docker_cli)
+ if force_build:
+ compose.build(image, use_cache=use_cache,
+ use_leaf_cache=use_leaf_cache,
+ using_docker=using_docker_cli)
+ if build_only:
+ return
compose.run(
image,
command=command,
env=env,
user=user,
- force_pull=force_pull,
- force_build=force_build,
- build_only=build_only,
- use_cache=use_cache,
- use_leaf_cache=use_leaf_cache,
+ using_docker=using_docker_cli,
volumes=volume
)
except UndefinedImage as e:
@@ -826,16 +886,20 @@ def docker_compose_run(obj, image, command, *, env, user, force_pull,
@docker_compose.command('push')
@click.argument('image')
[email protected]('--user', '-u', required=True, envvar='ARCHERY_DOCKER_USER',
[email protected]('--user', '-u', required=False, envvar='ARCHERY_DOCKER_USER',
help='Docker repository username')
[email protected]('--password', '-p', required=True,
[email protected]('--password', '-p', required=False,
envvar='ARCHERY_DOCKER_PASSWORD',
help='Docker repository password')
[email protected]('--using-docker-cli', default=False, is_flag=True,
+ help="Use docker CLI directly for building instead of calling "
+ "docker-compose. This may help to reuse cached layers.")
@click.pass_obj
-def docker_compose_push(obj, image, user, password):
+def docker_compose_push(obj, image, user, password, using_docker_cli):
"""Push the generated docker-compose image."""
compose = obj['compose']
- compose.push(image, user=user, password=password)
+ compose.push(image, user=user, password=password,
+ using_docker=using_docker_cli)
@docker_compose.command('images')
diff --git a/dev/archery/archery/docker.py b/dev/archery/archery/docker.py
index 65fac3a124..e31ce69e21 100644
--- a/dev/archery/archery/docker.py
+++ b/dev/archery/archery/docker.py
@@ -47,39 +47,46 @@ class UndefinedImage(Exception):
pass
-class Docker(Command):
-
- def __init__(self, docker_bin=None):
- self.bin = default_bin(docker_bin, "docker")
+class ComposeConfig:
-
-class DockerCompose(Command):
-
- def __init__(self, config_path, dotenv_path=None, compose_bin=None,
- params=None):
- self.bin = default_bin(compose_bin, 'docker-compose')
-
- self.config_path = _ensure_path(config_path)
+ def __init__(self, config_path, dotenv_path, compose_bin, params=None):
+ config_path = _ensure_path(config_path)
if dotenv_path:
- self.dotenv_path = _ensure_path(dotenv_path)
+ dotenv_path = _ensure_path(dotenv_path)
+ else:
+ dotenv_path = config_path.parent / '.env'
+ self._read_env(dotenv_path, params)
+ self._read_config(config_path, compose_bin)
+
+ def _read_env(self, dotenv_path, params):
+ """
+ Read .env and merge it with explicitly passed parameters.
+ """
+ self.dotenv = dotenv_values(str(dotenv_path))
+ if params is None:
+ self.params = {}
else:
- self.dotenv_path = self.config_path.parent / '.env'
+ self.params = {k: v for k, v in params.items() if k in self.dotenv}
- self._read_env(params)
- self._read_config()
+ # forward the process' environment variables
+ self.env = os.environ.copy()
+ # set the defaults from the dotenv files
+ self.env.update(self.dotenv)
+ # override the defaults passed as parameters
+ self.env.update(self.params)
- def _read_config(self):
+ def _read_config(self, config_path, compose_bin):
"""
Validate and read the docker-compose.yml
"""
yaml = YAML()
- with self.config_path.open() as fp:
+ with config_path.open() as fp:
config = yaml.load(fp)
services = config['services'].keys()
- self.nodes = dict(flatten(config.get('x-hierarchy', {})))
+ self.hierarchy = dict(flatten(config.get('x-hierarchy', {})))
self.with_gpus = config.get('x-with-gpus', [])
- nodes = self.nodes.keys()
+ nodes = self.hierarchy.keys()
errors = []
for name in self.with_gpus:
@@ -100,13 +107,14 @@ class DockerCompose(Command):
)
# trigger docker-compose's own validation
- result = self._execute_compose('config', check=False,
- stderr=subprocess.PIPE,
- stdout=subprocess.PIPE)
+ compose = Command('docker-compose')
+ args = ['--file', str(config_path), 'config']
+ result = compose.run(*args, env=self.env, check=False,
+ stderr=subprocess.PIPE, stdout=subprocess.PIPE)
if result.returncode != 0:
# strip the intro line of docker-compose errors
- errors += result.stderr.decode().splitlines()[1:]
+ errors += result.stderr.decode().splitlines()
if errors:
msg = '\n'.join([' - {}'.format(msg) for msg in errors])
@@ -115,34 +123,48 @@ class DockerCompose(Command):
)
rendered_config = StringIO(result.stdout.decode())
+ self.path = config_path
self.config = yaml.load(rendered_config)
- def _read_env(self, params):
- """
- Read .env and merge it with explicitly passed parameters.
- """
- self.dotenv = dotenv_values(str(self.dotenv_path))
- if params is None:
- self.params = {}
- else:
- self.params = {k: v for k, v in params.items() if k in self.dotenv}
+ def get(self, service_name):
+ try:
+ service = self.config['services'][service_name]
+ except KeyError:
+ raise UndefinedImage(service_name)
+ service['name'] = service_name
+ service['need_gpu'] = service_name in self.with_gpus
+ service['ancestors'] = self.hierarchy[service_name]
+ return service
- # forward the process' environment variables
- self._compose_env = os.environ.copy()
- # set the defaults from the dotenv files
- self._compose_env.update(self.dotenv)
- # override the defaults passed as parameters
- self._compose_env.update(self.params)
+ def __getitem__(self, service_name):
+ return self.get(service_name)
+
+
+class Docker(Command):
+
+ def __init__(self, docker_bin=None):
+ self.bin = default_bin(docker_bin, "docker")
- def _validate_image(self, name):
- if name not in self.nodes:
- raise UndefinedImage(name)
+
+class DockerCompose(Command):
+
+ def __init__(self, config_path, dotenv_path=None, compose_bin=None,
+ params=None):
+ compose_bin = default_bin(compose_bin, 'docker-compose')
+ self.config = ComposeConfig(config_path, dotenv_path, compose_bin,
+ params)
+ self.bin = compose_bin
+ self.pull_memory = set()
+
+ def clear_pull_memory(self):
+ self.pull_memory = set()
def _execute_compose(self, *args, **kwargs):
# execute as a docker compose command
try:
- return super().run('--file', str(self.config_path), *args,
- env=self._compose_env, **kwargs)
+ result = super().run('--file', str(self.config.path), *args,
+ env=self.config.env, **kwargs)
+ result.check_returncode()
except subprocess.CalledProcessError as e:
def formatdict(d, template):
return '\n'.join(
@@ -158,15 +180,18 @@ class DockerCompose(Command):
msg.format(
cmd=' '.join(e.cmd),
code=e.returncode,
- dotenv=formatdict(self.dotenv, template=' {}: {}'),
- params=formatdict(self.params, template=' export {}={}')
+ dotenv=formatdict(self.config.dotenv, template=' {}: {}'),
+ params=formatdict(
+ self.config.params, template=' export {}={}'
+ )
)
)
def _execute_docker(self, *args, **kwargs):
# execute as a plain docker cli command
try:
- return Docker().run(*args, **kwargs)
+ result = Docker().run(*args, **kwargs)
+ result.check_returncode()
except subprocess.CalledProcessError as e:
raise RuntimeError(
"{} exited with non-zero exit code {}".format(
@@ -174,41 +199,75 @@ class DockerCompose(Command):
)
)
- def pull(self, image, pull_leaf=True):
- self._validate_image(image)
+ def pull(self, service_name, pull_leaf=True, using_docker=False):
+ def _pull(service):
+ args = ['pull']
+ if service['image'] in self.pull_memory:
+ return
+
+ if using_docker:
+ try:
+ self._execute_docker(*args, service['image'])
+ except Exception as e:
+ # better --ignore-pull-failures handling
+ print(e)
+ else:
+ args.append('--ignore-pull-failures')
+ self._execute_compose(*args, service['name'])
- for ancestor in self.nodes[image]:
- self._execute_compose('pull', '--ignore-pull-failures', ancestor)
+ self.pull_memory.add(service['image'])
+ service = self.config.get(service_name)
+ for ancestor in service['ancestors']:
+ _pull(self.config.get(ancestor))
if pull_leaf:
- self._execute_compose('pull', '--ignore-pull-failures', image)
+ _pull(service)
- def build(self, image, use_cache=True, use_leaf_cache=True):
- self._validate_image(image)
-
- for ancestor in self.nodes[image]:
+ def build(self, service_name, use_cache=True, use_leaf_cache=True,
+ using_docker=False):
+ def _build(service, use_cache):
+ args = ['build']
+ cache_from = list(service.get('build', {}).get('cache_from', []))
if use_cache:
- self._execute_compose('build', ancestor)
+ for image in cache_from:
+ if image not in self.pull_memory:
+ try:
+ self._execute_docker('pull', image)
+ except Exception as e:
+ print(e)
+ finally:
+ self.pull_memory.add(image)
else:
- self._execute_compose('build', '--no-cache', ancestor)
-
- if use_cache and use_leaf_cache:
- self._execute_compose('build', image)
- else:
- self._execute_compose('build', '--no-cache', image)
+ args.append('--no-cache')
+
+ if using_docker:
+ if 'build' not in service:
+ # nothing to do
+ return
+ # better for caching
+ for k, v in service['build'].get('args', {}).items():
+ args.extend(['--build-arg', '{}={}'.format(k, v)])
+ for img in cache_from:
+ args.append('--cache-from="{}"'.format(img))
+ args.extend([
+ '-f', service['build']['dockerfile'],
+ '-t', service['image'],
+ service['build'].get('context', '.')
+ ])
+ self._execute_docker(*args)
+ else:
+ self._execute_compose(*args, service['name'])
- def run(self, image, command=None, *, env=None, force_pull=False,
- force_build=False, use_cache=True, use_leaf_cache=True,
- volumes=None, build_only=False, user=None):
- self._validate_image(image)
+ service = self.config.get(service_name)
+ # build ancestor services
+ for ancestor in service['ancestors']:
+ _build(self.config.get(ancestor), use_cache=use_cache)
+ # build the leaf/target service
+ _build(service, use_cache=use_cache and use_leaf_cache)
- if force_pull:
- self.pull(image, pull_leaf=use_leaf_cache)
- if force_build:
- self.build(image, use_cache=use_cache,
- use_leaf_cache=use_leaf_cache)
- if build_only:
- return
+ def run(self, service_name, command=None, *, env=None, volumes=None,
+ user=None, using_docker=False):
+ service = self.config.get(service_name)
args = []
if user is not None:
@@ -222,58 +281,73 @@ class DockerCompose(Command):
for volume in volumes:
args.extend(['--volume', volume])
- if image in self.with_gpus:
- # rendered compose configuration for the image
- cc = self.config['services'][image]
-
+ if using_docker or service['need_gpu']:
# use gpus, requires docker>=19.03
- args.extend(['--gpus', 'all'])
+ if service['need_gpu']:
+ args.extend(['--gpus', 'all'])
+
+ if service.get('shm_size'):
+ args.extend(['--shm-size', service['shm_size']])
# append env variables from the compose conf
- for k, v in cc.get('environment', {}).items():
+ for k, v in service.get('environment', {}).items():
args.extend(['-e', '{}={}'.format(k, v)])
# append volumes from the compose conf
- for v in cc.get('volumes', []):
+ for v in service.get('volumes', []):
+ if not isinstance(v, str):
+ # if not the compact string volume definition
+ v = "{}:{}".format(v['source'], v['target'])
args.extend(['-v', v])
+ # infer whether an interactive shell is desired or not
+ if command in ['cmd.exe', 'bash', 'sh', 'powershell']:
+ args.append('-it')
+
# get the actual docker image name instead of the compose service
# name which we refer as image in general
- args.append(cc['image'])
+ args.append(service['image'])
# add command from compose if it wasn't overridden
if command is not None:
args.append(command)
else:
# replace whitespaces from the preformatted compose command
- cmd = shlex.split(cc.get('command', ''))
+ cmd = shlex.split(service.get('command', ''))
cmd = [re.sub(r"\s+", " ", token) for token in cmd]
if cmd:
args.extend(cmd)
# execute as a plain docker cli command
- return self._execute_docker('run', '--rm', '-it', *args)
+ self._execute_docker('run', '--rm', *args)
+ else:
+ # execute as a docker-compose command
+ args.append(service_name)
+ if command is not None:
+ args.append(command)
+ self._execute_compose('run', '--rm', *args)
- # execute as a docker-compose command
- args.append(image)
- if command is not None:
- args.append(command)
- self._execute_compose('run', '--rm', *args)
+ def push(self, service_name, user=None, password=None, using_docker=False):
+ def _push(service):
+ if using_docker:
+ return self._execute_docker('push', service['image'])
+ else:
+ return self._execute_compose('push', service['name'])
- def push(self, image, user, password):
- self._validate_image(image)
- try:
- # TODO(kszucs): have an option for a prompt
- Docker().run('login', '-u', user, '-p', password)
- except subprocess.CalledProcessError:
- # hide credentials
- msg = ('Failed to push `{}`, check the passed credentials'
- .format(image))
- raise RuntimeError(msg) from None
- else:
- for ancestor in self.nodes[image]:
- self._execute_compose('push', ancestor)
- self._execute_compose('push', image)
+ if user is not None:
+ try:
+ # TODO(kszucs): have an option for a prompt
+ self._execute_docker('login', '-u', user, '-p', password)
+ except subprocess.CalledProcessError:
+ # hide credentials
+ msg = ('Failed to push `{}`, check the passed credentials'
+ .format(service_name))
+ raise RuntimeError(msg) from None
+
+ service = self.config.get(service_name)
+ for ancestor in service['ancestors']:
+ _push(self.config.get(ancestor))
+ _push(service)
def images(self):
- return sorted(self.nodes.keys())
+ return sorted(self.config.hierarchy.keys())
diff --git a/dev/archery/archery/testing.py b/dev/archery/archery/testing.py
index a773e15603..471a54d4c7 100644
--- a/dev/archery/archery/testing.py
+++ b/dev/archery/archery/testing.py
@@ -55,6 +55,12 @@ def _ensure_mock_call_object(obj, **kwargs):
raise TypeError(obj)
+class SuccessfulSubprocessResult:
+
+ def check_returncode(self):
+ return
+
+
@contextmanager
def assert_subprocess_calls(expected_commands_or_calls, **kwargs):
calls = [
@@ -62,6 +68,7 @@ def assert_subprocess_calls(expected_commands_or_calls, **kwargs):
for obj in expected_commands_or_calls
]
with mock.patch('subprocess.run', autospec=True) as run:
+ run.return_value = SuccessfulSubprocessResult()
yield run
run.assert_has_calls(calls)
diff --git a/dev/archery/archery/tests/test_cli.py b/dev/archery/archery/tests/test_cli.py
index 61ef75ab28..d2f0355f09 100644
--- a/dev/archery/archery/tests/test_cli.py
+++ b/dev/archery/archery/tests/test_cli.py
@@ -17,124 +17,130 @@
from unittest.mock import patch
-import pytest
from click.testing import CliRunner
from archery.cli import archery
from archery.docker import DockerCompose
[email protected](('command', 'args', 'kwargs'), [
- (
- ['ubuntu-cpp', '--build-only'],
- ['ubuntu-cpp'],
- dict(
- command=None,
- env={},
- user=None,
- force_pull=True,
- force_build=True,
- build_only=True,
- use_cache=True,
- use_leaf_cache=True,
- volumes=()
- )
- ),
- (
- ['ubuntu-cpp', 'bash'],
- ['ubuntu-cpp'],
- dict(
- command='bash',
- env={},
- user=None,
- force_pull=True,
- force_build=True,
- build_only=False,
- use_cache=True,
- use_leaf_cache=True,
- volumes=()
- )
- ),
- (
- ['ubuntu-cpp', '--no-pull', '--no-build'],
- ['ubuntu-cpp'],
- dict(
- command=None,
- env={},
- user=None,
- force_pull=False,
- force_build=False,
- build_only=False,
- use_cache=True,
- use_leaf_cache=True,
- volumes=()
- )
- ),
- (
- [
- 'ubuntu-cpp', '--no-pull', '--force-build', '--user', 'me',
- '--no-cache', '--no-leaf-cache'
- ],
- ['ubuntu-cpp'],
- dict(
- command=None,
- env={},
- user='me',
- force_pull=False,
- force_build=True,
- build_only=False,
- use_cache=False,
- use_leaf_cache=False,
- volumes=()
- )
- ),
- (
- [
- '-e', 'ARROW_GANDIVA=OFF', '-e', 'ARROW_FLIGHT=ON', '-u', 'root',
- 'ubuntu-cpp'
- ],
- ['ubuntu-cpp'],
- dict(
- command=None,
- env={
- 'ARROW_GANDIVA': 'OFF',
- 'ARROW_FLIGHT': 'ON'
- },
- user='root',
- force_pull=True,
- force_build=True,
- build_only=False,
- use_cache=True,
- use_leaf_cache=True,
- volumes=()
- )
- ),
- (
- [
- '--volume', './build:/build', '-v', './ccache:/ccache:delegated',
- 'ubuntu-cpp'
- ],
- ['ubuntu-cpp'],
- dict(
- command=None,
- env={},
- user=None,
- force_pull=True,
- force_build=True,
- build_only=False,
- use_cache=True,
- use_leaf_cache=True,
- volumes=(
- './build:/build',
- './ccache:/ccache:delegated',
- )
- )
[email protected](DockerCompose, "pull")
[email protected](DockerCompose, "build")
[email protected](DockerCompose, "run")
+def test_docker_run_with_custom_command(run, build, pull):
+ # with custom command
+ args = ["docker", "run", "ubuntu-cpp", "bash"]
+ result = CliRunner().invoke(archery, args)
+ assert result.exit_code == 0
+ pull.assert_called_once_with(
+ "ubuntu-cpp", pull_leaf=True, using_docker=False
)
-])
-def test_docker_run(command, args, kwargs):
- runner = CliRunner()
+ build.assert_called_once_with(
+ "ubuntu-cpp", use_cache=True, use_leaf_cache=True, using_docker=False
+ )
+ run.assert_called_once_with(
+ "ubuntu-cpp",
+ command="bash",
+ env={},
+ user=None,
+ using_docker=False,
+ volumes=(),
+ )
+
- with patch.object(DockerCompose, 'run') as run:
- result = runner.invoke(archery, ['docker', 'run'] + command)
- assert result.exit_code == 0
- run.assert_called_once_with(*args, **kwargs)
[email protected](DockerCompose, "pull")
[email protected](DockerCompose, "build")
[email protected](DockerCompose, "run")
+def test_docker_run_options(run, build, pull):
+ # environment variables and volumes
+ args = [
+ "docker",
+ "run",
+ "-e",
+ "ARROW_GANDIVA=OFF",
+ "-e",
+ "ARROW_FLIGHT=ON",
+ "--volume",
+ "./build:/build",
+ "-v",
+ "./ccache:/ccache:delegated",
+ "-u",
+ "root",
+ "ubuntu-cpp",
+ ]
+ result = CliRunner().invoke(archery, args)
+ assert result.exit_code == 0
+ pull.assert_called_once_with(
+ "ubuntu-cpp", pull_leaf=True, using_docker=False
+ )
+ build.assert_called_once_with(
+ "ubuntu-cpp", use_cache=True, use_leaf_cache=True, using_docker=False
+ )
+ run.assert_called_once_with(
+ "ubuntu-cpp",
+ command=None,
+ env={"ARROW_GANDIVA": "OFF", "ARROW_FLIGHT": "ON"},
+ user="root",
+ using_docker=False,
+ volumes=(
+ "./build:/build",
+ "./ccache:/ccache:delegated",
+ ),
+ )
+
+
[email protected](DockerCompose, "run")
+def test_docker_run_without_pulling_or_building(run):
+ args = ["docker", "run", "--no-pull", "--no-build", "ubuntu-cpp"]
+ result = CliRunner().invoke(archery, args)
+ assert result.exit_code == 0
+ run.assert_called_once_with(
+ "ubuntu-cpp",
+ command=None,
+ env={},
+ user=None,
+ using_docker=False,
+ volumes=(),
+ )
+
+
[email protected](DockerCompose, "pull")
[email protected](DockerCompose, "build")
+def test_docker_run_only_pulling_and_building(build, pull):
+ args = ["docker", "run", "ubuntu-cpp", "--build-only"]
+ result = CliRunner().invoke(archery, args)
+ assert result.exit_code == 0
+ pull.assert_called_once_with(
+ "ubuntu-cpp", pull_leaf=True, using_docker=False
+ )
+ build.assert_called_once_with(
+ "ubuntu-cpp", use_cache=True, use_leaf_cache=True, using_docker=False
+ )
+
+
[email protected](DockerCompose, "build")
[email protected](DockerCompose, "run")
+def test_docker_run_without_build_cache(run, build):
+ args = [
+ "docker",
+ "run",
+ "--no-pull",
+ "--force-build",
+ "--user",
+ "me",
+ "--no-cache",
+ "--no-leaf-cache",
+ "ubuntu-cpp",
+ ]
+ result = CliRunner().invoke(archery, args)
+ assert result.exit_code == 0
+ build.assert_called_once_with(
+ "ubuntu-cpp", use_cache=False, use_leaf_cache=False, using_docker=False
+ )
+ run.assert_called_once_with(
+ "ubuntu-cpp",
+ command=None,
+ env={},
+ user="me",
+ using_docker=False,
+ volumes=(),
+ )
diff --git a/dev/archery/archery/tests/test_docker.py b/dev/archery/archery/tests/test_docker.py
index 2ed0c9dd94..cd8cfcf997 100644
--- a/dev/archery/archery/tests/test_docker.py
+++ b/dev/archery/archery/tests/test_docker.py
@@ -41,17 +41,17 @@ x-hierarchy:
services:
foo:
- image: dummy
+ image: org/foo
sub-sub-foo:
- image: dummy
+ image: org/sub-sub-foo
another-sub-sub-foo:
- image: dummy
+ image: org/another-sub-sub-foo
bar:
- image: dummy
+ image: org/bar
sub-bar:
- image: dummy
+ image: org/sub-bar
baz:
- image: dummy
+ image: org/baz
"""
missing_node_compose_yml = """
@@ -67,19 +67,19 @@ x-hierarchy:
services:
foo:
- image: dummy
+ image: org/foo
sub-foo:
- image: dummy
+ image: org/sub-foo
sub-sub-foo:
- image: dummy
+ image: org/sub-foo-foo
another-sub-sub-foo:
- image: dummy
+ image: org/another-sub-sub-foo
bar:
- image: dummy
+ image: org/bar
sub-bar:
- image: dummy
+ image: org/sub-bar
baz:
- image: dummy
+ image: org/baz
"""
ok_compose_yml = """
@@ -96,19 +96,19 @@ x-hierarchy:
services:
foo:
- image: dummy
+ image: org/foo
sub-foo:
- image: dummy
+ image: org/sub-foo
sub-sub-foo:
- image: dummy
+ image: org/sub-sub-foo
another-sub-sub-foo:
- image: dummy
+ image: org/another-sub-sub-foo
bar:
- image: dummy
+ image: org/bar
sub-bar:
- image: dummy
+ image: org/sub-bar
baz:
- image: dummy
+ image: org/baz
"""
arrow_compose_yml = """
@@ -130,23 +130,23 @@ x-hierarchy:
services:
conda-cpp:
- image: dummy
+ image: org/conda-cpp
conda-python:
- image: dummy
+ image: org/conda-python
conda-python-pandas:
- image: dummy
+ image: org/conda-python-pandas
conda-python-dask:
- image: dummy
+ image: org/conda-python-dask
ubuntu-cpp:
- image: dummy
+ image: org/ubuntu-cpp
ubuntu-cpp-cmake32:
- image: dummy
+ image: org/ubuntu-cpp-cmake32
ubuntu-c-glib:
- image: dummy
+ image: org/ubuntu-c-glib
ubuntu-ruby:
- image: dummy
+ image: org/ubuntu-ruby
ubuntu-cuda:
- image: dummy-cuda
+ image: org/ubuntu-cuda
environment:
CUDA_ENV: 1
OTHER_ENV: 2
@@ -217,7 +217,7 @@ def assert_docker_calls(compose, expected_args):
def assert_compose_calls(compose, expected_args, env=mock.ANY):
- base_command = ['docker-compose', '--file', str(compose.config_path)]
+ base_command = ['docker-compose', '--file', str(compose.config.path)]
expected_commands = []
for args in expected_args:
if isinstance(args, str):
@@ -235,8 +235,8 @@ def test_compose_default_params_and_env(arrow_compose_path):
UBUNTU='18.04',
DASK='master'
))
- assert compose.dotenv == arrow_compose_env
- assert compose.params == {
+ assert compose.config.dotenv == arrow_compose_env
+ assert compose.config.params == {
'UBUNTU': '18.04',
'DASK': 'master',
}
@@ -267,6 +267,7 @@ def test_compose_pull(arrow_compose_path):
"pull --ignore-pull-failures conda-cpp",
]
with assert_compose_calls(compose, expected_calls):
+ compose.clear_pull_memory()
compose.pull('conda-cpp')
expected_calls = [
@@ -275,6 +276,7 @@ def test_compose_pull(arrow_compose_path):
"pull --ignore-pull-failures conda-python-pandas"
]
with assert_compose_calls(compose, expected_calls):
+ compose.clear_pull_memory()
compose.pull('conda-python-pandas')
expected_calls = [
@@ -282,6 +284,7 @@ def test_compose_pull(arrow_compose_path):
"pull --ignore-pull-failures conda-python",
]
with assert_compose_calls(compose, expected_calls):
+ compose.clear_pull_memory()
compose.pull('conda-python-pandas', pull_leaf=False)
@@ -293,6 +296,7 @@ def test_compose_pull_params(arrow_compose_path):
compose = DockerCompose(arrow_compose_path, params=dict(UBUNTU='18.04'))
expected_env = PartialEnv(PYTHON='3.6', PANDAS='latest')
with assert_compose_calls(compose, expected_calls, env=expected_env):
+ compose.clear_pull_memory()
compose.pull('conda-python-pandas', pull_leaf=False)
@@ -419,57 +423,6 @@ def test_compose_run(arrow_compose_path):
compose.run('conda-python', volumes=volumes)
-def test_compose_run_force_pull_and_build(arrow_compose_path):
- compose = DockerCompose(arrow_compose_path)
-
- expected_calls = [
- "pull --ignore-pull-failures conda-cpp",
- format_run("conda-cpp")
- ]
- with assert_compose_calls(compose, expected_calls):
- compose.run('conda-cpp', force_pull=True)
-
- expected_calls = [
- "build conda-cpp",
- format_run("conda-cpp")
- ]
- with assert_compose_calls(compose, expected_calls):
- compose.run('conda-cpp', force_build=True)
-
- expected_calls = [
- "pull --ignore-pull-failures conda-cpp",
- "build conda-cpp",
- format_run("conda-cpp")
- ]
- with assert_compose_calls(compose, expected_calls):
- compose.run('conda-cpp', force_pull=True, force_build=True)
-
- expected_calls = [
- "pull --ignore-pull-failures conda-cpp",
- "pull --ignore-pull-failures conda-python",
- "pull --ignore-pull-failures conda-python-pandas",
- "build conda-cpp",
- "build conda-python",
- "build conda-python-pandas",
- format_run("conda-python-pandas bash")
- ]
- with assert_compose_calls(compose, expected_calls):
- compose.run('conda-python-pandas', command='bash', force_build=True,
- force_pull=True)
-
- expected_calls = [
- "pull --ignore-pull-failures conda-cpp",
- "pull --ignore-pull-failures conda-python",
- "build conda-cpp",
- "build conda-python",
- "build --no-cache conda-python-pandas",
- format_run("conda-python-pandas bash")
- ]
- with assert_compose_calls(compose, expected_calls):
- compose.run('conda-python-pandas', command='bash', force_build=True,
- force_pull=True, use_leaf_cache=False)
-
-
def test_compose_push(arrow_compose_path):
compose = DockerCompose(arrow_compose_path, params=dict(PYTHON='3.8'))
expected_env = PartialEnv(PYTHON="3.8")
@@ -478,7 +431,7 @@ def test_compose_push(arrow_compose_path):
]
for image in ["conda-cpp", "conda-python", "conda-python-pandas"]:
expected_calls.append(
- mock.call(["docker-compose", "--file", str(compose.config_path),
+ mock.call(["docker-compose", "--file", str(compose.config.path),
"push", image], check=True, env=expected_env)
)
with assert_subprocess_calls(expected_calls):
@@ -507,16 +460,16 @@ def test_image_with_gpu(arrow_compose_path):
expected_calls = [
[
- "run", "--rm", "-it", "--gpus", "all",
+ "run", "--rm", "--gpus", "all",
"-e", "CUDA_ENV=1",
"-e", "OTHER_ENV=2",
"-v", "/host:/container:rw",
- "dummy-cuda",
+ "org/ubuntu-cuda",
"/bin/bash", "-c", "echo 1 > /tmp/dummy && cat /tmp/dummy"
]
]
with assert_docker_calls(compose, expected_calls):
- compose.run('ubuntu-cuda', force_pull=False, force_build=False)
+ compose.run('ubuntu-cuda')
def test_listing_images(arrow_compose_path):
diff --git a/dev/archery/archery/utils/command.py b/dev/archery/archery/utils/command.py
index 2e27f08667..84d2842073 100644
--- a/dev/archery/archery/utils/command.py
+++ b/dev/archery/archery/utils/command.py
@@ -56,6 +56,9 @@ class Command:
property/attribute.
"""
+ def __init__(self, bin):
+ self.bin = bin
+
def run(self, *argv, **kwargs):
assert hasattr(self, "bin")
invocation = shlex.split(self.bin)
diff --git a/dev/archery/archery/utils/source.py b/dev/archery/archery/utils/source.py
index 305f8307a8..d30b4f152e 100644
--- a/dev/archery/archery/utils/source.py
+++ b/dev/archery/archery/utils/source.py
@@ -182,7 +182,10 @@ class ArrowSources:
cwd = Path.cwd()
# Implicit via current file
- this = Path(__file__).parents[4]
+ try:
+ this = Path(__file__).parents[4]
+ except IndexError:
+ this = None
# Implicit via git repository (if archery is installed system wide)
try:
diff --git a/dev/release/rat_exclude_files.txt b/dev/release/rat_exclude_files.txt
index 85ac2c2e43..9580e6706c 100644
--- a/dev/release/rat_exclude_files.txt
+++ b/dev/release/rat_exclude_files.txt
@@ -10,6 +10,7 @@
.github/ISSUE_TEMPLATE/question.md
ci/etc/rprofile
ci/etc/*.patch
+ci/vcpkg/*.patch
CHANGELOG.md
cpp/CHANGELOG_PARQUET.md
cpp/src/arrow/io/mman.h
diff --git a/dev/tasks/crossbow.py b/dev/tasks/crossbow.py
index a68794c3ac..60c0c5991d 100755
--- a/dev/tasks/crossbow.py
+++ b/dev/tasks/crossbow.py
@@ -1436,12 +1436,14 @@ def check_config(config_path):
@click.option('--arrow-sha', '-t', default=None,
help='Set commit SHA or Tag name explicitly, e.g. f67a515, '
'apache-arrow-0.11.1.')
[email protected]('--fetch/--no-fetch', default=True,
+ help='Fetch references (branches and tags) from the remote')
@click.option('--dry-run/--push', default=False,
help='Just display the rendered CI configurations without '
'submitting them')
@click.pass_obj
def submit(obj, tasks, groups, params, job_prefix, config_path, arrow_version,
- arrow_remote, arrow_branch, arrow_sha, dry_run):
+ arrow_remote, arrow_branch, arrow_sha, fetch, dry_run):
output = obj['output']
queue, arrow = obj['queue'], obj['arrow']
@@ -1469,7 +1471,8 @@ def submit(obj, tasks, groups, params, job_prefix, config_path, arrow_version,
if dry_run:
yaml.dump(job, output)
else:
- queue.fetch()
+ if fetch:
+ queue.fetch()
queue.put(job, prefix=job_prefix)
queue.push()
yaml.dump(job, output)
diff --git a/dev/tasks/python-wheels/azure.linux.yml b/dev/tasks/python-wheels/azure.linux.yml
deleted file mode 100644
index 279fca9658..0000000000
--- a/dev/tasks/python-wheels/azure.linux.yml
+++ /dev/null
@@ -1,109 +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.
-
-jobs:
-- job: linux
- pool:
- vmImage: ubuntu-latest
- timeoutInMinutes: 360
- steps:
- - task: CondaEnvironment@1
- inputs:
- packageSpecs: 'click github3.py jinja2 jira pygit2 ruamel.yaml setuptools_scm toolz'
- installOptions: '-c conda-forge'
- updateConda: false
-
- - script: |
- set -ex
- git clone --no-checkout {{ arrow.remote }} arrow
- git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }}
- git -C arrow checkout FETCH_HEAD
- git -C arrow submodule update --init --recursive
- displayName: Clone arrow
-
- - script: pip install -e arrow/dev/archery[docker]
- displayName: Setup Archery
-
- - script: |
- set -ex
- cd arrow
- BUILD_IMAGE=centos-python-{{ wheel_tag }}
- archery docker run \
- -e SETUPTOOLS_SCM_PRETEND_VERSION="{{ arrow.no_rc_version }}" \
- -e PYTHON_VERSION="{{ python_version }}" \
- -e UNICODE_WIDTH="{{ unicode_width }}" \
- ${BUILD_IMAGE}
- {% if arrow.branch == 'master' %}
- archery docker push ${BUILD_IMAGE} || :
- {% endif %}
- env:
- ARCHERY_DOCKER_USER: $(ARCHERY_DOCKER_USER)
- ARCHERY_DOCKER_PASSWORD: $(ARCHERY_DOCKER_PASSWORD)
- DOCKER_BUILDKIT: 0
- COMPOSE_DOCKER_CLI_BUILD: 1
- displayName: Build wheel
-
- # auditwheel does always exit with 0 so it is mostly for debugging
- # purposes
- - script: |
- set -ex
- cd arrow
- docker run \
- -v $(pwd):/arrow quay.io/pypa/{{ wheel_tag }}_x86_64 \
- /bin/bash -c \
- "auditwheel show /arrow/python/{{ wheel_dir }}/dist/*.whl"
- displayName: Audit wheel
-
- - script: |
- set -ex
- cd arrow
- test_args=""
- {%- if test_remove_system_libs %}
- test_args="${test_args} --remove-system-libs"
- {%- endif %}
- {%- for image in test_docker_images %}
- docker run \
- --shm-size 2G \
- -v $(pwd):/arrow \
- -e WHEEL_DIR="{{ wheel_dir }}" \
- {{ image }} \
- /arrow/dev/tasks/python-wheels/manylinux-test.sh ${test_args}
- {%- endfor %}
- displayName: Test wheel
-
- - script: |
- set -ex
- python arrow/dev/tasks/crossbow.py \
- --queue-path . \
- --queue-remote {{ queue_remote_url }} \
- upload-artifacts \
- --pattern "arrow/python/{{ wheel_dir }}/dist/*" \
- --sha {{ task.branch }} \
- --tag {{ task.tag }}
- env:
- CROSSBOW_GITHUB_TOKEN: $(CROSSBOW_GITHUB_TOKEN)
- displayName: Upload packages as a GitHub release
-
- {% if arrow.branch == 'master' %}
- # upload to gemfury
- - script: |
- path=$(ls arrow/python/{{ wheel_dir }}/dist/*.whl)
- curl -F "package=@${path}" https://${CROSSBOW_GEMFURY_TOKEN}@push.fury.io/${CROSSBOW_GEMFURY_ORG}/
- env:
- CROSSBOW_GEMFURY_TOKEN: $(CROSSBOW_GEMFURY_TOKEN)
- CROSSBOW_GEMFURY_ORG: $(CROSSBOW_GEMFURY_ORG)
- displayName: Upload packages to Gemfury
- {% endif %}
diff --git a/dev/tasks/python-wheels/github.linux.yml b/dev/tasks/python-wheels/github.linux.yml
new file mode 100644
index 0000000000..d7f01c720f
--- /dev/null
+++ b/dev/tasks/python-wheels/github.linux.yml
@@ -0,0 +1,109 @@
+# 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.
+
+# NOTE: must set "Crossbow" as name to have the badge links working in the
+# github comment reports!
+name: Crossbow
+
+on:
+ push:
+ branches:
+ - "*-github-*"
+
+jobs:
+ build:
+ name: "Build wheel for Manylinux {{ manylinux_version }}"
+ runs-on: ubuntu-latest
+ env:
+ # archery uses this environment variable
+ PYTHON: {{ python_version }}
+ # this is a private repository at the moment (mostly because of licensing
+ # consideration of windows images with visual studio), but anyone can
+ # recreate the image by manually building it via:
+ # `archery build python-wheel-manylinux-2010|2014`
+ # note that we don't run docker build since there wouldn't be a cache hit
+ # and rebuilding the dependencies takes a fair amount of time
+ # (in case of linux multi-host caching works much better with buildkit)
+ REPO: ghcr.io/ursacomputing/arrow
+ # prefer the docker cli over docker-compose
+ ARCHERY_USE_DOCKER_CLI: 1
+
+ steps:
+ ############################ Checkout ###################################
+ - name: Checkout Arrow
+ shell: bash
+ run: |
+ git clone --no-checkout {{ arrow.remote }} arrow
+ git -C arrow config core.symlinks true
+ git -C arrow fetch -t {{ arrow.remote }} {{ arrow.branch }}
+ git -C arrow checkout FETCH_HEAD
+ git -C arrow submodule update --init --recursive
+ - name: Fetch Submodules and Tags
+ shell: bash
+ run: cd arrow && ci/scripts/util_checkout.sh
+
+ ############################ Docker Registry ############################
+ - name: Login to GitHub Container Registry
+ uses: docker/login-action@v1
+ with:
+ registry: ghcr.io
+ username: {{ '${{ github.repository_owner }}' }}
+ password: {{ '${{ secrets.CROSSBOW_GHCR_TOKEN }}' }}
+
+ ############################ Archery Installation #######################
+ - name: Set up Python
+ uses: actions/setup-python@v2
+ with:
+ python-version: 3.8
+ - name: Install Archery and Crossbow dependencies
+ run: pip install -e arrow/dev/archery[all]
+
+ ############################ Build & Test ###############################
+ - name: Build wheel
+ shell: bash
+ run: archery docker run --no-build -e SETUPTOOLS_SCM_PRETEND_VERSION={{ arrow.no_rc_version }} python-wheel-manylinux-{{ manylinux_version }}
+ # TODO(kszucs): auditwheel show
+ - name: Test wheel
+ shell: bash
+ run: archery docker run python-wheel-manylinux-test
+
+ ############################ Artifact Uploading #########################
+ - name: Upload artifacts
+ shell: bash
+ run: |
+ python arrow/dev/tasks/crossbow.py \
+ --queue-path . \
+ --queue-remote {{ queue_remote_url }} \
+ upload-artifacts \
+ --pattern "arrow/python/repaired_wheels/*.whl" \
+ --sha {{ task.branch }} \
+ --tag {{ task.tag }}
+ env:
+ CROSSBOW_GITHUB_TOKEN: {{ '${{ secrets.CROSSBOW_GITHUB_TOKEN }}' }}
+
+ {% if arrow.branch == 'master' %}
+ - name: Upload to gemfury
+ shell: bash
+ run: |
+ WHEEL_PATH=$(echo wheels/*.whl)
+ curl.exe \
+ -F "package=@${WHEEL_PATH}" \
+ "https://${CROSSBOW_GEMFURY_TOKEN}@push.fury.io/${CROSSBOW_GEMFURY_ORG}/"
+ env:
+ CROSSBOW_GEMFURY_ORG: {{ '${{ secrets.CROSSBOW_GEMFURY_ORG }}' }}
+ CROSSBOW_GEMFURY_TOKEN: {{ '${{ secrets.CROSSBOW_GEMFURY_TOKEN }}' }}
+ {% endif %}
diff --git a/dev/tasks/python-wheels/github.win.yml b/dev/tasks/python-wheels/github.windows.yml
similarity index 58%
rename from dev/tasks/python-wheels/github.win.yml
rename to dev/tasks/python-wheels/github.windows.yml
index 422643251e..f09c357c13 100644
--- a/dev/tasks/python-wheels/github.win.yml
+++ b/dev/tasks/python-wheels/github.windows.yml
@@ -27,13 +27,22 @@ on:
jobs:
build:
name: "Build wheel for Windows"
- runs-on: windows-2016
+ runs-on: windows-2019
env:
- ARCH: "x64"
- GENERATOR: Visual Studio 15 2017
- PYTHON_VERSION: "{{ python_version }}"
- PYARROW_VERSION: {{ arrow.no_rc_version }}
+ # archery uses this environment variable
+ PYTHON: {{ python_version }}
+ # this is a private repository at the moment (mostly because of licensing
+ # consideration of windows images with visual studio), but anyone can
+ # recreate the image by manually building it via:
+ # `archery build python-wheel-windows-vs2017`
+ # note that we don't run docker build since there wouldn't be a cache hit
+ # and rebuilding the dependencies takes a fair amount of time
+ REPO: ghcr.io/ursacomputing/arrow
+ # prefer the docker cli over docker-compose
+ ARCHERY_USE_DOCKER_CLI: 1
+
steps:
+ ############################ Checkout ###################################
- name: Checkout Arrow
shell: bash
run: |
@@ -45,27 +54,47 @@ jobs:
- name: Fetch Submodules and Tags
shell: bash
run: cd arrow && ci/scripts/util_checkout.sh
- - uses: actions/setup-python@v2
+
+ ############################ Docker Registry ############################
+ - name: Login to GitHub Container Registry
+ shell: bash
+ run: docker login ghcr.io -u {{ '${{ github.repository_owner }}' }} -p {{ '${{ secrets.CROSSBOW_GHCR_TOKEN }}' }}
+
+ ############################ Archery Installation #######################
+ - name: Set up Python
+ uses: actions/setup-python@v2
with:
- python-version: "{{ python_version }}"
- - name: Set up Miniconda
+ python-version: 3.8
+ - name: Install Archery and Crossbow dependencies
shell: bash
- run: |
- echo "c:\\Miniconda\\condabin" >> $GITHUB_PATH
+ run: pip install -e arrow/dev/archery[all]
+
+ ############################ Build & Test ###############################
- name: Build wheel
+ shell: cmd
+ run: archery docker run --no-build -e SETUPTOOLS_SCM_PRETEND_VERSION={{ arrow.no_rc_version }} python-wheel-windows-vs2017
+ - name: Test wheel
+ shell: cmd
+ run: archery docker run python-wheel-windows-test
+
+ ############################ Artifact Uploading #########################
+ - name: Upload artifacts
shell: bash
run: |
- arrow/dev/tasks/python-wheels/win-build.bat
- - name: Prepare artifacts
- # the artifacts must be uploaded from a directory relative to the build root
- shell: bash
- run: |
- mv arrow/python/dist/ wheels/
+ python arrow/dev/tasks/crossbow.py \
+ --queue-path . \
+ --queue-remote {{ queue_remote_url }} \
+ upload-artifacts \
+ --pattern "arrow/python/dist/*.whl" \
+ --sha {{ task.branch }} \
+ --tag {{ task.tag }}
+ env:
+ CROSSBOW_GITHUB_TOKEN: {{ '${{ secrets.CROSSBOW_GITHUB_TOKEN }}' }}
+
{% if arrow.branch == 'master' %}
- name: Upload to gemfury
shell: bash
run: |
- conda.bat install -y curl
WHEEL_PATH=$(echo wheels/*.whl)
curl.exe \
-F "package=@${WHEEL_PATH}" \
@@ -74,19 +103,3 @@ jobs:
CROSSBOW_GEMFURY_ORG: {{ '${{ secrets.CROSSBOW_GEMFURY_ORG }}' }}
CROSSBOW_GEMFURY_TOKEN: {{ '${{ secrets.CROSSBOW_GEMFURY_TOKEN }}' }}
{% endif %}
- - name: Set up Crossbow
- shell: bash
- run: |
- pip install --requirement arrow/dev/tasks/requirements-crossbow.txt
- - name: Upload artifacts
- shell: bash
- run: |
- python arrow/dev/tasks/crossbow.py \
- --queue-path . \
- --queue-remote {{ queue_remote_url }} \
- upload-artifacts \
- --pattern "wheels/*.whl" \
- --sha {{ task.branch }} \
- --tag {{ task.tag }}
- env:
- CROSSBOW_GITHUB_TOKEN: {{ '${{ secrets.CROSSBOW_GITHUB_TOKEN }}' }}
diff --git a/dev/tasks/python-wheels/osx-build.sh b/dev/tasks/python-wheels/osx-build.sh
index e6bd6159de..176b8b3ce5 100755
--- a/dev/tasks/python-wheels/osx-build.sh
+++ b/dev/tasks/python-wheels/osx-build.sh
@@ -71,6 +71,7 @@ function build_wheel {
-DARROW_GRPC_USE_SHARED=OFF \
-DARROW_HDFS=ON \
-DARROW_JEMALLOC=ON \
+ -DARROW_MIMALLOC=ON \
-DARROW_OPENSSL_USE_SHARED=OFF \
-DARROW_ORC=OFF \
-DARROW_PARQUET=ON \
diff --git a/dev/tasks/python-wheels/win-build.bat b/dev/tasks/python-wheels/win-build.bat
deleted file mode 100644
index f2ca57d8cf..0000000000
--- a/dev/tasks/python-wheels/win-build.bat
+++ /dev/null
@@ -1,116 +0,0 @@
-@rem Licensed to the Apache Software Foundation (ASF) under one
-@rem or more contributor license agreements. See the NOTICE file
-@rem distributed with this work for additional information
-@rem regarding copyright ownership. The ASF licenses this file
-@rem to you under the Apache License, Version 2.0 (the
-@rem "License"); you may not use this file except in compliance
-@rem with the License. You may obtain a copy of the License at
-@rem
-@rem http://www.apache.org/licenses/LICENSE-2.0
-@rem
-@rem Unless required by applicable law or agreed to in writing,
-@rem software distributed under the License is distributed on an
-@rem "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
-@rem KIND, either express or implied. See the License for the
-@rem specific language governing permissions and limitations
-@rem under the License.
-
-@echo on
-
-@rem Building Gandiva in the wheels is disabled for now to make the wheels
-@rem smaller.
-
-@rem --file=arrow\ci\conda_env_gandiva.yml ^
-
-@rem create conda environment for compiling
-@rem FIXME: Update to numpy 1.16.6
-call conda.bat create -n wheel-build -q -y -c conda-forge ^
- cmake ninja pkg-config numpy=1.16.5 ^
- "vs2015_runtime<14.16" ^
- python=%PYTHON_VERSION% || exit /B
-
-call conda.bat activate wheel-build
-python -m pip install cython setuptools-scm
-
-set ARROW_HOME=%CONDA_PREFIX%\Library
-set PARQUET_HOME=%CONDA_PREFIX%\Library
-echo %ARROW_HOME%
-
-@rem Build Arrow C++ libraries
-mkdir arrow\cpp\build
-pushd arrow\cpp\build
-
-@rem ARROW-6938(wesm): bz2 is disabled on Windows because the build
-@rem currently selects the shared lib for linking. Using the zstd lib from
-@rem conda-forge also results in a broken build so we use the BUNDLED
-@rem dependency resolution strategy for now
-
-cmake -A "%ARCH%" ^
- -G "%GENERATOR%" ^
- -DARROW_BUILD_STATIC=OFF ^
- -DARROW_BUILD_TESTS=OFF ^
- -DARROW_CXXFLAGS="/MP" ^
- -DARROW_DATASET=ON ^
- -DARROW_DEPENDENCY_SOURCE=BUNDLED ^
- -DARROW_DEPENDENCY_USE_SHARED=OFF ^
- -DARROW_FLIGHT=ON ^
- -DARROW_GANDIVA=OFF ^
- -DARROW_MIMALLOC=ON ^
- -DARROW_PARQUET=ON ^
- -DARROW_PYTHON=ON ^
- -DARROW_VERBOSE_THIRDPARTY_BUILD=ON ^
- -DARROW_WITH_BROTLI=ON ^
- -DARROW_WITH_BZ2=OFF ^
- -DARROW_WITH_LZ4=ON ^
- -DARROW_WITH_SNAPPY=ON ^
- -DARROW_WITH_ZLIB=ON ^
- -DARROW_WITH_ZSTD=ON ^
- -DCMAKE_BUILD_TYPE=Release ^
- -DCMAKE_INSTALL_PREFIX=%ARROW_HOME% ^
- -DCMAKE_VERBOSE_MAKEFILE=ON ^
- -DMSVC_LINK_VERBOSE=ON ^
- .. || exit /B
-cmake ^
- --build . ^
- --config Release ^
- --parallel %NUMBER_OF_PROCESSORS% ^
- --target install || exit /B
-popd
-
-set PYARROW_BUILD_TYPE=Release
-set PYARROW_BUNDLE_ARROW_CPP=1
-set PYARROW_CMAKE_GENERATOR=%GENERATOR%
-set PYARROW_CMAKE_OPTIONS=-A %ARCH%
-set PYARROW_INSTALL_TESTS=1
-set PYARROW_PARALLEL=%NUMBER_OF_PROCESSORS%
-set PYARROW_WITH_DATASET=1
-set PYARROW_WITH_FLIGHT=1
-set PYARROW_WITH_GANDIVA=0
-set PYARROW_WITH_PARQUET=1
-set PYARROW_WITH_STATIC_BOOST=1
-set SETUPTOOLS_SCM_PRETEND_VERSION=%PYARROW_VERSION%
-
-pushd arrow\python
-python setup.py bdist_wheel || exit /B
-popd
-
-call conda.bat deactivate
-
-set ARROW_TEST_DATA=arrow\testing\data
-
-@rem install the test dependencies
-python -m pip install -r arrow\python\requirements-wheel-test.txt || exit /B
-
-@rem install the produced wheel in a non-conda environment
-python -m pip install --no-index --find-links=arrow\python\dist\ pyarrow || exit /B
-
-@rem test the imports
-python -c "import pyarrow" || exit /B
-python -c "import pyarrow.parquet" || exit /B
-python -c "import pyarrow.flight" || exit /B
-python -c "import pyarrow.dataset" || exit /B
-
-@rem run the python tests, but disable the cython because there is a linking
-@rem issue on python 3.8
-set PYARROW_TEST_CYTHON=OFF
-python -m pytest -rs --pyargs pyarrow || exit /B
diff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.yml
index f19e0a483b..10b79db749 100644
--- a/dev/tasks/tasks.yml
+++ b/dev/tasks/tasks.yml
@@ -342,171 +342,75 @@ tasks:
############################## Wheel Linux ##################################
- wheel-manylinux1-cp36m:
- ci: azure
- template: python-wheels/azure.linux.yml
- params:
- python_version: 3.6
- unicode_width: 16
- wheel_tag: manylinux1
- wheel_dir: manylinux1
- test_docker_images:
- - python:3.6
- test_remove_system_libs: true
- artifacts:
- - pyarrow-{no_rc_version}-cp36-cp36m-manylinux1_x86_64.whl
-
- wheel-manylinux1-cp37m:
- ci: azure
- template: python-wheels/azure.linux.yml
- params:
- python_version: 3.7
- unicode_width: 16
- wheel_tag: manylinux1
- wheel_dir: manylinux1
- test_docker_images:
- - python:3.7
- test_remove_system_libs: true
- artifacts:
- - pyarrow-{no_rc_version}-cp37-cp37m-manylinux1_x86_64.whl
-
- wheel-manylinux1-cp38:
- ci: azure
- template: python-wheels/azure.linux.yml
- params:
- python_version: 3.8
- unicode_width: 16
- wheel_tag: manylinux1
- wheel_dir: manylinux1
- test_docker_images:
- - python:3.8
- test_remove_system_libs: true
- artifacts:
- - pyarrow-{no_rc_version}-cp38-cp38-manylinux1_x86_64.whl
-
- wheel-manylinux1-cp39:
- ci: azure
- template: python-wheels/azure.linux.yml
- params:
- python_version: 3.9
- unicode_width: 16
- wheel_tag: manylinux1
- wheel_dir: manylinux1
- test_docker_images:
- - python:3.9
- test_remove_system_libs: true
- artifacts:
- - pyarrow-{no_rc_version}-cp39-cp39-manylinux1_x86_64.whl
-
wheel-manylinux2010-cp36m:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.6
- unicode_width: 16
- wheel_tag: manylinux2010
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.6
- test_remove_system_libs: true
+ manylinux_version: 2010
artifacts:
- pyarrow-{no_rc_version}-cp36-cp36m-manylinux2010_x86_64.whl
wheel-manylinux2010-cp37m:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.7
- unicode_width: 16
- wheel_tag: manylinux2010
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.7
- test_remove_system_libs: true
+ manylinux_version: 2010
artifacts:
- pyarrow-{no_rc_version}-cp37-cp37m-manylinux2010_x86_64.whl
wheel-manylinux2010-cp38:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.8
- unicode_width: 16
- wheel_tag: manylinux2010
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.8
- test_remove_system_libs: true
+ manylinux_version: 2010
artifacts:
- pyarrow-{no_rc_version}-cp38-cp38-manylinux2010_x86_64.whl
wheel-manylinux2010-cp39:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.9
- unicode_width: 16
- wheel_tag: manylinux2010
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.9
- test_remove_system_libs: true
+ manylinux_version: 2010
artifacts:
- pyarrow-{no_rc_version}-cp39-cp39-manylinux2010_x86_64.whl
wheel-manylinux2014-cp36m:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.6
- unicode_width: 16
- wheel_tag: manylinux2014
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.6
- test_remove_system_libs: true
+ manylinux_version: 2014
artifacts:
- pyarrow-{no_rc_version}-cp36-cp36m-manylinux2014_x86_64.whl
wheel-manylinux2014-cp37m:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.7
- unicode_width: 16
- wheel_tag: manylinux2014
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.7
- test_remove_system_libs: true
+ manylinux_version: 2014
artifacts:
- pyarrow-{no_rc_version}-cp37-cp37m-manylinux2014_x86_64.whl
wheel-manylinux2014-cp38:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.8
- unicode_width: 16
- wheel_tag: manylinux2014
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.8
- test_remove_system_libs: true
+ manylinux_version: 2014
artifacts:
- pyarrow-{no_rc_version}-cp38-cp38-manylinux2014_x86_64.whl
wheel-manylinux2014-cp39:
- ci: azure
- template: python-wheels/azure.linux.yml
+ ci: github
+ template: python-wheels/github.linux.yml
params:
python_version: 3.9
- unicode_width: 16
- wheel_tag: manylinux2014
- wheel_dir: manylinux201x
- test_docker_images:
- - python:3.9
- test_remove_system_libs: true
+ manylinux_version: 2014
artifacts:
- pyarrow-{no_rc_version}-cp39-cp39-manylinux2014_x86_64.whl
@@ -596,30 +500,38 @@ tasks:
############################## Wheel Windows ################################
- wheel-win-cp36m:
+ wheel-windows-cp36m:
ci: github
- template: python-wheels/github.win.yml
+ template: python-wheels/github.windows.yml
params:
python_version: 3.6
artifacts:
- pyarrow-{no_rc_version}-cp36-cp36m-win_amd64.whl
- wheel-win-cp37m:
+ wheel-windows-cp37m:
ci: github
- template: python-wheels/github.win.yml
+ template: python-wheels/github.windows.yml
params:
python_version: 3.7
artifacts:
- pyarrow-{no_rc_version}-cp37-cp37m-win_amd64.whl
- wheel-win-cp38:
+ wheel-windows-cp38:
ci: github
- template: python-wheels/github.win.yml
+ template: python-wheels/github.windows.yml
params:
python_version: 3.8
artifacts:
- pyarrow-{no_rc_version}-cp38-cp38-win_amd64.whl
+ wheel-windows-cp39:
+ ci: github
+ template: python-wheels/github.windows.yml
+ params:
+ python_version: 3.9
+ artifacts:
+ - pyarrow-{no_rc_version}-cp39-cp39-win_amd64.whl
+
############################ Python sdist ####################################
python-sdist:
@@ -1770,7 +1682,7 @@ tasks:
template: r/github.linux.cran.yml
params:
MATRIX: "${{ matrix.r_image }}"
-
+
test-r-version-compatibility:
ci: github
template: r/github.linux.version.compatibility.yml
diff --git a/docker-compose.yml b/docker-compose.yml
index a7c4915335..b66619d32f 100644
--- a/docker-compose.yml
+++ b/docker-compose.yml
@@ -79,9 +79,6 @@ x-hierarchy:
# Each node must be either a string scalar of a list containing the
# descendant images if any. Archery checks that all node has a corresponding
# service entry, so any new image/service must be listed here.
- - centos-python-manylinux1
- - centos-python-manylinux2010
- - centos-python-manylinux2014
- conda-cpp:
- conda-cpp-hiveserver2
- conda-cpp-valgrind
@@ -122,6 +119,31 @@ x-hierarchy:
# helper services
- impala
- postgres
+ - python-wheel-manylinux-2010
+ - python-wheel-manylinux-2014
+ - python-wheel-manylinux-test
+ - python-wheel-windows-vs2017
+ - python-wheel-windows-test
+
+volumes:
+ conda-ccache:
+ name: ${ARCH}-conda-ccache
+ debian-ccache:
+ name: ${ARCH}-debian-${DEBIAN}-ccache
+ ubuntu-ccache:
+ name: ${ARCH}-ubuntu-${UBUNTU}-ccache
+ fedora-ccache:
+ name: ${ARCH}-fedora-${FEDORA}-ccache
+ debian-rust:
+ name: ${ARCH}-debian-${DEBIAN}-rust
+ maven-cache:
+ name: maven-cache
+ python-wheel-manylinux2010-ccache:
+ name: python-wheel-manylinux2010-ccache
+ python-wheel-manylinux2014-ccache:
+ name: python-wheel-manylinux2014-ccache
+ python-wheel-windows-clcache:
+ name: python-wheel-windows-clcache
services:
@@ -169,7 +191,7 @@ services:
ARROW_USE_PRECOMPILED_HEADERS: "ON"
volumes: &conda-volumes
- .:/arrow:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-conda-ccache:/ccache:delegated
+ - ${DOCKER_VOLUME_PREFIX}conda-ccache:/ccache:delegated
command: &cpp-conda-command
["/arrow/ci/scripts/cpp_build.sh /arrow /build true &&
/arrow/ci/scripts/cpp_test.sh /arrow /build"]
@@ -229,7 +251,7 @@ services:
ARROW_MIMALLOC: "ON"
volumes: &debian-volumes
- .:/arrow:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-debian-${DEBIAN}-ccache:/ccache:delegated
+ - ${DOCKER_VOLUME_PREFIX}debian-ccache:/ccache:delegated
command: &cpp-command >
/bin/bash -c "
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
@@ -261,7 +283,7 @@ services:
ARROW_MIMALLOC: "ON"
volumes: &ubuntu-volumes
- .:/arrow:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-ubuntu-${UBUNTU}-ccache:/ccache:delegated
+ - ${DOCKER_VOLUME_PREFIX}ubuntu-ccache:/ccache:delegated
command: *cpp-command
ubuntu-cuda-cpp:
@@ -352,7 +374,7 @@ services:
ARROW_MIMALLOC: "ON"
volumes: &fedora-volumes
- .:/arrow:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-fedora-${FEDORA}-ccache:/ccache:delegated
+ - ${DOCKER_VOLUME_PREFIX}fedora-ccache:/ccache:delegated
command: *cpp-command
############################### C GLib ######################################
@@ -637,6 +659,85 @@ services:
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
/arrow/ci/scripts/python_sdist_test.sh /arrow"
+ ############################ Python wheels ##################################
+
+ # See available versions at:
+ # https://quay.io/repository/pypa/manylinux2010_x86_64?tab=tags
+ python-wheel-manylinux-2010:
+ image: ${REPO}:python-${PYTHON}-wheel-manylinux-2010
+ build:
+ args:
+ base: quay.io/pypa/manylinux2010_x86_64:2020-12-03-912b0de
+ vcpkg: ${VCPKG}
+ python: ${PYTHON}
+ context: .
+ dockerfile: ci/docker/python-wheel-manylinux-201x.dockerfile
+ cache_from:
+ - ${REPO}:python-${PYTHON}-wheel-manylinux-2010
+ environment:
+ <<: *ccache
+ MANYLINUX_VERSION: 2010
+ volumes:
+ - .:/arrow:delegated
+ - ${DOCKER_VOLUME_PREFIX}python-wheel-manylinux2010-ccache:/ccache:delegated
+ command: /arrow/ci/scripts/python_wheel_manylinux_build.sh
+
+ # See available versions at:
+ # https://quay.io/repository/pypa/manylinux2014_x86_64?tab=tags
+ python-wheel-manylinux-2014:
+ image: ${REPO}:python-${PYTHON}-wheel-manylinux-2014
+ build:
+ args:
+ base: quay.io/pypa/manylinux2014_x86_64:2020-11-11-bc8ce45
+ vcpkg: ${VCPKG}
+ python: ${PYTHON}
+ context: .
+ dockerfile: ci/docker/python-wheel-manylinux-201x.dockerfile
+ cache_from:
+ - ${REPO}:python-${PYTHON}-wheel-manylinux-2014
+ environment:
+ <<: *ccache
+ MANYLINUX_VERSION: 2014
+ volumes:
+ - .:/arrow:delegated
+ - ${DOCKER_VOLUME_PREFIX}python-wheel-manylinux2014-ccache:/ccache:delegated
+ command: /arrow/ci/scripts/python_wheel_manylinux_build.sh
+
+ python-wheel-manylinux-test:
+ image: python:${PYTHON}
+ shm_size: 2G
+ volumes:
+ - .:/arrow:delegated
+ command: /arrow/ci/scripts/python_wheel_manylinux_test.sh
+
+ python-wheel-windows-vs2017:
+ image: ${REPO}:python-${PYTHON}-wheel-windows-vs2017
+ build:
+ args:
+ vcpkg: ${VCPKG}
+ python: ${PYTHON}
+ context: .
+ dockerfile: ci/docker/python-wheel-windows-vs2017.dockerfile
+ # This should make the pushed images reusable, but the image gets rebuilt.
+ # Uncomment if no local cache is available.
+ # cache_from:
+ # - mcr.microsoft.com/windows/servercore:ltsc2019
+ # - ${REPO}:wheel-windows-vs2017
+ volumes:
+ - "${DOCKER_VOLUME_PREFIX}python-wheel-windows-clcache:C:/clcache"
+ - type: bind
+ source: .
+ target: "C:/arrow"
+ command: arrow\\ci\\scripts\\python_wheel_windows_build.bat
+
+ python-wheel-windows-test:
+ image: python:${PYTHON}-windowsservercore-1809
+ volumes:
+ - type: bind
+ source: .
+ target: "C:/arrow"
+ command: arrow\\ci\\scripts\\python_wheel_windows_test.bat
+
############################## Integration #################################
conda-python-pandas:
@@ -785,68 +886,6 @@ services:
/arrow/ci/scripts/python_build.sh /arrow /build &&
/arrow/ci/scripts/integration_kartothek.sh /kartothek /build"]
- ########################## Python Wheels ####################################
-
- centos-python-manylinux1:
- image: ${REPO}:amd64-centos-5.11-python-manylinux1
- build:
- context: python/manylinux1
- dockerfile: Dockerfile-x86_64_base
- cache_from:
- - ${REPO}:amd64-centos-5.11-python-manylinux1
- args:
- llvm: ${LLVM}
- shm_size: *shm-size
- environment:
- <<: *ccache
- PYTHON_VERSION: ${PYTHON_VERSION:-3.6}
- UNICODE_WIDTH: ${UNICODE_WIDTH:-16}
- volumes:
- - .:/arrow:delegated
- - ./python/manylinux1:/io:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/centos-python-manylinux1-ccache:/ccache:delegated
- command: &manylinux-command /io/build_arrow.sh
-
- centos-python-manylinux2010:
- image: ${REPO}:amd64-centos-6.10-python-manylinux2010
- build:
- context: python/manylinux201x
- dockerfile: Dockerfile-x86_64_base_2010
- cache_from:
- - ${REPO}:amd64-centos-6.10-python-manylinux2010
- args:
- llvm: ${LLVM}
- shm_size: *shm-size
- environment:
- <<: *ccache
- PYTHON_VERSION: ${PYTHON_VERSION:-3.6}
- UNICODE_WIDTH: ${UNICODE_WIDTH:-16}
- volumes:
- - .:/arrow:delegated
- - ./python/manylinux201x:/io:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/centos-python-manylinux2010-ccache:/ccache:delegated
- command: *manylinux-command
-
- centos-python-manylinux2014:
- image: ${REPO}:amd64-centos-7.7-python-manylinux2014
- build:
- context: python/manylinux201x
- dockerfile: Dockerfile-x86_64_base_2014
- cache_from:
- - ${REPO}:amd64-centos-7.7-python-manylinux2014
- args:
- llvm: ${LLVM}
- shm_size: *shm-size
- environment:
- <<: *ccache
- PYTHON_VERSION: ${PYTHON_VERSION:-3.6}
- UNICODE_WIDTH: ${UNICODE_WIDTH:-16}
- volumes:
- - .:/arrow:delegated
- - ./python/manylinux201x:/io:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/centos-python-manylinux2014-ccache:/ccache:delegated
- command: *manylinux-command
-
################################## R ########################################
ubuntu-r:
@@ -1017,7 +1056,7 @@ services:
shm_size: *shm-size
volumes: &java-volumes
- .:/arrow:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/maven-cache:/root/.m2:delegated
+ - ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated
command: &java-command >
/bin/bash -c "
/arrow/ci/scripts/java_build.sh /arrow /build &&
@@ -1043,8 +1082,8 @@ services:
<<: *ccache
volumes:
- .:/arrow:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/maven-cache:/root/.m2:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-debian-9-ccache:/ccache:delegated
+ - ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated
+ - ${DOCKER_VOLUME_PREFIX}debian-ccache:/ccache:delegated
command:
/bin/bash -c "
/arrow/ci/scripts/cpp_build.sh /arrow /build &&
@@ -1232,8 +1271,8 @@ services:
shm_size: *shm-size
volumes: &conda-maven-volumes
- .:/arrow:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/maven-cache:/root/.m2:delegated
- - ${DOCKER_VOLUME_DIRECTORY:-.docker}/${ARCH}-conda-ccache:/ccache:delegated
+ - ${DOCKER_VOLUME_PREFIX}maven-cache:/root/.m2:delegated
+ - ${DOCKER_VOLUME_PREFIX}conda-ccache:/ccache:delegated
command:
["/arrow/ci/scripts/cpp_build.sh /arrow /build &&
/arrow/ci/scripts/python_build.sh /arrow /build &&