nixpkgs/pkgs/development/python-modules/slowapi/default.nix
Martin Weinelt 350f26db97 python3Packages.slowapi: backport starlette 1.0 compat
(cherry picked from commit 3385604a84)
2026-06-22 15:10:39 +02:00

64 lines
1.2 KiB
Nix

{
lib,
buildPythonPackage,
fastapi,
fetchFromGitHub,
limits,
mock,
hiro,
httpx,
poetry-core,
pytestCheckHook,
redis,
starlette,
}:
buildPythonPackage rec {
pname = "slowapi";
version = "0.1.9";
pyproject = true;
src = fetchFromGitHub {
owner = "laurentS";
repo = "slowapi";
tag = "v${version}";
hash = "sha256-R/Mr+Qv22AN7HCDGmAUVh4efU8z4gMIyhC0AuKmxgdE=";
};
patches = [
# https://github.com/laurentS/slowapi/pull/279
./starlette-1.0-compat.patch
];
nativeBuildInputs = [ poetry-core ];
propagatedBuildInputs = [
limits
redis
];
nativeCheckInputs = [
fastapi
hiro
httpx
mock
pytestCheckHook
starlette
];
disabledTests = [
# AssertionError: assert '1740326049.9886339' == '1740326049'
"test_headers_no_breach"
"test_headers_breach"
];
pythonImportsCheck = [ "slowapi" ];
meta = {
description = "Python library for API rate limiting";
homepage = "https://github.com/laurentS/slowapi";
changelog = "https://github.com/laurentS/slowapi/blob/v${version}/CHANGELOG.md";
license = with lib.licenses; [ mit ];
maintainers = with lib.maintainers; [ fab ];
};
}