1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 flit-core,
7 typing-extensions,
8 azure-identity,
9 azure-storage-blob,
10 azure-storage-file-datalake,
11 google-cloud-storage,
12 boto3,
13 psutil,
14 pydantic,
15 pytestCheckHook,
16 pytest-cases,
17 pytest-cov-stub,
18 pytest-xdist,
19 python-dotenv,
20 shortuuid,
21 tenacity,
22}:
23
24buildPythonPackage rec {
25 pname = "cloudpathlib";
26 version = "0.22.0";
27 pyproject = true;
28
29 disabled = pythonOlder "3.8";
30
31 src = fetchFromGitHub {
32 owner = "drivendataorg";
33 repo = "cloudpathlib";
34 tag = "v${version}";
35 hash = "sha256-IeNYfYDvCALvK0CV4J6434E3lSz+/JvolQzQXZ8NizQ=";
36 };
37
38 postPatch = ''
39 # missing pytest-reportlog test dependency
40 substituteInPlace pyproject.toml \
41 --replace-fail "--report-log reportlog.jsonl" ""
42 '';
43
44 build-system = [ flit-core ];
45
46 dependencies = lib.optional (pythonOlder "3.11") typing-extensions;
47
48 optional-dependencies = {
49 all = optional-dependencies.azure ++ optional-dependencies.gs ++ optional-dependencies.s3;
50 azure = [
51 azure-storage-blob
52 azure-storage-file-datalake
53 ];
54 gs = [ google-cloud-storage ];
55 s3 = [ boto3 ];
56 };
57
58 pythonImportsCheck = [ "cloudpathlib" ];
59
60 nativeCheckInputs = [
61 azure-identity
62 psutil
63 pydantic
64 pytestCheckHook
65 pytest-cases
66 pytest-cov-stub
67 pytest-xdist
68 python-dotenv
69 shortuuid
70 tenacity
71 ]
72 ++ optional-dependencies.all;
73
74 meta = with lib; {
75 description = "Python pathlib-style classes for cloud storage services such as Amazon S3, Azure Blob Storage, and Google Cloud Storage";
76 homepage = "https://github.com/drivendataorg/cloudpathlib";
77 license = licenses.mit;
78 maintainers = with maintainers; [ GaetanLepage ];
79 };
80}