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.3.1";
18 format = "setuptools";
19 disabled = pythonOlder "3.7";
20
21 src = fetchPypi {
22 pname = "flask_caching";
23 inherit version;
24 hash = "sha256-Zdf9G07r+BD4RN595iWCVLMkgpbuQpvcs/dBvL97mMk=";
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 # backend_cache relies on pytest-cache, which is a stale package from 2013
46 "backend_cache"
47 # optional backends
48 "Redis"
49 "Memcache"
50 ]
51 ++ lib.optionals stdenv.hostPlatform.isDarwin [
52 # ignore flaky test
53 "test_cache_timeout_dynamic"
54 "test_cached_view_class"
55 ];
56
57 meta = with lib; {
58 description = "Caching extension for Flask";
59 homepage = "https://github.com/pallets-eco/flask-caching";
60 changelog = "https://github.com/pallets-eco/flask-caching/blob/v${version}/CHANGES.rst";
61 maintainers = [ ];
62 license = licenses.bsd3;
63 };
64}