Skip to content

Commit 94c6636

Browse files
authored
Merge pull request #335747 from dotlambda/python3Packages.flask-limiter
python312Packages.flask-limiter: 3.7.0 -> 3.8.0
2 parents 612bdba + a9d8bdc commit 94c6636

File tree

4 files changed

+608
-22
lines changed

4 files changed

+608
-22
lines changed

pkgs/development/python-modules/flask-limiter/default.nix

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
ordered-set,
1010
pymemcache,
1111
pymongo,
12+
pytest-cov-stub,
1213
pytest-mock,
1314
pytestCheckHook,
1415
pythonOlder,
@@ -20,28 +21,27 @@
2021

2122
buildPythonPackage rec {
2223
pname = "flask-limiter";
23-
version = "3.7.0";
24+
version = "3.8.0";
2425
pyproject = true;
2526

26-
disabled = pythonOlder "3.7";
27+
disabled = pythonOlder "3.8";
2728

2829
src = fetchFromGitHub {
2930
owner = "alisaifee";
3031
repo = "flask-limiter";
3132
rev = "refs/tags/${version}";
32-
hash = "sha256-W40zuQ/xkoV35DXehwMUJwbX0grJMfRXawiPfpRKL/g=";
33+
hash = "sha256-RkeG5XdanSp2syKrQgYUZ4r8D28Zt33/MsW0UxWxaU0=";
3334
};
3435

3536
postPatch = ''
36-
sed -i "/--cov/d" pytest.ini
37-
3837
# flask-restful is unmaintained and breaks regularly, don't depend on it
39-
sed -i "/import flask_restful/d" tests/test_views.py
38+
substituteInPlace tests/test_views.py \
39+
--replace-fail "import flask_restful" ""
4040
'';
4141

42-
nativeBuildInputs = [ setuptools ];
42+
build-system = [ setuptools ];
4343

44-
propagatedBuildInputs = [
44+
dependencies = [
4545
flask
4646
limits
4747
ordered-set
@@ -57,6 +57,7 @@ buildPythonPackage rec {
5757

5858
nativeCheckInputs = [
5959
asgiref
60+
pytest-cov-stub
6061
pytest-mock
6162
pytestCheckHook
6263
hiro

pkgs/development/python-modules/limits/default.nix

Lines changed: 25 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,16 @@
66
deprecated,
77
etcd3,
88
fetchFromGitHub,
9+
fetchpatch2,
10+
flaky,
911
hiro,
1012
importlib-resources,
1113
motor,
1214
packaging,
1315
pymemcache,
1416
pymongo,
1517
pytest-asyncio,
18+
pytest-benchmark,
1619
pytest-lazy-fixture,
1720
pytestCheckHook,
1821
pythonOlder,
@@ -23,10 +26,10 @@
2326

2427
buildPythonPackage rec {
2528
pname = "limits";
26-
version = "3.12.0";
29+
version = "3.13.0";
2730
pyproject = true;
2831

29-
disabled = pythonOlder "3.7";
32+
disabled = pythonOlder "3.8";
3033

3134
src = fetchFromGitHub {
3235
owner = "alisaifee";
@@ -38,9 +41,20 @@ buildPythonPackage rec {
3841
postFetch = ''
3942
rm "$out/limits/_version.py"
4043
'';
41-
hash = "sha256-EH2/75tcKuS11XKuo4lCQrFe4/XJZpcWhuGlSuhIk18=";
44+
hash = "sha256-y5iMx+AC52ZgGvAvThRaeKFqCGkwmukyZsJ+nzR2AFM=";
4245
};
4346

47+
patches = [
48+
(fetchpatch2 {
49+
name = "fix-incompatibility-with-latest-pytest-asyncio.patch";
50+
url = "https://github.com/alisaifee/limits/commit/f6dcdb253cd44ca8dc7380c481da1afd8b57af6b.patch";
51+
excludes = [ "requirements/test.txt" ];
52+
hash = "sha256-NwtN8WHNrwsRcIq18pRjzzGmm7XCzn6O5y+jo9Qr6iQ=";
53+
})
54+
./remove-fixed-start-from-async-tests.patch
55+
./only-test-in-memory.patch
56+
];
57+
4458
postPatch = ''
4559
substituteInPlace pytest.ini \
4660
--replace-fail "--cov=limits" "" \
@@ -53,16 +67,16 @@ buildPythonPackage rec {
5367
echo 'def get_versions(): return {"version": "${version}"}' > limits/_version.py
5468
'';
5569

56-
nativeBuildInputs = [ setuptools ];
70+
build-system = [ setuptools ];
5771

58-
propagatedBuildInputs = [
72+
dependencies = [
5973
deprecated
6074
importlib-resources
6175
packaging
6276
typing-extensions
6377
];
6478

65-
passthru.optional-dependencies = {
79+
optional-dependencies = {
6680
redis = [ redis ];
6781
rediscluster = [ redis ];
6882
memcached = [ pymemcache ];
@@ -79,20 +93,17 @@ buildPythonPackage rec {
7993
doCheck = pythonOlder "3.12"; # SystemError in protobuf
8094

8195
nativeCheckInputs = [
96+
flaky
8297
hiro
8398
pytest-asyncio
99+
pytest-benchmark
84100
pytest-lazy-fixture
85101
pytestCheckHook
86-
] ++ lib.flatten (lib.attrValues passthru.optional-dependencies);
102+
] ++ lib.flatten (lib.attrValues optional-dependencies);
87103

88-
pythonImportsCheck = [ "limits" ];
104+
disabledTests = [ "test_moving_window_memcached" ];
89105

90-
pytestFlagsArray = [
91-
# All other tests require a running Docker instance
92-
"tests/test_limits.py"
93-
"tests/test_ratelimit_parser.py"
94-
"tests/test_limit_granularities.py"
95-
];
106+
pythonImportsCheck = [ "limits" ];
96107

97108
meta = with lib; {
98109
description = "Rate limiting using various strategies and storage backends such as redis & memcached";

0 commit comments

Comments
 (0)