2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fastapi
|
|
|
|
, fetchFromGitHub
|
|
|
|
, limits
|
|
|
|
, mock
|
|
|
|
, hiro
|
2024-02-29 20:09:43 +00:00
|
|
|
, httpx
|
2021-07-14 22:03:04 +00:00
|
|
|
, poetry-core
|
|
|
|
, pytestCheckHook
|
2022-03-05 16:20:37 +00:00
|
|
|
, pythonAtLeast
|
2021-07-14 22:03:04 +00:00
|
|
|
, pythonOlder
|
|
|
|
, redis
|
|
|
|
, starlette
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "slowapi";
|
2024-02-29 20:09:43 +00:00
|
|
|
version = "0.1.9";
|
|
|
|
pyproject = true;
|
2022-03-05 16:20:37 +00:00
|
|
|
|
2022-12-17 10:02:37 +00:00
|
|
|
disabled = pythonOlder "3.7";
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
src = fetchFromGitHub {
|
|
|
|
owner = "laurentS";
|
2024-02-29 20:09:43 +00:00
|
|
|
repo = "slowapi";
|
2022-12-17 10:02:37 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
2024-02-29 20:09:43 +00:00
|
|
|
hash = "sha256-R/Mr+Qv22AN7HCDGmAUVh4efU8z4gMIyhC0AuKmxgdE=";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
limits
|
|
|
|
redis
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-07-14 22:03:04 +00:00
|
|
|
fastapi
|
|
|
|
hiro
|
2024-02-29 20:09:43 +00:00
|
|
|
httpx
|
2021-07-14 22:03:04 +00:00
|
|
|
mock
|
|
|
|
pytestCheckHook
|
|
|
|
starlette
|
|
|
|
];
|
|
|
|
|
2021-09-18 10:52:07 +00:00
|
|
|
disabledTests = [
|
2022-03-05 16:20:37 +00:00
|
|
|
# AssertionError: Regex pattern 'parameter `request` must be an instance of starlette.requests.Request' does not match 'This portal is not running'.
|
2021-09-18 10:52:07 +00:00
|
|
|
"test_endpoint_request_param_invalid"
|
|
|
|
"test_endpoint_response_param_invalid"
|
2022-03-05 16:20:37 +00:00
|
|
|
] ++ lib.optionals (pythonAtLeast "3.10") [
|
|
|
|
"test_multiple_decorators"
|
2021-07-14 22:03:04 +00:00
|
|
|
];
|
|
|
|
|
2022-03-05 16:20:37 +00:00
|
|
|
pythonImportsCheck = [
|
|
|
|
"slowapi"
|
|
|
|
];
|
2021-07-14 22:03:04 +00:00
|
|
|
|
|
|
|
meta = with lib; {
|
|
|
|
description = "Python library for API rate limiting";
|
|
|
|
homepage = "https://github.com/laurentS/slowapi";
|
2022-12-17 10:02:37 +00:00
|
|
|
changelog = "https://github.com/laurentS/slowapi/blob/v${version}/CHANGELOG.md";
|
2021-07-14 22:03:04 +00:00
|
|
|
license = with licenses; [ mit ];
|
|
|
|
maintainers = with maintainers; [ fab ];
|
|
|
|
};
|
|
|
|
}
|