@@ -0,0 +1,63 @@
1+{ lib
2+, buildPythonPackage
3+, fastapi
4+, fetchFromGitHub
5+, fetchpatch
6+, limits
7+, mock
8+, hiro
9+, poetry-core
10+, pytestCheckHook
11+, pythonOlder
12+, redis
13+, starlette
14+}:
15+
16+buildPythonPackage rec {
17+ pname = "slowapi";
18+ version = "0.1.4";
19+ format = "pyproject";
20+ disabled = pythonOlder "3.6";
21+
22+ src = fetchFromGitHub {
23+ owner = "laurentS";
24+ repo = pname;
25+ rev = "v${version}";
26+ sha256 = "0bnnzgv2wy145sdab54hljwv1b5029ndrr0y9rc2q0mraz8lf8lm";
27+ };
28+
29+ nativeBuildInputs = [
30+ poetry-core
31+ ];
32+
33+ propagatedBuildInputs = [
34+ limits
35+ redis
36+ ];
37+
38+ checkInputs = [
39+ fastapi
40+ hiro
41+ mock
42+ pytestCheckHook
43+ starlette
44+ ];
45+
46+ patches = [
47+ # Switch to poetry-core, https://github.com/laurentS/slowapi/pull/54
48+ (fetchpatch {
49+ name = "switch-to-poetry-core.patch";
50+ url = "https://github.com/laurentS/slowapi/commit/fe165f2d479f4f8e4b7dd9cd88ec0ae847b490c5.patch";
51+ sha256 = "16vjxdjjiyg8zjrgfyg9q2ym2lmnms2zy5d2cg3ccg51cfl715fi";
52+ })
53+ ];
54+
55+ pythonImportsCheck = [ "slowapi" ];
56+
57+ meta = with lib; {
58+ description = "Python library for API rate limiting";
59+ homepage = "https://github.com/laurentS/slowapi";
60+ license = with licenses; [ mit ];
61+ maintainers = with maintainers; [ fab ];
62+ };
63+}