From 017b6667744e1e65da3e9fbc18aa16d7c744e22c Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Sun, 2 Nov 2025 20:47:08 -0800 Subject: [PATCH 1/2] python3Packages.pyrate-limiter: cleanup --- .../python-modules/pyrate-limiter/default.nix | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/pkgs/development/python-modules/pyrate-limiter/default.nix b/pkgs/development/python-modules/pyrate-limiter/default.nix index 3d15ac47bd26..c29fb157153e 100644 --- a/pkgs/development/python-modules/pyrate-limiter/default.nix +++ b/pkgs/development/python-modules/pyrate-limiter/default.nix @@ -2,14 +2,20 @@ lib, buildPythonPackage, fetchFromGitHub, - filelock, + + # build-system poetry-core, + + # optional dependencies + filelock, psycopg, psycopg-pool, + redis, + + # test pytestCheckHook, pytest-asyncio, pytest-xdist, - redis, redisTestHook, }: @@ -56,11 +62,11 @@ buildPythonPackage rec { pythonImportsCheck = [ "pyrate_limiter" ]; - meta = with lib; { + meta = { description = "Python Rate-Limiter using Leaky-Bucket Algorimth Family"; homepage = "https://github.com/vutran1710/PyrateLimiter"; changelog = "https://github.com/vutran1710/PyrateLimiter/blob/${src.tag}/CHANGELOG.md"; - license = licenses.mit; - maintainers = with maintainers; [ kranzes ]; + license = lib.licenses.mit; + maintainers = with lib.maintainers; [ kranzes ]; }; } From 65de4fb0f9d910075e9458bbb0003729caaa657a Mon Sep 17 00:00:00 2001 From: Sarah Clark Date: Sun, 2 Nov 2025 20:56:46 -0800 Subject: [PATCH 2/2] python3Packages.pyrate-limiter: disable tests that time out and/or fail under load --- .../python-modules/pyrate-limiter/default.nix | 21 ++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/pkgs/development/python-modules/pyrate-limiter/default.nix b/pkgs/development/python-modules/pyrate-limiter/default.nix index c29fb157153e..95261eed47c2 100644 --- a/pkgs/development/python-modules/pyrate-limiter/default.nix +++ b/pkgs/development/python-modules/pyrate-limiter/default.nix @@ -47,6 +47,14 @@ buildPythonPackage rec { ]; }; + # Show each test name and track the slowest + # This helps with identifying bottlenecks in the test suite + # that are causing the build to time out on Hydra. + pytestFlags = [ + "--durations=10" + "-vv" + ]; + nativeCheckInputs = [ pytestCheckHook pytest-asyncio @@ -55,9 +63,16 @@ buildPythonPackage rec { ] ++ lib.flatten (lib.attrValues optional-dependencies); - disabledTests = [ - # hangs - "test_limiter_01" + disabledTestPaths = [ + # Slow: > 1.5 seconds/test run standalone on a fast machine + # (Apple M3 Max with highest performance settings and 36GB RAM) + # and/or hang under load + # https://github.com/vutran1710/PyrateLimiter/issues/245 + # https://github.com/vutran1710/PyrateLimiter/issues/247 + "tests/test_bucket_all.py" + "tests/test_bucket_factory.py" + "tests/test_limiter.py" + "tests/test_multiprocessing.py" ]; pythonImportsCheck = [ "pyrate_limiter" ];