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