1{
2 lib,
3 fetchFromGitHub,
4 pythonOlder,
5 buildPythonPackage,
6 setuptools,
7
8 # propagated
9 django,
10 lz4,
11 msgpack,
12 pyzstd,
13 redis,
14
15 # testing
16 pytest-cov-stub,
17 pytest-django,
18 pytest-mock,
19 pytest-xdist,
20 pytestCheckHook,
21 redisTestHook,
22}:
23
24buildPythonPackage rec {
25 pname = "django-redis";
26 version = "6.0.0";
27 pyproject = true;
28
29 disabled = pythonOlder "3.6";
30
31 src = fetchFromGitHub {
32 owner = "jazzband";
33 repo = "django-redis";
34 tag = version;
35 hash = "sha256-QfiyeeDQSRp/TkOun/HAQaPbIUY9yKPoOOEhKBX9Tec=";
36 };
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 django
42 lz4
43 msgpack
44 pyzstd
45 redis
46 ];
47
48 optional-dependencies = {
49 hiredis = [ redis ] ++ redis.optional-dependencies.hiredis;
50 };
51
52 pythonImportsCheck = [ "django_redis" ];
53
54 preCheck = ''
55 export DJANGO_SETTINGS_MODULE=tests.settings.sqlite
56 '';
57
58 nativeCheckInputs = [
59 pytest-cov-stub
60 pytest-django
61 pytest-mock
62 pytest-xdist
63 pytestCheckHook
64 redisTestHook
65 ]
66 ++ lib.flatten (lib.attrValues optional-dependencies);
67
68 # https://github.com/jazzband/django-redis/issues/777
69 dontUsePytestXdist = true;
70
71 pytestFlags = [
72 "-Wignore::DeprecationWarning"
73 ];
74
75 disabledTests = [
76 # AttributeError: <asgiref.local._CVar object at 0x7ffff57ed950> object has no attribute 'default'
77 "test_delete_pattern_with_settings_default_scan_count"
78 ];
79
80 __darwinAllowLocalNetworking = true;
81
82 meta = with lib; {
83 description = "Full featured redis cache backend for Django";
84 homepage = "https://github.com/jazzband/django-redis";
85 changelog = "https://github.com/jazzband/django-redis/releases/tag/${version}";
86 license = licenses.bsd3;
87 maintainers = with maintainers; [ hexa ];
88 };
89}