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