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