Apache DataFusion SQL Query Engine
ARROW-10777: [Packaging][Python] Build sdist by Crossbow
Sutou Kouhei5b00b58a5436
diff --git a/ci/docker/python-sdist.dockerfile b/ci/docker/python-sdist.dockerfilenew file mode 100644index 0000000000..853b532ab5--- /dev/null+++ b/ci/docker/python-sdist.dockerfile@@ -0,0 +1,36 @@+# 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.++FROM amd64/ubuntu:20.04++SHELL ["/bin/bash", "-o", "pipefail", "-c"]++RUN echo "debconf debconf/frontend select Noninteractive" | \+ debconf-set-selections++RUN apt-get update -y -q && \+ apt-get install -y -q --no-install-recommends \+ git \+ python3-pip && \+ apt-get clean && \+ rm -rf /var/lib/apt/lists*++COPY python/requirements-build.txt \+ /arrow/python/requirements-build.txt+RUN pip3 install --requirement /arrow/python/requirements-build.txt++ENV PYTHON=/usr/bin/python3diff --git a/ci/scripts/cpp_build.sh b/ci/scripts/cpp_build.shindex a12c51c07a..144abbd434 100755--- a/ci/scripts/cpp_build.sh+++ b/ci/scripts/cpp_build.sh@@ -123,7 +123,7 @@ cmake -G "${CMAKE_GENERATOR:-Ninja}" \-DPARQUET_REQUIRE_ENCRYPTION=${PARQUET_REQUIRE_ENCRYPTION:-ON} \-DProtobuf_SOURCE=${Protobuf_SOURCE:-} \-DRapidJSON_SOURCE=${RapidJSON_SOURCE:-} \- -DRE2_SOURCE=${RE2_SOURCE:-} \+ -Dre2_SOURCE=${re2_SOURCE:-} \-DSnappy_SOURCE=${Snappy_SOURCE:-} \-DThrift_SOURCE=${Thrift_SOURCE:-} \-Dutf8proc_SOURCE=${utf8proc_SOURCE:-} \diff --git a/ci/scripts/python_sdist_build.sh b/ci/scripts/python_sdist_build.shnew file mode 100755index 0000000000..f9e9359b6f--- /dev/null+++ b/ci/scripts/python_sdist_build.sh@@ -0,0 +1,27 @@+#!/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 -eux++source_dir=${1}/python++pushd ${source_dir}+export SETUPTOOLS_SCM_PRETEND_VERSION=${PYARROW_VERSION:-}+${PYTHON:-python} setup.py sdist+popddiff --git a/ci/scripts/python_sdist_test.sh b/ci/scripts/python_sdist_test.shnew file mode 100755index 0000000000..1388ca09e4--- /dev/null+++ b/ci/scripts/python_sdist_test.sh@@ -0,0 +1,52 @@+#!/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 -eux++arrow_dir=${1}++export ARROW_SOURCE_DIR=${arrow_dir}+export ARROW_TEST_DATA=${arrow_dir}/testing/data+export PARQUET_TEST_DATA=${arrow_dir}/cpp/submodules/parquet-testing/data++export PYARROW_CMAKE_GENERATOR=${CMAKE_GENERATOR:-Ninja}+export PYARROW_BUILD_TYPE=${CMAKE_BUILD_TYPE:-debug}+export PYARROW_WITH_S3=${ARROW_S3:-OFF}+export PYARROW_WITH_ORC=${ARROW_ORC:-OFF}+export PYARROW_WITH_CUDA=${ARROW_CUDA:-OFF}+export PYARROW_WITH_HDFS=${ARROW_HDFS:-OFF}+export PYARROW_WITH_FLIGHT=${ARROW_FLIGHT:-OFF}+export PYARROW_WITH_PLASMA=${ARROW_PLASMA:-OFF}+export PYARROW_WITH_GANDIVA=${ARROW_GANDIVA:-OFF}+export PYARROW_WITH_PARQUET=${ARROW_PARQUET:-OFF}+export PYARROW_WITH_DATASET=${ARROW_DATASET:-OFF}++# TODO: Users should not require ARROW_HOME and pkg-config to find Arrow C++.+# Related: ARROW-9171+# unset ARROW_HOME+# apt purge -y pkg-config++if [ -n "${PYARROW_VERSION:-}" ]; then+ sdist="${arrow_dir}/python/dist/pyarrow-${PYARROW_VERSION}.tar.gz"+else+ sdist=$(ls "${arrow_dir}/python/dist/pyarrow-*.tar.gz" | sort -r | head -n1)+fi+${PYTHON:-python} -m pip install ${sdist}++pytest -r s ${PYTEST_ARGS:-} --pyargs pyarrowdiff --git a/dev/release/binary-task.rb b/dev/release/binary-task.rbindex dda0c62c31..8aedbcb7bc 100644--- a/dev/release/binary-task.rb+++ b/dev/release/binary-task.rb@@ -1833,7 +1833,7 @@ APT::FTPArchive::Release::Description "#{apt_repository_description}";:python,"#{rc_dir}/python/#{full_version}","#{release_dir}/python/#{full_version}",- "{conda,wheel}-*/**/*")+ "{conda-*,wheel-*,python-sdist}/**/*")enddef define_nuget_tasksdiff --git a/dev/release/download_rc_binaries.py b/dev/release/download_rc_binaries.pyindex 1c3da0e1e6..5ed8ece778 100755--- a/dev/release/download_rc_binaries.py+++ b/dev/release/download_rc_binaries.py@@ -135,11 +135,15 @@ ARROW_PACKAGE_TYPES = ['centos', 'debian', 'nuget', 'python', 'ubuntu']def download_rc_binaries(version, rc_number, re_match=None, dest=None,- num_parallel=None):+ num_parallel=None, target_package_type=None):bintray = Bintray()version_string = '{}-rc{}'.format(version, rc_number)- for package_type in ARROW_PACKAGE_TYPES:+ if target_package_type:+ package_types = [target_package_type]+ else:+ package_types = ARROW_PACKAGE_TYPES+ for package_type in package_types:files = bintray.get_file_list('{}-rc'.format(package_type),version_string)bintray.download_files(files, re_match=re_match, dest=dest,@@ -160,7 +164,10 @@ if __name__ == '__main__':help='The output folder for the downloaded files')parser.add_argument('--num_parallel', type=int, default=8,help='The number of concurrent downloads to do')+ parser.add_argument('--package_type', type=str, default=None,+ help='The package type to be downloaded')args = parser.parse_args()download_rc_binaries(args.version, args.rc_number, dest=args.dest,- re_match=args.regexp, num_parallel=args.num_parallel)+ re_match=args.regexp, num_parallel=args.num_parallel,+ target_package_type=args.package_type)diff --git a/dev/release/post-10-python.sh b/dev/release/post-10-python.shnew file mode 100755index 0000000000..0f7a480cde--- /dev/null+++ b/dev/release/post-10-python.sh@@ -0,0 +1,44 @@+#!/bin/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 -e+set -o pipefail++SOURCE_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"++if [ "$#" -ne 2 ]; then+ echo "Usage: $0 <version> <rc-num>"+ exit+fi++version=$1+rc=$2++tmp=$(mktemp -d -t "arrow-post-python.XXXXX")+${PYTHON:-python} \+ "${SOURCE_DIR}/download_rc_binaries.py" \+ ${version} \+ ${rc} \+ --dest="${tmp}" \+ --package_type=python+twine upload ${tmp}/python-rc/${version}-rc${rc}/*.{whl,tar.gz}+rm -rf "${tmp}"++echo "Success! The released PyPI packages are available here:"+echo " https://pypi.org/project/pyarrow/${version}"diff --git a/dev/release/rat_exclude_files.txt b/dev/release/rat_exclude_files.txtindex 3865239cb1..85ac2c2e43 100644--- a/dev/release/rat_exclude_files.txt+++ b/dev/release/rat_exclude_files.txt@@ -164,6 +164,7 @@ dev/tasks/linux-packages/apache-arrow/debian/plasma-store-server.installdev/tasks/linux-packages/apache-arrow/debian/rulesdev/tasks/linux-packages/apache-arrow/debian/source/formatdev/tasks/linux-packages/apache-arrow/debian/watch+dev/tasks/requirements*.txtdev/tasks/conda-recipes/*docs/requirements.txtgo/arrow/flight/Flight_grpc.pb.godiff --git a/dev/tasks/python-sdist/github.yml b/dev/tasks/python-sdist/github.ymlnew file mode 100644index 0000000000..b784fbdf8f--- /dev/null+++ b/dev/tasks/python-sdist/github.yml@@ -0,0 +1,83 @@+# 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 sdist"+ runs-on: ubuntu-20.04+ steps:+ - name: Checkout Arrow+ 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+ run: cd arrow && ci/scripts/util_checkout.sh+ - name: Free Up Disk Space+ shell: bash+ run: arrow/ci/scripts/util_cleanup.sh+ - uses: actions/setup-python@v2+ - name: Setup Archery+ run: pip install -e arrow/dev/archery[docker]+ - name: Build sdist+ run: |+ archery docker run python-sdist+ {% if arrow.branch == 'master' %}+ archery docker push python-sdist || :+ {% endif %}+ env:+ PYARROW_VERSION: {{ arrow.no_rc_version }}+ - name: Test sdist+ run: archery docker run ubuntu-python-sdist-test+ env:+ PYARROW_VERSION: {{ arrow.no_rc_version }}+ {% if arrow.branch == 'master' %}+ - name: Upload to gemfury+ run: |+ SDIST_PATH=$(echo arrow/python/dist/*.tar.gz)+ curl \+ -F "package=@${SDIST_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 %}+ - name: Setup Crossbow+ 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 "arrow/python/dist/*.tar.gz" \+ --sha {{ task.branch }} \+ --tag {{ task.tag }}+ env:+ CROSSBOW_GITHUB_TOKEN: {{ '${{ secrets.CROSSBOW_GITHUB_TOKEN }}' }}diff --git a/dev/tasks/python-wheels/github.osx.yml b/dev/tasks/python-wheels/github.osx.ymlindex 5e9214f0a9..f0edeb32a9 100644--- a/dev/tasks/python-wheels/github.osx.yml+++ b/dev/tasks/python-wheels/github.osx.yml@@ -108,15 +108,7 @@ jobs:- name: Setup Crossbowrun: |- pip3 install \- click \- github3.py \- jinja2 \- jira \- pygit2 \- ruamel.yaml \- setuptools_scm \- toolz+ pip3 install --requirement arrow/dev/tasks/requirements-crossbow.txt- name: Upload artifactsrun: |diff --git a/dev/tasks/python-wheels/github.win.yml b/dev/tasks/python-wheels/github.win.ymlindex f7638d8be3..422643251e 100644--- a/dev/tasks/python-wheels/github.win.yml+++ b/dev/tasks/python-wheels/github.win.yml@@ -77,15 +77,7 @@ jobs:- name: Set up Crossbowshell: bashrun: |- pip install \- click \- github3.py \- jinja2 \- jira \- pygit2 \- ruamel.yaml \- setuptools_scm \- toolz+ pip install --requirement arrow/dev/tasks/requirements-crossbow.txt- name: Upload artifactsshell: bashrun: |diff --git a/dev/tasks/requirements-crossbow.txt b/dev/tasks/requirements-crossbow.txtnew file mode 100644index 0000000000..2436b4d117--- /dev/null+++ b/dev/tasks/requirements-crossbow.txt@@ -0,0 +1,7 @@+click>=7.1+github3.py+jinja2+pygit2+ruamel.yaml+setuptools_scm+toolzdiff --git a/dev/tasks/tasks.yml b/dev/tasks/tasks.ymlindex c3b213960a..f19e0a483b 100644--- a/dev/tasks/tasks.yml+++ b/dev/tasks/tasks.yml@@ -48,6 +48,15 @@ groups:homebrew:- homebrew-*+ packaging:+ - conda-*+ - wheel-*+ - debian-*+ - ubuntu-*+ - centos-*+ - python-sdist+ - nuget+############################# Testing tasks #################################test:@@ -121,6 +130,7 @@ groups:- test-*- example-*- wheel-*+ - python-sdisttasks:# arbitrary_task_name:@@ -610,6 +620,14 @@ tasks:artifacts:- pyarrow-{no_rc_version}-cp38-cp38-win_amd64.whl+ ############################ Python sdist ####################################++ python-sdist:+ ci: github+ template: python-sdist/github.yml+ artifacts:+ - pyarrow-{no_rc_version}.tar.gz+############################## Linux PKGS ####################################debian-buster-amd64:diff --git a/docker-compose.yml b/docker-compose.ymlindex 0454c678c8..6aa195c6fa 100644--- a/docker-compose.yml+++ b/docker-compose.yml@@ -110,12 +110,14 @@ x-hierarchy:- ubuntu-lint- ubuntu-python:- ubuntu-docs+ - ubuntu-python-sdist-test- ubuntu-r- ubuntu-cuda-cpp:- ubuntu-cuda-python- ubuntu-csharp- ubuntu-cpp-sanitizer- ubuntu-r-sanitizer+ - python-sdist- r# helper services- impala@@ -588,6 +590,53 @@ services:volumes: *fedora-volumescommand: *python-command+ ############################ Python sdist ###################################++ python-sdist:+ # Usage:+ # docker-compose build python-sdist+ # docker-compose run --rm python-sdist+ # Parameters:+ # PYARROW_VERSION: The pyarrow version for sdist such as "3.0.0"+ image: ${REPO}:python-sdist+ build:+ context: .+ dockerfile: ci/docker/python-sdist.dockerfile+ cache_from:+ - ${REPO}:python-sdist+ environment:+ PYARROW_VERSION: ${PYARROW_VERSION:-}+ volumes:+ - .:/arrow:delegated+ command: /arrow/ci/scripts/python_sdist_build.sh /arrow++ ubuntu-python-sdist-test:+ # Usage:+ # docker-compose build ubuntu-cpp+ # docker-compose build ubuntu-python-sdist-test+ # docker-compose run --rm ubuntu-python-sdist-test+ # Parameters:+ # ARCH: amd64, arm64v8, ...+ # PYARROW_VERSION: The test target pyarrow version such as "3.0.0"+ # UBUNTU: 16.04, 18.04, 20.04+ image: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-python-3+ build:+ context: .+ dockerfile: ci/docker/linux-apt-python-3.dockerfile+ cache_from:+ - ${REPO}:${ARCH}-ubuntu-${UBUNTU}-python-3+ args:+ base: ${REPO}:${ARCH}-ubuntu-${UBUNTU}-cpp+ shm_size: *shm-size+ environment:+ <<: *ccache+ PYARROW_VERSION: ${PYARROW_VERSION:-}+ volumes: *ubuntu-volumes+ command: >+ /bin/bash -c "+ /arrow/ci/scripts/cpp_build.sh /arrow /build &&+ /arrow/ci/scripts/python_sdist_test.sh /arrow"+############################## Integration #################################conda-python-pandas: