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