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