1{ lib
2, arrow
3, buildPythonPackage
4, fetchPypi
5, importlib-metadata
6, logfury
7, pyfakefs
8, pytestCheckHook
9, pytest-lazy-fixture
10, pytest-mock
11, pythonOlder
12, requests
13, setuptools-scm
14, tqdm
15}:
16
17buildPythonPackage rec {
18 pname = "b2sdk";
19 version = "1.19.0";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.7";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-aJpSt+dXjw4S33dBiMkaR6wxzwLru+jseuPKFj2R36Y=";
27 };
28
29 nativeBuildInputs = [
30 setuptools-scm
31 ];
32
33 propagatedBuildInputs = [
34 arrow
35 logfury
36 requests
37 tqdm
38 ] ++ lib.optionals (pythonOlder "3.8") [
39 importlib-metadata
40 ];
41
42 nativeCheckInputs = [
43 pytestCheckHook
44 pytest-lazy-fixture
45 pytest-mock
46 pyfakefs
47 ];
48
49 postPatch = ''
50 substituteInPlace setup.py \
51 --replace 'setuptools_scm<6.0' 'setuptools_scm'
52 substituteInPlace requirements.txt \
53 --replace 'arrow>=0.8.0,<1.0.0' 'arrow'
54 '';
55
56 disabledTestPaths = [
57 # requires aws s3 auth
58 "test/integration/test_download.py"
59 "test/integration/test_upload.py"
60 ];
61
62 disabledTests = [
63 # Test requires an API key
64 "test_raw_api"
65 "test_files_headers"
66 "test_large_file"
67 ];
68
69 pythonImportsCheck = [
70 "b2sdk"
71 ];
72
73 meta = with lib; {
74 description = "Client library and utilities for access to B2 Cloud Storage (backblaze)";
75 homepage = "https://github.com/Backblaze/b2-sdk-python";
76 license = licenses.mit;
77 maintainers = with maintainers; [ ];
78 };
79}