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