1{ lib 2, buildPythonPackage 3, fastapi 4, fetchFromGitHub 5, limits 6, mock 7, hiro 8, poetry-core 9, pytestCheckHook 10, pythonAtLeast 11, pythonOlder 12, pythonRelaxDepsHook 13, redis 14, starlette 15}: 16 17buildPythonPackage rec { 18 pname = "slowapi"; 19 version = "0.1.8"; 20 format = "pyproject"; 21 22 disabled = pythonOlder "3.7"; 23 24 src = fetchFromGitHub { 25 owner = "laurentS"; 26 repo = pname; 27 rev = "refs/tags/v${version}"; 28 hash = "sha256-xgHz8b95SXf/GwzKPfQ/RHbUNJfCx6+7a2HB8+6hjsw="; 29 }; 30 31 pythonRelaxDeps = [ 32 "limits" 33 ]; 34 35 postPatch = '' 36 substituteInPlace pyproject.toml \ 37 --replace '["redis^3.4.1"]' '["redis"]' 38 ''; 39 40 nativeBuildInputs = [ 41 poetry-core 42 pythonRelaxDepsHook 43 ]; 44 45 propagatedBuildInputs = [ 46 limits 47 redis 48 ]; 49 50 nativeCheckInputs = [ 51 fastapi 52 hiro 53 mock 54 pytestCheckHook 55 starlette 56 ]; 57 58 disabledTests = [ 59 # AssertionError: Regex pattern 'parameter `request` must be an instance of starlette.requests.Request' does not match 'This portal is not running'. 60 "test_endpoint_request_param_invalid" 61 "test_endpoint_response_param_invalid" 62 ] ++ lib.optionals (pythonAtLeast "3.10") [ 63 "test_multiple_decorators" 64 ]; 65 66 pythonImportsCheck = [ 67 "slowapi" 68 ]; 69 70 meta = with lib; { 71 description = "Python library for API rate limiting"; 72 homepage = "https://github.com/laurentS/slowapi"; 73 changelog = "https://github.com/laurentS/slowapi/blob/v${version}/CHANGELOG.md"; 74 license = with licenses; [ mit ]; 75 maintainers = with maintainers; [ fab ]; 76 }; 77}