1{
2 lib,
3 buildPythonPackage,
4 fetchPypi,
5 rustPlatform,
6 pyarrow,
7 pyarrow-hotfix,
8 openssl,
9 stdenv,
10 libiconv,
11 pkg-config,
12 pytestCheckHook,
13 pytest-benchmark,
14 pytest-cov,
15 pytest-mock,
16 pandas,
17 azure-storage-blob,
18}:
19
20buildPythonPackage rec {
21 pname = "deltalake";
22 version = "0.20.1";
23 format = "pyproject";
24
25 src = fetchPypi {
26 inherit pname version;
27 hash = "sha256-serMb6Rirmw+QLpET3NT2djBoFBW/TGu1/5qYjiYpKE=";
28 };
29
30 cargoDeps = rustPlatform.fetchCargoVendor {
31 inherit src;
32 hash = "sha256-WGnjVYws8ZZMv0MvBrohozxQuyOImktaLxuvAIiH+U0=";
33 };
34
35 env.OPENSSL_NO_VENDOR = 1;
36
37 dependencies = [
38 pyarrow
39 pyarrow-hotfix
40 ];
41
42 buildInputs =
43 [
44 openssl
45 ]
46 ++ lib.optionals stdenv.hostPlatform.isDarwin [
47 libiconv
48 ];
49
50 nativeBuildInputs =
51 [
52 pkg-config # openssl-sys needs this
53 ]
54 ++ (with rustPlatform; [
55 cargoSetupHook
56 maturinBuildHook
57 ]);
58
59 pythonImportsCheck = [ "deltalake" ];
60
61 nativeCheckInputs = [
62 pytestCheckHook
63 pandas
64 pytest-benchmark
65 pytest-cov
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 pytestFlagsArray = [ "-m 'not integration'" ];
80
81 meta = with lib; {
82 description = "Native Rust library for Delta Lake, with bindings into Python";
83 homepage = "https://github.com/delta-io/delta-rs";
84 changelog = "https://github.com/delta-io/delta-rs/blob/python-v${version}/CHANGELOG.md";
85 license = licenses.asl20;
86 maintainers = with maintainers; [
87 kfollesdal
88 mslingsby
89 harvidsen
90 andershus
91 ];
92 };
93}