1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, python
5, cython
6, setuptools
7, substituteAll
8, numpy
9, pandas
10, cramjam
11, fsspec
12, thrift
13, python-lzo
14, pytestCheckHook
15, pythonOlder
16, packaging
17}:
18
19buildPythonPackage rec {
20 pname = "fastparquet";
21 version = "2023.4.0";
22 format = "pyproject";
23
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "dask";
28 repo = pname;
29 rev = version;
30 hash = "sha256-1hWiwXjTgflQlmy0Dk2phUa1cgYBvvH99tb0TdUmDRI=";
31 };
32
33 nativeBuildInputs = [
34 cython
35 setuptools
36 ];
37
38 patches = [
39 (substituteAll {
40 src = ./version.patch;
41 inherit version;
42 })
43 ];
44
45 postPatch = ''
46 substituteInPlace setup.py \
47 --replace "'pytest-runner'," "" \
48 --replace "oldest-supported-numpy" "numpy"
49
50 sed -i '/"git", "status"/d' setup.py
51 '';
52
53 propagatedBuildInputs = [
54 cramjam
55 fsspec
56 numpy
57 pandas
58 thrift
59 packaging
60 ];
61
62 passthru.optional-dependencies = {
63 lzo = [
64 python-lzo
65 ];
66 };
67
68 nativeCheckInputs = [
69 pytestCheckHook
70 ];
71
72 # Workaround https://github.com/NixOS/nixpkgs/issues/123561
73 preCheck = ''
74 mv fastparquet/test .
75 rm -r fastparquet
76 fastparquet_test="$out"/${python.sitePackages}/fastparquet/test
77 ln -s `pwd`/test "$fastparquet_test"
78 '';
79
80 postCheck = ''
81 rm "$fastparquet_test"
82 '';
83
84 pythonImportsCheck = [
85 "fastparquet"
86 ];
87
88 meta = with lib; {
89 description = "A python implementation of the parquet format";
90 homepage = "https://github.com/dask/fastparquet";
91 license = with licenses; [ asl20 ];
92 maintainers = with maintainers; [ veprbl ];
93 };
94}