1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 filelock, 6 poetry-core, 7 psycopg, 8 psycopg-pool, 9 pytestCheckHook, 10 pytest-asyncio, 11 pytest-xdist, 12 redis, 13 redisTestHook, 14}: 15 16buildPythonPackage rec { 17 pname = "pyrate-limiter"; 18 version = "3.9.0"; 19 pyproject = true; 20 21 src = fetchFromGitHub { 22 owner = "vutran1710"; 23 repo = "PyrateLimiter"; 24 tag = "v${version}"; 25 hash = "sha256-CAN3OWxXQaAzrh2q6z0OxPs4i02L/g2ISYFdUMHsHpg="; 26 }; 27 28 postPatch = '' 29 # tests cause too many connections to the postgres server and crash/timeout 30 sed -i "/create_postgres_bucket,/d" tests/conftest.py 31 ''; 32 33 build-system = [ poetry-core ]; 34 35 optional-dependencies = { 36 all = [ 37 filelock 38 redis 39 psycopg 40 psycopg-pool 41 ]; 42 }; 43 44 nativeCheckInputs = [ 45 pytestCheckHook 46 pytest-asyncio 47 pytest-xdist 48 redisTestHook 49 ] 50 ++ lib.flatten (lib.attrValues optional-dependencies); 51 52 disabledTests = [ 53 # hangs 54 "test_limiter_01" 55 ]; 56 57 pythonImportsCheck = [ "pyrate_limiter" ]; 58 59 meta = with lib; { 60 description = "Python Rate-Limiter using Leaky-Bucket Algorimth Family"; 61 homepage = "https://github.com/vutran1710/PyrateLimiter"; 62 changelog = "https://github.com/vutran1710/PyrateLimiter/blob/${src.tag}/CHANGELOG.md"; 63 license = licenses.mit; 64 maintainers = with maintainers; [ kranzes ]; 65 }; 66}