From f9192c542467085dee4b817ea753ae40916cbf62 Mon Sep 17 00:00:00 2001 From: Dmitry Kalinkin Date: Sun, 18 Mar 2018 20:13:16 -0400 Subject: [PATCH] pythonPackages.pyarrow: init at 0.8.0 --- .../libraries/arrow-cpp/default.nix | 8 +++- .../python-modules/pyarrow/default.nix | 47 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 4 ++ 3 files changed, 57 insertions(+), 2 deletions(-) create mode 100644 pkgs/development/python-modules/pyarrow/default.nix diff --git a/pkgs/development/libraries/arrow-cpp/default.nix b/pkgs/development/libraries/arrow-cpp/default.nix index 7b7099cb610e..1db034170ddc 100644 --- a/pkgs/development/libraries/arrow-cpp/default.nix +++ b/pkgs/development/libraries/arrow-cpp/default.nix @@ -1,4 +1,4 @@ -{ stdenv, symlinkJoin, fetchurl, boost, brotli, cmake, flatbuffers, gtest, gflags, lz4, rapidjson, snappy, zlib, zstd }: +{ stdenv, symlinkJoin, fetchurl, boost, brotli, cmake, flatbuffers, gtest, gflags, lz4, pythonPackages, rapidjson, snappy, zlib, zstd }: stdenv.mkDerivation rec { name = "arrow-cpp-${version}"; @@ -12,7 +12,7 @@ stdenv.mkDerivation rec { sourceRoot = "apache-arrow-${version}/cpp"; nativeBuildInputs = [ cmake ]; - buildInputs = [ boost ]; + buildInputs = [ boost pythonPackages.python pythonPackages.numpy ]; preConfigure = '' substituteInPlace cmake_modules/FindBrotli.cmake --replace CMAKE_STATIC_LIBRARY CMAKE_SHARED_LIBRARY @@ -30,6 +30,10 @@ stdenv.mkDerivation rec { ZLIB_HOME = symlinkJoin { name="zlib-wrap"; paths = [ zlib.dev zlib.static ]; }; ZSTD_HOME = zstd; + cmakeFlags = [ + "-DARROW_PYTHON=ON" + ]; + meta = { description = "A cross-language development platform for in-memory data"; homepage = https://arrow.apache.org/; diff --git a/pkgs/development/python-modules/pyarrow/default.nix b/pkgs/development/python-modules/pyarrow/default.nix new file mode 100644 index 000000000000..8804953045e4 --- /dev/null +++ b/pkgs/development/python-modules/pyarrow/default.nix @@ -0,0 +1,47 @@ +{ lib, buildPythonPackage, fetchurl, arrow-cpp, cmake, cython, futures, numpy, pandas, pytest, pkgconfig, setuptools_scm, six }: + +buildPythonPackage rec { + pname = "pyarrow"; + version = "0.8.0"; + + src = fetchurl { + url = "mirror://apache/arrow/arrow-${version}/apache-arrow-${version}.tar.gz"; + sha256 = "1i79sh9ip32agbrn4n51pjn9266i45s8spk5jsi8ax0hqy1vhhmi"; + }; + + sourceRoot = "apache-arrow-${version}/python"; + + nativeBuildInputs = [ cmake cython pkgconfig setuptools_scm ]; + propagatedBuildInputs = [ futures numpy six ]; + checkInputs = [ pandas pytest ]; + + PYARROW_BUILD_TYPE = "release"; + PYARROW_BUNDLE_ARROW_CPP = 1; # sets RPATH on darwin + + preBuild = '' + substituteInPlace CMakeLists.txt --replace "''${ARROW_SO_VERSION}" '"0"' + ''; + + preCheck = '' + rm pyarrow/tests/test_hdfs.py + + # fails: "ArrowNotImplementedError: Unsupported numpy type 22" + substituteInPlace pyarrow/tests/test_feather.py --replace "test_timedelta_with_nulls" "_disabled" + + # runs out of memory on @grahamcofborg linux box + substituteInPlace pyarrow/tests/test_feather.py --replace "test_large_dataframe" "_disabled" + + # probably broken on python2 + substituteInPlace pyarrow/tests/test_feather.py --replace "test_unicode_filename" "_disabled" + ''; + + ARROW_HOME = arrow-cpp; + + meta = with lib; { + description = "A cross-language development platform for in-memory data"; + homepage = https://arrow.apache.org/; + license = lib.licenses.asl20; + platforms = platforms.unix; + maintainers = with lib.maintainers; [ veprbl ]; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 85179ccce3f8..635b779ce29c 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -305,6 +305,10 @@ in { pyamf = callPackage ../development/python-modules/pyamf { }; + pyarrow = callPackage ../development/python-modules/pyarrow { + inherit (pkgs) arrow-cpp cmake pkgconfig; + }; + pyatspi = disabledIf (!isPy3k) (callPackage ../development/python-modules/pyatspi { }); pyaxmlparser = callPackage ../development/python-modules/pyaxmlparser { };