1{ lib, buildPythonPackage, python, isPy3k, arrow-cpp, cmake, cython, hypothesis, numpy, pandas, pytestCheckHook, pytest-lazy-fixture, pkg-config, setuptools-scm, six }:
2
3let
4 _arrow-cpp = arrow-cpp.override { python3 = python; };
5in
6
7buildPythonPackage rec {
8 pname = "pyarrow";
9 disabled = !isPy3k;
10
11 inherit (_arrow-cpp) version src;
12
13 sourceRoot = "apache-arrow-${version}/python";
14
15 nativeBuildInputs = [ cmake cython pkg-config setuptools-scm ];
16 propagatedBuildInputs = [ numpy six ];
17 checkInputs = [ hypothesis pandas pytestCheckHook pytest-lazy-fixture ];
18
19 PYARROW_BUILD_TYPE = "release";
20 PYARROW_WITH_PARQUET = true;
21 PYARROW_CMAKE_OPTIONS = [
22 "-DCMAKE_INSTALL_RPATH=${ARROW_HOME}/lib"
23
24 # This doesn't use setup hook to call cmake so we need to workaround #54606
25 # ourselves
26 "-DCMAKE_POLICY_DEFAULT_CMP0025=NEW"
27 ];
28 ARROW_HOME = _arrow-cpp;
29 PARQUET_HOME = _arrow-cpp;
30
31 dontUseCmakeConfigure = true;
32
33 preBuild = ''
34 export PYARROW_PARALLEL=$NIX_BUILD_CORES
35 '';
36
37 pytestFlagsArray = [
38 # Deselect a single test because pyarrow prints a 2-line error message where
39 # only a single line is expected. The additional line of output comes from
40 # the glog library which is an optional dependency of arrow-cpp that is
41 # enabled in nixpkgs.
42 # Upstream Issue: https://issues.apache.org/jira/browse/ARROW-11393
43 "--deselect=pyarrow/tests/test_memory.py::test_env_var"
44 # Deselect a parquet dataset test because it erroneously fails to find the
45 # pyarrow._dataset module.
46 "--deselect=pyarrow/tests/parquet/test_dataset.py::test_parquet_dataset_deprecated_properties"
47 ];
48
49 dontUseSetuptoolsCheck = true;
50 preCheck = ''
51 mv pyarrow/tests tests
52 rm -rf pyarrow
53 mkdir pyarrow
54 mv tests pyarrow/tests
55 '';
56
57 meta = with lib; {
58 description = "A cross-language development platform for in-memory data";
59 homepage = "https://arrow.apache.org/";
60 license = licenses.asl20;
61 platforms = platforms.unix;
62 maintainers = with maintainers; [ veprbl ];
63 };
64}