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