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