nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at python-updates 87 lines 2.0 kB view raw
1{ 2 lib, 3 buildPythonPackage, 4 fetchFromGitHub, 5 6 # build-system 7 poetry-core, 8 9 # optional dependencies 10 filelock, 11 psycopg, 12 psycopg-pool, 13 redis, 14 15 # test 16 pytestCheckHook, 17 pytest-asyncio, 18 pytest-xdist, 19 redisTestHook, 20}: 21 22buildPythonPackage rec { 23 pname = "pyrate-limiter"; 24 version = "3.9.0"; 25 pyproject = true; 26 27 src = fetchFromGitHub { 28 owner = "vutran1710"; 29 repo = "PyrateLimiter"; 30 tag = "v${version}"; 31 hash = "sha256-CAN3OWxXQaAzrh2q6z0OxPs4i02L/g2ISYFdUMHsHpg="; 32 }; 33 34 postPatch = '' 35 # tests cause too many connections to the postgres server and crash/timeout 36 sed -i "/create_postgres_bucket,/d" tests/conftest.py 37 ''; 38 39 build-system = [ poetry-core ]; 40 41 optional-dependencies = { 42 all = [ 43 filelock 44 redis 45 psycopg 46 psycopg-pool 47 ]; 48 }; 49 50 # Show each test name and track the slowest 51 # This helps with identifying bottlenecks in the test suite 52 # that are causing the build to time out on Hydra. 53 pytestFlags = [ 54 "--durations=10" 55 "-vv" 56 ]; 57 58 nativeCheckInputs = [ 59 pytestCheckHook 60 pytest-asyncio 61 pytest-xdist 62 redisTestHook 63 ] 64 ++ lib.concatAttrValues optional-dependencies; 65 66 disabledTestPaths = [ 67 # Slow: > 1.5 seconds/test run standalone on a fast machine 68 # (Apple M3 Max with highest performance settings and 36GB RAM) 69 # and/or hang under load 70 # https://github.com/vutran1710/PyrateLimiter/issues/245 71 # https://github.com/vutran1710/PyrateLimiter/issues/247 72 "tests/test_bucket_all.py" 73 "tests/test_bucket_factory.py" 74 "tests/test_limiter.py" 75 "tests/test_multiprocessing.py" 76 ]; 77 78 pythonImportsCheck = [ "pyrate_limiter" ]; 79 80 meta = { 81 description = "Python Rate-Limiter using Leaky-Bucket Algorimth Family"; 82 homepage = "https://github.com/vutran1710/PyrateLimiter"; 83 changelog = "https://github.com/vutran1710/PyrateLimiter/blob/${src.tag}/CHANGELOG.md"; 84 license = lib.licenses.mit; 85 maintainers = [ ]; 86 }; 87}