1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6 glibcLocales,
7 importlib-metadata,
8 logfury,
9 packaging,
10 pdm-backend,
11 pyfakefs,
12 pytest-lazy-fixture,
13 pytest-mock,
14 pytestCheckHook,
15 pythonOlder,
16 pythonRelaxDepsHook,
17 requests,
18 tqdm,
19 typing-extensions,
20}:
21
22buildPythonPackage rec {
23 pname = "b2sdk";
24 version = "2.2.1";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "Backblaze";
31 repo = "b2-sdk-python";
32 rev = "refs/tags/v${version}";
33 hash = "sha256-ENEAynUd66sjS+/Qoy9qyffPpSvxdnY1Nwdi+JTE96I=";
34 };
35
36 build-system = [ pdm-backend ];
37
38 nativeBuildInputs = [ pythonRelaxDepsHook ];
39
40 pythonRemoveDeps = [ "setuptools" ];
41
42 dependencies =
43 [
44 packaging
45 logfury
46 requests
47 ]
48 ++ lib.optionals (pythonOlder "3.8") [ importlib-metadata ]
49 ++ lib.optionals (pythonOlder "3.12") [ typing-extensions ];
50
51 nativeCheckInputs = [
52 pyfakefs
53 pytest-lazy-fixture
54 pytest-mock
55 pytestCheckHook
56 tqdm
57 ] ++ lib.optionals stdenv.isLinux [ glibcLocales ];
58
59 disabledTestPaths = [
60 # requires aws s3 auth
61 "test/integration/test_download.py"
62 "test/integration/test_upload.py"
63
64 # Requires backblaze auth
65 "test/integration/test_bucket.py"
66 ];
67
68 disabledTests = [
69 # Test requires an API key
70 "test_raw_api"
71 "test_files_headers"
72 "test_large_file"
73 "test_file_info_b2_attributes"
74 ];
75
76 pythonImportsCheck = [ "b2sdk" ];
77
78 meta = with lib; {
79 description = "Client library and utilities for access to B2 Cloud Storage (backblaze)";
80 homepage = "https://github.com/Backblaze/b2-sdk-python";
81 changelog = "https://github.com/Backblaze/b2-sdk-python/blob/v${version}/CHANGELOG.md";
82 license = licenses.mit;
83 maintainers = with maintainers; [ ];
84 };
85}