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