1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, flask
5, flask-restful
6, hiro
7, limits
8, mock
9, ordereddict
10, pymemcache
11, pytestCheckHook
12, redis
13}:
14
15buildPythonPackage rec {
16 pname = "Flask-Limiter";
17 version = "1.4";
18
19 src = fetchFromGitHub {
20 owner = "alisaifee";
21 repo = "flask-limiter";
22 rev = version;
23 sha256 = "1k1b4b3s1acphqnar0y5g747bh1y7w35gcl5g819idq2a5vqnass";
24 };
25
26 propagatedBuildInputs = [ flask limits ];
27
28 checkInputs = [
29 pytestCheckHook
30 hiro
31 mock
32 redis
33 flask-restful
34 pymemcache
35 ordereddict
36 ];
37
38 postPatch = ''
39 sed -i "/--cov/d" pytest.ini
40 '';
41
42 # Some tests requires a local Redis instance
43 disabledTests = [
44 "test_fallback_to_memory"
45 "test_reset_unsupported"
46 "test_constructor_arguments_over_config"
47 "test_fallback_to_memory_config"
48 "test_fallback_to_memory_backoff_check"
49 "test_fallback_to_memory_with_global_override"
50 "test_custom_key_prefix"
51 "test_redis_request_slower_than_fixed_window"
52 "test_redis_request_slower_than_moving_window"
53 "test_custom_key_prefix_with_headers"
54 ];
55
56 pythonImportsCheck = [ "flask_limiter" ];
57
58 meta = with lib; {
59 description = "Rate limiting for flask applications";
60 homepage = "https://flask-limiter.readthedocs.org/";
61 license = licenses.mit;
62 };
63}