1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 rustPlatform,
6 pyarrow,
7 pyarrow-hotfix,
8 openssl,
9 stdenv,
10 libiconv,
11 pkg-config,
12 polars,
13 pytestCheckHook,
14 pytest-benchmark,
15 pytest-cov-stub,
16 pytest-mock,
17 pandas,
18 azure-storage-blob,
19}:
20
21buildPythonPackage rec {
22 pname = "deltalake";
23 version = "0.25.5";
24 format = "pyproject";
25
26 src = fetchPypi {
27 inherit pname version;
28 hash = "sha256-Fz5Lg/z/EPJkdK4RcWHD8r3V9EwwwgRjwktri1IOdlY=";
29 };
30
31 cargoDeps = rustPlatform.fetchCargoVendor {
32 inherit src;
33 hash = "sha256-6SGVKJu01MzZxJv29PZKea+Z2YwAnvzbdDlnA4R6Az0=";
34 };
35
36 env.OPENSSL_NO_VENDOR = 1;
37
38 dependencies = [
39 pyarrow
40 pyarrow-hotfix
41 ];
42
43 buildInputs = [
44 openssl
45 ]
46 ++ lib.optionals stdenv.hostPlatform.isDarwin [
47 libiconv
48 ];
49
50 nativeBuildInputs = [
51 pkg-config # openssl-sys needs this
52 ]
53 ++ (with rustPlatform; [
54 cargoSetupHook
55 maturinBuildHook
56 ]);
57
58 pythonImportsCheck = [ "deltalake" ];
59
60 nativeCheckInputs = [
61 pytestCheckHook
62 pandas
63 polars
64 pytest-benchmark
65 pytest-cov-stub
66 pytest-mock
67 azure-storage-blob
68 ];
69
70 preCheck = ''
71 # For paths in test to work, we have to be in python dir
72 cp pyproject.toml python/
73 cd python
74
75 # In tests we want to use deltalake that we have built
76 rm -rf deltalake
77 '';
78
79 pytestFlags = [
80 "--benchmark-disable"
81 ];
82
83 disabledTestMarks = [
84 "integration"
85 ];
86
87 meta = with lib; {
88 description = "Native Rust library for Delta Lake, with bindings into Python";
89 homepage = "https://github.com/delta-io/delta-rs";
90 changelog = "https://github.com/delta-io/delta-rs/blob/python-v${version}/CHANGELOG.md";
91 license = licenses.asl20;
92 maintainers = with maintainers; [
93 kfollesdal
94 mslingsby
95 harvidsen
96 andershus
97 ];
98 };
99}