1{ lib
2, buildPythonPackage
3, fastapi
4, fetchFromGitHub
5, limits
6, mock
7, hiro
8, poetry-core
9, pytestCheckHook
10, pythonOlder
11, redis
12, starlette
13}:
14
15buildPythonPackage rec {
16 pname = "slowapi";
17 version = "0.1.5";
18 format = "pyproject";
19 disabled = pythonOlder "3.6";
20
21 src = fetchFromGitHub {
22 owner = "laurentS";
23 repo = pname;
24 rev = "v${version}";
25 sha256 = "1wjnlhjfgil86h6i5yij723ncg18rqdprs1q6i68w4msaspwpxg9";
26 };
27
28 nativeBuildInputs = [
29 poetry-core
30 ];
31
32 propagatedBuildInputs = [
33 limits
34 redis
35 ];
36
37 checkInputs = [
38 fastapi
39 hiro
40 mock
41 pytestCheckHook
42 starlette
43 ];
44
45 disabledTests = [
46 # E AssertionError: Regex pattern 'parameter `request` must be an instance of starlette.requests.Request' does not match 'This portal is not running'.
47 "test_endpoint_request_param_invalid"
48 "test_endpoint_response_param_invalid"
49 ];
50
51 pythonImportsCheck = [ "slowapi" ];
52
53 meta = with lib; {
54 description = "Python library for API rate limiting";
55 homepage = "https://github.com/laurentS/slowapi";
56 license = with licenses; [ mit ];
57 maintainers = with maintainers; [ fab ];
58 };
59}