1{ 2 lib, 3 arrow, 4 blessed, 5 bson, 6 buildPythonPackage, 7 croniter, 8 django, 9 django-picklefield, 10 django-redis, 11 fetchFromGitHub, 12 hiredis, 13 pkgs, 14 poetry-core, 15 pytest-django, 16 pytestCheckHook, 17 stdenv, 18}: 19 20buildPythonPackage rec { 21 pname = "django-q2"; 22 version = "1.7.6"; 23 pyproject = true; 24 25 src = fetchFromGitHub { 26 owner = "django-q2"; 27 repo = "django-q2"; 28 tag = "v${version}"; 29 hash = "sha256-L2IrLKszo2UCpeioAwI8c636KwQgNCEJjHUDY2Ctv4A="; 30 }; 31 32 postPatch = '' 33 substituteInPlace django_q/tests/settings.py \ 34 --replace-fail "HiredisParser" "_HiredisParser" 35 ''; 36 37 build-system = [ 38 poetry-core 39 ]; 40 41 dependencies = [ 42 arrow 43 bson # required for mongodb but undocumented 44 django 45 django-picklefield 46 ]; 47 48 nativeCheckInputs = [ 49 blessed 50 croniter 51 django-redis 52 # pyredis refuses to load with hiredis<3.0.0 53 (hiredis.overrideAttrs ( 54 new: old: { 55 version = "3.1.0"; 56 src = old.src.override { 57 tag = "v${new.version}"; 58 hash = "sha256-ID5OJdARd2N2GYEpcYOpxenpZlhWnWr5fAClAgqEgGg="; 59 }; 60 } 61 )) 62 pytest-django 63 pytestCheckHook 64 ]; 65 66 pythonImportsCheck = [ "django_q" ]; 67 68 preCheck = '' 69 ${pkgs.valkey}/bin/redis-server & 70 REDIS_PID=$! 71 ''; 72 73 postCheck = '' 74 kill $REDIS_PID 75 ''; 76 77 env = { 78 MONGO_HOST = "127.0.0.1"; 79 REDIS_HOST = "127.0.0.1"; 80 }; 81 82 disabledTests = 83 [ 84 # requires a running mongodb 85 "test_mongo" 86 ] 87 ++ lib.optionals stdenv.hostPlatform.isDarwin [ 88 # fails with an assertion 89 "test_max_rss" 90 "test_recycle" 91 # cannot connect to redis 92 "test_broker" 93 "test_custom" 94 "test_redis" 95 "test_redis_connection" 96 ]; 97 98 disabledTestPaths = [ 99 "django_q/tests/test_commands.py" 100 ]; 101 102 pytestFlagsArray = [ "-vv" ]; 103 104 __darwinAllowLocalNetworking = true; 105 106 meta = { 107 description = "Multiprocessing distributed task queue for Django based on Django-Q"; 108 homepage = "https://github.com/django-q2/django-q2"; 109 changelog = "https://github.com/django-q2/django-q2/releases/tag/v${version}"; 110 license = lib.licenses.mit; 111 maintainers = with lib.maintainers; [ SuperSandro2000 ]; 112 }; 113}