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