1{ 2 lib, 3 aiohttp, 4 aiomcache, 5 buildPythonPackage, 6 fetchFromGitHub, 7 marshmallow, 8 msgpack, 9 pkgs, 10 pythonOlder, 11 pytest-asyncio, 12 pytest-mock, 13 pytestCheckHook, 14 redis, 15 setuptools, 16}: 17 18buildPythonPackage rec { 19 pname = "aiocache"; 20 version = "0.12.2"; 21 pyproject = true; 22 23 disabled = pythonOlder "3.7"; 24 25 src = fetchFromGitHub { 26 owner = "aio-libs"; 27 repo = "aiocache"; 28 rev = "refs/tags/v${version}"; 29 hash = "sha256-yvXDNJL8uxReaU81klVWudJwh1hmvg5GeeILcNpm/YA="; 30 }; 31 32 postPatch = '' 33 substituteInPlace setup.cfg \ 34 --replace-fail "--cov=aiocache --cov=tests/ --cov-report term" "" 35 ''; 36 37 build-system = [ setuptools ]; 38 39 optional-dependencies = { 40 redis = [ redis ]; 41 memcached = [ aiomcache ]; 42 msgpack = [ msgpack ]; 43 }; 44 45 nativeCheckInputs = [ 46 aiohttp 47 marshmallow 48 pytest-asyncio 49 pytest-mock 50 pytestCheckHook 51 ] ++ lib.flatten (lib.attrValues optional-dependencies); 52 53 pytestFlagsArray = [ 54 "-W" 55 "ignore::DeprecationWarning" 56 # TypeError: object MagicMock can't be used in 'await' expression 57 "--deselect=tests/ut/backends/test_redis.py::TestRedisBackend::test_close" 58 ]; 59 60 disabledTests = [ 61 # calls apache benchmark and fails, no usable output 62 "test_concurrency_error_rates" 63 ]; 64 65 preCheck = '' 66 ${lib.getBin pkgs.redis}/bin/redis-server & 67 REDIS_PID=$! 68 69 ${lib.getBin pkgs.memcached}/bin/memcached & 70 MEMCACHED_PID=$! 71 ''; 72 73 postCheck = '' 74 kill $REDIS_PID 75 kill $MEMCACHED_PID 76 ''; 77 78 __darwinAllowLocalNetworking = true; 79 80 pythonImportsCheck = [ "aiocache" ]; 81 82 meta = with lib; { 83 description = "Python API Rate Limit Decorator"; 84 homepage = "https://github.com/aio-libs/aiocache"; 85 changelog = "https://github.com/aio-libs/aiocache/releases/tag/v${version}"; 86 license = with licenses; [ bsd3 ]; 87 maintainers = with maintainers; [ fab ]; 88 }; 89}