1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 pythonOlder,
6 fetchPypi,
7 cachelib,
8 flask,
9 asgiref,
10 pytest-asyncio,
11 pytest-xprocess,
12 pytestCheckHook,
13}:
14
15buildPythonPackage rec {
16 pname = "flask-caching";
17 version = "2.1.0";
18 format = "setuptools";
19 disabled = pythonOlder "3.7";
20
21 src = fetchPypi {
22 pname = "Flask-Caching";
23 inherit version;
24 hash = "sha256-t1AMFFE1g2qVLj3jqAiB2WVOMnopyFLJJlYH9cRJI1w=";
25 };
26
27 postPatch = ''
28 substituteInPlace setup.py \
29 --replace "cachelib >= 0.9.0, < 0.10.0" "cachelib"
30 '';
31
32 propagatedBuildInputs = [
33 cachelib
34 flask
35 ];
36
37 nativeCheckInputs = [
38 asgiref
39 pytest-asyncio
40 pytest-xprocess
41 pytestCheckHook
42 ];
43
44 disabledTests =
45 [
46 # backend_cache relies on pytest-cache, which is a stale package from 2013
47 "backend_cache"
48 # optional backends
49 "Redis"
50 "Memcache"
51 ]
52 ++ lib.optionals stdenv.isDarwin [
53 # ignore flaky test
54 "test_cache_timeout_dynamic"
55 "test_cached_view_class"
56 ];
57
58 meta = with lib; {
59 description = "A caching extension for Flask";
60 homepage = "https://github.com/pallets-eco/flask-caching";
61 changelog = "https://github.com/pallets-eco/flask-caching/blob/v${version}/CHANGES.rst";
62 maintainers = with maintainers; [ ];
63 license = licenses.bsd3;
64 };
65}