1{ lib
2, appdirs
3, attrs
4, buildPythonPackage
5, bson
6, boto3
7, botocore
8, cattrs
9, exceptiongroup
10, fetchFromGitHub
11, itsdangerous
12, poetry-core
13, pymongo
14, pytestCheckHook
15, pythonOlder
16, pyyaml
17, redis
18, requests
19, requests-mock
20, rich
21, timeout-decorator
22, ujson
23, urllib3
24, url-normalize
25}:
26
27buildPythonPackage rec {
28 pname = "requests-cache";
29 version = "0.9.8";
30 format = "pyproject";
31
32 disabled = pythonOlder "3.7";
33
34 src = fetchFromGitHub {
35 owner = "requests-cache";
36 repo = "requests-cache";
37 rev = "refs/tags/v${version}";
38 hash = "sha256-Xbzbwz80xY8IDPDhZEUhmmiCFJZvSQMQ6EmE4EL7QGo=";
39 };
40
41 nativeBuildInputs = [
42 poetry-core
43 ];
44
45 propagatedBuildInputs = [
46 appdirs
47 attrs
48 cattrs
49 exceptiongroup
50 requests
51 urllib3
52 url-normalize
53 ];
54
55 passthru.optional-dependencies = {
56 dynamodb = [
57 boto3
58 botocore
59 ];
60 mongodbo = [
61 pymongo
62 ];
63 redis = [
64 redis
65 ];
66 bson = [
67 bson
68 ];
69 json = [
70 ujson
71 ];
72 security = [
73 itsdangerous
74 ];
75 yaml = [
76 pyyaml
77 ];
78 };
79
80 nativeCheckInputs = [
81 pytestCheckHook
82 requests-mock
83 rich
84 timeout-decorator
85 ]
86 ++ passthru.optional-dependencies.json
87 ++ passthru.optional-dependencies.security;
88
89 preCheck = ''
90 export HOME=$(mktemp -d);
91 '';
92
93 pytestFlagsArray = [
94 # Integration tests require local DBs
95 "tests/unit"
96 ];
97
98 disabledTests = [
99 # Tests are flaky in the sandbox
100 "test_remove_expired_responses"
101 ];
102
103 pythonImportsCheck = [
104 "requests_cache"
105 ];
106
107 meta = with lib; {
108 description = "Persistent cache for requests library";
109 homepage = "https://github.com/reclosedev/requests-cache";
110 changelog = "https://github.com/requests-cache/requests-cache/blob/v${version}/HISTORY.md";
111 license = licenses.bsd3;
112 maintainers = with maintainers; [ fab ];
113 };
114}