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