Skip to content

Apache DataFusion SQL Query Engine

ARROW-1430: [Python] Python CI build outside of a bash function scope, enable flake8 to fail build

Wes McKinney5d3cee687c85
diff --git a/.travis.yml b/.travis.yml
index 016d111072..c604fd25a7 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -61,7 +61,9 @@ matrix:
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
- - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_build_parquet_cpp.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 2.7
+ - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 3.6
- compiler: clang
osx_image: xcode6.4
os: osx
@@ -73,7 +75,9 @@ matrix:
- $TRAVIS_BUILD_DIR/ci/travis_before_script_cpp.sh
script:
- $TRAVIS_BUILD_DIR/ci/travis_script_cpp.sh
- - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_build_parquet_cpp.sh
+ - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 2.7
+ - $TRAVIS_BUILD_DIR/ci/travis_script_python.sh 3.6
- language: cpp
before_script:
- docker pull quay.io/xhochy/arrow_manylinux1_x86_64_base:latest
diff --git a/ci/travis_build_parquet_cpp.sh b/ci/travis_build_parquet_cpp.sh
new file mode 100755
index 0000000000..4330a31a07
--- /dev/null
+++ b/ci/travis_build_parquet_cpp.sh
@@ -0,0 +1,50 @@
+#!/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 -e
+
+source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh
+
+export PARQUET_ARROW_VERSION=$(git rev-parse HEAD)
+
+# $CPP_TOOLCHAIN set up in before_script_cpp
+export PARQUET_BUILD_TOOLCHAIN=$CPP_TOOLCHAIN
+
+PARQUET_DIR=$TRAVIS_BUILD_DIR/parquet
+mkdir -p $PARQUET_DIR
+
+git clone https://github.com/apache/parquet-cpp.git $PARQUET_DIR
+
+pushd $PARQUET_DIR
+mkdir build-dir
+cd build-dir
+
+cmake \
+ -GNinja \
+ -DCMAKE_BUILD_TYPE=debug \
+ -DCMAKE_INSTALL_PREFIX=$ARROW_PYTHON_PARQUET_HOME \
+ -DPARQUET_BOOST_USE_SHARED=off \
+ -DPARQUET_BUILD_BENCHMARKS=off \
+ -DPARQUET_BUILD_EXECUTABLES=off \
+ -DPARQUET_BUILD_TESTS=off \
+ ..
+
+ninja
+ninja install
+
+popd
diff --git a/ci/travis_env_common.sh b/ci/travis_env_common.sh
index ff49cdfc2b..52c7da4e01 100755
--- a/ci/travis_env_common.sh
+++ b/ci/travis_env_common.sh
@@ -34,6 +34,8 @@ export ARROW_CPP_INSTALL=$TRAVIS_BUILD_DIR/cpp-install
export ARROW_CPP_BUILD_DIR=$TRAVIS_BUILD_DIR/cpp-build
export ARROW_C_GLIB_INSTALL=$TRAVIS_BUILD_DIR/c-glib-install
+export ARROW_PYTHON_PARQUET_HOME=$TRAVIS_BUILD_DIR/parquet-env
+
export CMAKE_EXPORT_COMPILE_COMMANDS=1
if [ "$ARROW_TRAVIS_USE_TOOLCHAIN" == "1" ]; then
diff --git a/ci/travis_script_python.sh b/ci/travis_script_python.sh
index b5ba136b16..e2cf254934 100755
--- a/ci/travis_script_python.sh
+++ b/ci/travis_script_python.sh
@@ -21,114 +21,72 @@ set -e
source $TRAVIS_BUILD_DIR/ci/travis_env_common.sh
export ARROW_HOME=$ARROW_CPP_INSTALL
-export PARQUET_HOME=$TRAVIS_BUILD_DIR/parquet-env
+export PARQUET_HOME=$ARROW_PYTHON_PARQUET_HOME
export LD_LIBRARY_PATH=$ARROW_HOME/lib:$PARQUET_HOME/lib:$LD_LIBRARY_PATH
export PYARROW_CXXFLAGS="-Werror"
-build_parquet_cpp() {
- export PARQUET_ARROW_VERSION=$(git rev-parse HEAD)
+PYTHON_VERSION=$1
+CONDA_ENV_DIR=$TRAVIS_BUILD_DIR/pyarrow-test-$PYTHON_VERSION
- # $CPP_TOOLCHAIN set up in before_script_cpp
- export PARQUET_BUILD_TOOLCHAIN=$CPP_TOOLCHAIN
+conda create -y -q -p $CONDA_ENV_DIR python=$PYTHON_VERSION cmake curl
+source activate $CONDA_ENV_DIR
- PARQUET_DIR=$TRAVIS_BUILD_DIR/parquet
- mkdir -p $PARQUET_DIR
+python --version
+which python
- git clone https://github.com/apache/parquet-cpp.git $PARQUET_DIR
+# faster builds, please
+conda install -y -q nomkl
- pushd $PARQUET_DIR
- mkdir build-dir
- cd build-dir
+# Expensive dependencies install from Continuum package repo
+conda install -y -q pip numpy pandas cython flake8
- cmake \
- -GNinja \
- -DCMAKE_BUILD_TYPE=debug \
- -DCMAKE_INSTALL_PREFIX=$PARQUET_HOME \
- -DPARQUET_BOOST_USE_SHARED=off \
- -DPARQUET_BUILD_BENCHMARKS=off \
- -DPARQUET_BUILD_EXECUTABLES=off \
- -DPARQUET_BUILD_TESTS=off \
- ..
+# Build C++ libraries
+pushd $ARROW_CPP_BUILD_DIR
- ninja
- ninja install
+# Clear out prior build files
+rm -rf *
- popd
-}
-
-build_parquet_cpp
-
-function rebuild_arrow_libraries() {
- pushd $ARROW_CPP_BUILD_DIR
-
- # Clear out prior build files
- rm -rf *
-
- cmake -GNinja \
- -DARROW_BUILD_TESTS=off \
- -DARROW_BUILD_UTILITIES=off \
- -DARROW_PLASMA=on \
- -DARROW_PYTHON=on \
- -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
- $ARROW_CPP_DIR
-
- ninja
- ninja install
+cmake -GNinja \
+ -DARROW_BUILD_TESTS=off \
+ -DARROW_BUILD_UTILITIES=off \
+ -DARROW_PLASMA=on \
+ -DARROW_PYTHON=on \
+ -DCMAKE_INSTALL_PREFIX=$ARROW_HOME \
+ $ARROW_CPP_DIR
- popd
-}
+ninja
+ninja install
-python_version_tests() {
- PYTHON_VERSION=$1
- CONDA_ENV_DIR=$TRAVIS_BUILD_DIR/pyarrow-test-$PYTHON_VERSION
+popd
- conda create -y -q -p $CONDA_ENV_DIR python=$PYTHON_VERSION cmake curl
- source activate $CONDA_ENV_DIR
+# Other stuff pip install
+pushd $ARROW_PYTHON_DIR
- python --version
- which python
+# Fail fast on style checks
+flake8 --count pyarrow
- # faster builds, please
- conda install -y -q nomkl
+# Check Cython files with some checks turned off
+flake8 --count --config=.flake8.cython pyarrow
- # Expensive dependencies install from Continuum package repo
- conda install -y -q pip numpy pandas cython flake8
+pip install -r requirements.txt
+python setup.py build_ext --with-parquet --with-plasma \
+ install --single-version-externally-managed --record=record.text
+popd
- # Fail fast on style checks
- flake8 --count pyarrow
+python -c "import pyarrow.parquet"
+python -c "import pyarrow.plasma"
- # Check Cython files with some checks turned off
- flake8 --count --config=.flake8.cython pyarrow
+if [ $TRAVIS_OS_NAME == "linux" ]; then
+ export PLASMA_VALGRIND=1
+fi
- # Build C++ libraries
- rebuild_arrow_libraries
+PYARROW_PATH=$CONDA_PREFIX/lib/python$PYTHON_VERSION/site-packages/pyarrow
+python -m pytest -vv -r sxX -s $PYARROW_PATH --parquet
- # Other stuff pip install
- pushd $ARROW_PYTHON_DIR
- pip install -r requirements.txt
- python setup.py build_ext --with-parquet --with-plasma \
- install --single-version-externally-managed --record=record.text
+if [ "$PYTHON_VERSION" == "3.6" ] && [ $TRAVIS_OS_NAME == "linux" ]; then
+ # Build documentation once
+ pushd $ARROW_PYTHON_DIR/doc
+ conda install -y -q --file=requirements.txt
+ sphinx-build -b html -d _build/doctrees -W source _build/html
popd
-
- python -c "import pyarrow.parquet"
- python -c "import pyarrow.plasma"
-
- if [ $TRAVIS_OS_NAME == "linux" ]; then
- export PLASMA_VALGRIND=1
- fi
-
- PYARROW_PATH=$CONDA_PREFIX/lib/python$PYTHON_VERSION/site-packages/pyarrow
- python -m pytest -vv -r sxX -s $PYARROW_PATH --parquet
-
- if [ "$PYTHON_VERSION" == "3.6" ] && [ $TRAVIS_OS_NAME == "linux" ]; then
- # Build documentation once
- pushd $ARROW_PYTHON_DIR/doc
- conda install -y -q --file=requirements.txt
- sphinx-build -b html -d _build/doctrees -W source _build/html
- popd
- fi
-}
-
-# run tests for python 2.7 and 3.6
-python_version_tests 2.7
-python_version_tests 3.6
+fi