1{ lib, buildPythonPackage, python, isPy3k, fetchurl, 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 preBuild = ''
29 export PYARROW_PARALLEL=$NIX_BUILD_CORES
30 '';
31
32 preCheck = ''
33 rm pyarrow/tests/test_jvm.py
34 rm pyarrow/tests/test_hdfs.py
35 rm pyarrow/tests/test_cuda.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 # Fails to bind a socket
53 # "PermissionError: [Errno 1] Operation not permitted"
54 substituteInPlace pyarrow/tests/test_ipc.py --replace "test_socket_" "_disabled"
55 '';
56
57 ARROW_HOME = _arrow-cpp;
58 PARQUET_HOME = _arrow-cpp;
59
60 checkPhase = ''
61 mv pyarrow/tests tests
62 rm -rf pyarrow
63 mkdir pyarrow
64 mv tests pyarrow/tests
65 pytest -v
66 '';
67
68 meta = with lib; {
69 description = "A cross-language development platform for in-memory data";
70 homepage = https://arrow.apache.org/;
71 license = lib.licenses.asl20;
72 platforms = platforms.unix;
73 maintainers = with lib.maintainers; [ veprbl ];
74 };
75}