Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at python-updates 124 lines 2.6 kB view raw
1{ 2 lib, 3 stdenv, 4 fetchFromGitHub, 5 fetchpatch, 6 buildPythonPackage, 7 pythonOlder, 8 9 # build-system 10 setuptools, 11 12 # dependencies 13 async-timeout, 14 15 # optional-dependencies 16 cryptography, 17 pyopenssl, 18 requests, 19 20 # tests 21 cachetools, 22 mock, 23 packaging, 24 pytestCheckHook, 25 pytest-asyncio, 26 pytest-timeout, 27 redisTestHook, 28 ujson, 29 uvloop, 30}: 31 32buildPythonPackage rec { 33 pname = "valkey"; 34 version = "6.1.1"; 35 pyproject = true; 36 37 src = fetchFromGitHub { 38 owner = "valkey-io"; 39 repo = "valkey-py"; 40 tag = "v${version}"; 41 hash = "sha256-woJYfgLNIVzTYj9q8IjXo+SXhQZkQdB/Ofv5StGy9Rc="; 42 }; 43 44 patches = [ 45 (fetchpatch { 46 # valkey 9.0 compat 47 url = "https://github.com/valkey-io/valkey-py/commit/c01505e547f614f278b882a016557b6ed652bb9f.patch"; 48 hash = "sha256-rvA65inIioqdc+QV4KaaUv1I/TMZUq0TWaFJcJiy8NU="; 49 }) 50 ]; 51 52 build-system = [ setuptools ]; 53 54 dependencies = lib.optionals (pythonOlder "3.11") [ async-timeout ]; 55 56 optional-dependencies = { 57 # TODO: libvalkey = [ libvalkey ]; 58 ocsp = [ 59 cryptography 60 pyopenssl 61 requests 62 ]; 63 }; 64 65 pythonImportsCheck = [ 66 "valkey" 67 "valkey.client" 68 "valkey.cluster" 69 "valkey.connection" 70 "valkey.exceptions" 71 "valkey.sentinel" 72 "valkey.utils" 73 ]; 74 75 nativeCheckInputs = [ 76 cachetools 77 mock 78 packaging 79 pytestCheckHook 80 pytest-asyncio 81 pytest-timeout 82 redisTestHook 83 ujson 84 uvloop 85 ] 86 ++ lib.concatAttrValues optional-dependencies; 87 88 disabledTestMarks = [ 89 "onlycluster" 90 "ssl" 91 ]; 92 93 disabledTests = [ 94 # valkey.sentinel.MasterNotFoundError: No master found for 'valkey-py-test' 95 "test_get_from_cache" 96 "test_cache_decode_response" 97 # Expects another valkey instance on port 6380 *shrug* 98 "test_psync" 99 ] 100 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 101 # OSError: AF_UNIX path too long 102 "test_uds_connect" 103 "test_network_connection_failure" 104 ] 105 ++ lib.optionals (pythonOlder "3.13") [ 106 # multiple disconnects are counted instead of just one 107 "test_valkey_from_pool" 108 ]; 109 110 disabledTestPaths = lib.optionals stdenv.hostPlatform.isDarwin [ 111 # AttributeError: Can't get local object 'TestMultiprocessing.test_valkey_client.<locals>.target' 112 "tests/test_multiprocessing.py" 113 ]; 114 115 __darwinAllowLocalNetworking = true; 116 117 meta = { 118 description = "Python client for Redis key-value store"; 119 homepage = "https://github.com/valkey-io/valkey-py"; 120 changelog = "https://github.com/valkey-io/valkey-py/releases/tag/${src.tag}"; 121 license = lib.licenses.mit; 122 maintainers = with lib.maintainers; [ hexa ]; 123 }; 124}