1{ lib, buildPythonPackage, python, isPy3k, arrow-cpp, cmake, cython, futures, hypothesis, numpy, pandas, pytest, pkgconfig, setuptools_scm, six }:
2
3let
4 _arrow-cpp = arrow-cpp.override { inherit python; };
5in
6
7buildPythonPackage rec {
8 pname = "pyarrow";
9
10 inherit (_arrow-cpp) version src;
11
12 sourceRoot = "apache-arrow-${version}/python";
13
14 nativeBuildInputs = [ cmake cython pkgconfig setuptools_scm ];
15 propagatedBuildInputs = [ numpy six ] ++ lib.optionals (!isPy3k) [ futures ];
16 checkInputs = [ hypothesis pandas pytest ];
17
18 PYARROW_BUILD_TYPE = "release";
19 PYARROW_WITH_PARQUET = true;
20 PYARROW_CMAKE_OPTIONS = [
21 "-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib"
22
23 # This doesn't use setup hook to call cmake so we need to workaround #54606
24 # ourselves
25 "-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
26 ];
27
28 dontUseCmakeConfigure = true;
29
30 preBuild = ''
31 export PYARROW_PARALLEL=$NIX_BUILD_CORES
32 '';
33
34 preCheck = ''
35 rm pyarrow/tests/test_jvm.py
36 rm pyarrow/tests/test_hdfs.py
37 rm pyarrow/tests/test_cuda.py
38
39 # fails: "ArrowNotImplementedError: Unsupported numpy type 22"
40 substituteInPlace pyarrow/tests/test_feather.py --replace "test_timedelta_with_nulls" "_disabled"
41
42 # runs out of memory on @grahamcofborg linux box
43 substituteInPlace pyarrow/tests/test_feather.py --replace "test_large_dataframe" "_disabled"
44
45 # probably broken on python2
46 substituteInPlace pyarrow/tests/test_feather.py --replace "test_unicode_filename" "_disabled"
47
48 # fails "error: [Errno 2] No such file or directory: 'test'" because
49 # nix_run_setup invocation somehow manages to import deserialize_buffer.py
50 # when it is not intended to be imported at all
51 rm pyarrow/tests/deserialize_buffer.py
52 substituteInPlace pyarrow/tests/test_feather.py --replace "test_deserialize_buffer_in_different_process" "_disabled"
53
54 # Fails to bind a socket
55 # "PermissionError: [Errno 1] Operation not permitted"
56 substituteInPlace pyarrow/tests/test_ipc.py --replace "test_socket_" "_disabled"
57 '';
58
59 ARROW_HOME = _arrow-cpp;
60 PARQUET_HOME = _arrow-cpp;
61
62 checkPhase = ''
63 mv pyarrow/tests tests
64 rm -rf pyarrow
65 mkdir pyarrow
66 mv tests pyarrow/tests
67 pytest -v
68 '';
69
70 meta = with lib; {
71 description = "A cross-language development platform for in-memory data";
72 homepage = https://arrow.apache.org/;
73 license = lib.licenses.asl20;
74 platforms = platforms.unix;
75 maintainers = with lib.maintainers; [ veprbl ];
76 };
77}