2021-07-14 22:03:04 +00:00
|
|
|
{ lib
|
|
|
|
, buildPythonPackage
|
|
|
|
, fastapi
|
|
|
|
, fetchFromGitHub
|
|
|
|
, limits
|
|
|
|
, mock
|
|
|
|
, hiro
|
|
|
|
, poetry-core
|
|
|
|
, pytestCheckHook
|
2022-03-05 16:20:37 +00:00
|
|
|
, pythonAtLeast
|
2021-07-14 22:03:04 +00:00
|
|
|
, pythonOlder
|
2023-03-30 22:05:00 +00:00
|
|
|
, pythonRelaxDepsHook
|
2021-07-14 22:03:04 +00:00
|
|
|
, redis
|
|
|
|
, starlette
|
|
|
|
}:
|
|
|
|
|
|
|
|
buildPythonPackage rec {
|
|
|
|
pname = "slowapi";
|
2022-12-17 10:02:37 +00:00
|
|
|
version = "0.1.7";
|
2021-07-14 22:03:04 +00:00
|
|
|
format = "pyproject";
|
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";
|
|
|
|
repo = pname;
|
2022-12-17 10:02:37 +00:00
|
|
|
rev = "refs/tags/v${version}";
|
|
|
|
hash = "sha256-IAB7JW8iVb5M610GVK0POXlSiya22KzNgr26BNvPC4Q=";
|
2021-07-14 22:03:04 +00:00
|
|
|
};
|
|
|
|
|
2023-03-30 22:05:00 +00:00
|
|
|
pythonRelaxDeps = [
|
|
|
|
"limits"
|
|
|
|
];
|
|
|
|
|
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace pyproject.toml \
|
|
|
|
--replace '["redis^3.4.1"]' '["redis"]'
|
|
|
|
'';
|
|
|
|
|
2021-07-14 22:03:04 +00:00
|
|
|
nativeBuildInputs = [
|
|
|
|
poetry-core
|
2023-03-30 22:05:00 +00:00
|
|
|
pythonRelaxDepsHook
|
2021-07-14 22:03:04 +00:00
|
|
|
];
|
|
|
|
|
|
|
|
propagatedBuildInputs = [
|
|
|
|
limits
|
|
|
|
redis
|
|
|
|
];
|
|
|
|
|
2023-02-02 18:25:31 +00:00
|
|
|
nativeCheckInputs = [
|
2021-07-14 22:03:04 +00:00
|
|
|
fastapi
|
|
|
|
hiro
|
|
|
|
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 ];
|
|
|
|
};
|
|
|
|
}
|