1{ lib, buildPythonPackage, python, isPy3k, fetchurl, arrow-cpp, cmake, cython, futures, numpy, pandas, pytest, pytestrunner, parquet-cpp, pkgconfig, setuptools_scm, six }:
2
3let
4 _arrow-cpp = arrow-cpp.override { inherit python;};
5 _parquet-cpp = parquet-cpp.override { arrow-cpp = _arrow-cpp; };
6in
7
8buildPythonPackage rec {
9 pname = "pyarrow";
10 version = "0.9.0";
11
12 src = fetchurl {
13 url = "mirror://apache/arrow/arrow-${version}/apache-arrow-${version}.tar.gz";
14 sha256 = "16l91fixb5dgx3v6xc73ipn1w1hjgbmijyvs81j7ywzpna2cdcdy";
15 };
16
17 sourceRoot = "apache-arrow-${version}/python";
18
19 nativeBuildInputs = [ cmake cython pkgconfig setuptools_scm ];
20 propagatedBuildInputs = [ numpy six ] ++ lib.optionals (!isPy3k) [ futures ];
21 checkInputs = [ pandas pytest pytestrunner ];
22
23 PYARROW_BUILD_TYPE = "release";
24 PYARROW_CMAKE_OPTIONS = "-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib;${PARQUET_HOME}/lib";
25
26 preBuild = ''
27 substituteInPlace CMakeLists.txt --replace "\''${ARROW_ABI_VERSION}" '"0.0.0"'
28 substituteInPlace CMakeLists.txt --replace "\''${ARROW_SO_VERSION}" '"0"'
29
30 # fix the hardcoded value
31 substituteInPlace cmake_modules/FindParquet.cmake --replace 'set(PARQUET_ABI_VERSION "1.0.0")' 'set(PARQUET_ABI_VERSION "${_parquet-cpp.version}")'
32 '';
33
34 preCheck = ''
35 rm pyarrow/tests/test_hdfs.py
36
37 # fails: "ArrowNotImplementedError: Unsupported numpy type 22"
38 substituteInPlace pyarrow/tests/test_feather.py --replace "test_timedelta_with_nulls" "_disabled"
39
40 # runs out of memory on @grahamcofborg linux box
41 substituteInPlace pyarrow/tests/test_feather.py --replace "test_large_dataframe" "_disabled"
42
43 # probably broken on python2
44 substituteInPlace pyarrow/tests/test_feather.py --replace "test_unicode_filename" "_disabled"
45
46 # fails "error: [Errno 2] No such file or directory: 'test'" because
47 # nix_run_setup invocation somehow manages to import deserialize_buffer.py
48 # when it is not intended to be imported at all
49 rm pyarrow/tests/deserialize_buffer.py
50 substituteInPlace pyarrow/tests/test_feather.py --replace "test_deserialize_buffer_in_different_process" "_disabled"
51 '';
52
53 ARROW_HOME = _arrow-cpp;
54 PARQUET_HOME = _parquet-cpp;
55
56 setupPyBuildFlags = ["--with-parquet" ];
57
58 meta = with lib; {
59 description = "A cross-language development platform for in-memory data";
60 homepage = https://arrow.apache.org/;
61 license = lib.licenses.asl20;
62 platforms = platforms.unix;
63 maintainers = with lib.maintainers; [ veprbl ];
64 };
65}