1{ 2 lib, 3 fetchFromGitHub, 4 pythonOlder, 5 buildPythonPackage, 6 setuptools, 7 8 # propagated 9 django, 10 hiredis, 11 lz4, 12 msgpack, 13 redis, 14 15 # testing 16 pkgs, 17 pytest-django, 18 pytest-mock, 19 pytestCheckHook, 20}: 21 22buildPythonPackage rec { 23 pname = "django-redis"; 24 version = "5.4.0"; 25 pyproject = true; 26 27 disabled = pythonOlder "3.6"; 28 29 src = fetchFromGitHub { 30 owner = "jazzband"; 31 repo = "django-redis"; 32 rev = "refs/tags/${version}"; 33 hash = "sha256-m7z3c7My24vrSSnyfDQ/LlWhy7pV4U0L8LATMvkfczc="; 34 }; 35 36 postPatch = '' 37 sed -i '/-cov/d' setup.cfg 38 ''; 39 40 nativeBuildInputs = [ setuptools ]; 41 42 propagatedBuildInputs = [ 43 django 44 lz4 45 msgpack 46 redis 47 ]; 48 49 passthru.optional-dependencies = { 50 hiredis = [ redis ] ++ redis.optional-dependencies.hiredis; 51 }; 52 53 pythonImportsCheck = [ "django_redis" ]; 54 55 DJANGO_SETTINGS_MODULE = "tests.settings.sqlite"; 56 57 preCheck = '' 58 ${pkgs.redis}/bin/redis-server & 59 REDIS_PID=$! 60 ''; 61 62 postCheck = '' 63 kill $REDIS_PID 64 ''; 65 66 nativeCheckInputs = [ 67 pytest-django 68 pytest-mock 69 pytestCheckHook 70 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies); 71 72 pytestFlagsArray = [ 73 "-W" 74 "ignore::DeprecationWarning" 75 ]; 76 77 disabledTests = [ 78 # ModuleNotFoundError: No module named 'test_cache_options' 79 "test_custom_key_function" 80 # ModuleNotFoundError: No module named 'test_client' 81 "test_delete_pattern_calls_delete_for_given_keys" 82 "test_delete_pattern_calls_get_client_given_no_client" 83 "test_delete_pattern_calls_make_pattern" 84 "test_delete_pattern_calls_pipeline_delete_and_execute" 85 "test_delete_pattern_calls_scan_iter" 86 "test_delete_pattern_calls_scan_iter_with_count_if_itersize_given" 87 ]; 88 89 meta = with lib; { 90 description = "Full featured redis cache backend for Django"; 91 homepage = "https://github.com/jazzband/django-redis"; 92 changelog = "https://github.com/jazzband/django-redis/releases/tag/${version}"; 93 license = licenses.bsd3; 94 maintainers = with maintainers; [ hexa ]; 95 }; 96}