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