1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchPypi
5, pythonRelaxDepsHook
6, setuptools
7, watchdog
8, portalocker
9, pathtools
10, pytestCheckHook
11, pymongo
12, dnspython
13, pymongo-inmemory
14, pandas
15}:
16
17buildPythonPackage rec {
18 pname = "cachier";
19 version = "2.2.1";
20 format = "setuptools";
21
22 disabled = pythonOlder "3.8";
23
24 src = fetchPypi {
25 inherit pname version;
26 hash = "sha256-nm98LT87Z7yErKvIqMp93OEX9TDojqqtItgryHgSQJQ=";
27 };
28
29 pythonRemoveDeps = [ "setuptools" ];
30
31 nativeBuildInputs = [
32 pythonRelaxDepsHook
33 setuptools
34 ];
35
36 propagatedBuildInputs = [
37 watchdog
38 portalocker
39 pathtools
40 ];
41
42 preCheck = ''
43 substituteInPlace pytest.ini \
44 --replace \
45 "--cov" \
46 "#--cov"
47 '';
48
49 nativeCheckInputs = [
50 pytestCheckHook
51 pymongo
52 dnspython
53 pymongo-inmemory
54 pandas
55 ];
56
57 disabledTests = [
58 # touches network
59 "test_mongetter_default_param"
60 "test_stale_after_applies_dynamically"
61 "test_next_time_applies_dynamically"
62 "test_wait_for_calc_"
63 "test_precache_value"
64 "test_ignore_self_in_methods"
65 "test_mongo_index_creation"
66 "test_mongo_core"
67
68 # don't test formatting
69 "test_flake8"
70 ];
71
72 preBuild = ''
73 export HOME="$(mktemp -d)"
74 '';
75
76 pythonImportsCheck = [
77 "cachier"
78 "cachier.scripts"
79 ];
80
81 meta = {
82 homepage = "https://github.com/python-cachier/cachier";
83 description = "Persistent, stale-free, local and cross-machine caching for functions";
84 maintainers = with lib.maintainers; [ pbsds ];
85 license = lib.licenses.mit;
86 };
87}