1{
2 lib,
3 buildPythonPackage,
4 pythonOlder,
5 fetchFromGitHub,
6 setuptools,
7 click,
8 watchdog,
9 portalocker,
10 pytestCheckHook,
11 pytest-cov-stub,
12 pymongo,
13 dnspython,
14 pymongo-inmemory,
15 pandas,
16 birch,
17}:
18
19buildPythonPackage rec {
20 pname = "cachier";
21 version = "3.1.2";
22 pyproject = true;
23
24 disabled = pythonOlder "3.8";
25
26 src = fetchFromGitHub {
27 owner = "python-cachier";
28 repo = "cachier";
29 tag = "v${version}";
30 hash = "sha256-siighT6hMicN+F/LIXfUAPQ2kkRiyk7CtjqmyC/qCFg=";
31 };
32
33 pythonRemoveDeps = [ "setuptools" ];
34
35 nativeBuildInputs = [
36 setuptools
37 ];
38
39 dependencies = [
40 watchdog
41 portalocker
42 # not listed as dep, but needed to run main script entrypoint
43 click
44 ];
45
46 nativeCheckInputs = [
47 pytestCheckHook
48 pytest-cov-stub
49 pymongo
50 dnspython
51 pymongo-inmemory
52 pandas
53 birch
54 ];
55
56 disabledTests = [
57 # touches network
58 "test_mongetter_default_param"
59 "test_stale_after_applies_dynamically"
60 "test_next_time_applies_dynamically"
61 "test_wait_for_calc_"
62 "test_precache_value"
63 "test_ignore_self_in_methods"
64 "test_mongo_index_creation"
65 "test_mongo_core"
66
67 # don't test formatting
68 "test_flake8"
69
70 # timing sensitive
71 "test_being_calc_next_time"
72 "test_pickle_being_calculated"
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 changelog = "https://github.com/python-cachier/cachier/releases/tag/v${version}";
84 description = "Persistent, stale-free, local and cross-machine caching for functions";
85 mainProgram = "cachier";
86 maintainers = with lib.maintainers; [ pbsds ];
87 license = lib.licenses.mit;
88 };
89}