1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 azure-common,
7 azure-core,
8 azure-storage-blob,
9 boto3,
10 google-cloud-storage,
11 requests,
12 moto,
13 paramiko,
14 pytestCheckHook,
15 responses,
16 setuptools,
17 wrapt,
18 zstandard,
19}:
20
21buildPythonPackage rec {
22 pname = "smart-open";
23 version = "7.2.0";
24 pyproject = true;
25
26 disabled = pythonOlder "3.7";
27
28 src = fetchFromGitHub {
29 owner = "RaRe-Technologies";
30 repo = "smart_open";
31 tag = "v${version}";
32 hash = "sha256-/16Is90235scTAYUW/65QxcTddD0+aiG5TLzYsBUE1A=";
33 };
34
35 build-system = [ setuptools ];
36
37 dependencies = [ wrapt ];
38
39 optional-dependencies = {
40 s3 = [ boto3 ];
41 gcs = [ google-cloud-storage ];
42 azure = [
43 azure-storage-blob
44 azure-common
45 azure-core
46 ];
47 http = [ requests ];
48 webhdfs = [ requests ];
49 ssh = [ paramiko ];
50 zst = [ zstandard ];
51 };
52
53 pythonImportsCheck = [ "smart_open" ];
54
55 nativeCheckInputs = [
56 moto
57 pytestCheckHook
58 responses
59 ] ++ lib.flatten (lib.attrValues optional-dependencies);
60
61 pytestFlagsArray = [ "smart_open" ];
62
63 disabledTests = [
64 # https://github.com/RaRe-Technologies/smart_open/issues/784
65 "test_https_seek_forward"
66 "test_seek_from_current"
67 "test_seek_from_end"
68 "test_seek_from_start"
69 ];
70
71 meta = with lib; {
72 changelog = "https://github.com/piskvorky/smart_open/releases/tag/${src.tag}";
73 description = "Library for efficient streaming of very large file";
74 homepage = "https://github.com/RaRe-Technologies/smart_open";
75 license = licenses.mit;
76 maintainers = with maintainers; [ jyp ];
77 };
78}