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