1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
{
lib,
buildPythonPackage,
croniter,
dj-database-url,
django-valkey,
django,
fetchFromGitLab,
hatchling,
orjson,
postgresql,
postgresqlTestHook,
prometheus-client,
psycopg,
pytest-asyncio,
pytest-django,
pytestCheckHook,
pythonOlder,
redisTestHook,
valkey,
zstandard,
}:
buildPythonPackage rec {
pname = "django-vtasks";
version = "1.0.3";
pyproject = true;
src = fetchFromGitLab {
owner = "glitchtip";
repo = "django-vtasks";
tag = "v${version}";
hash = "sha256-75W63HsLBT4EPQCiAXjd9qr6n07/2e5GCUNWeDzXUq0=";
};
postPatch = ''
# upstream does not use pytest to run the tests, but we just need to patch one async test to do so
substituteInPlace scripts/test_stale_conn.py \
--replace-fail "import asyncio" "import asyncio; import pytest" \
--replace-fail "async def test_async_stale_connection():" "@pytest.mark.asyncio
async def test_async_stale_connection():"
'';
build-system = [ hatchling ];
dependencies = [
django
orjson
croniter
]
++ lib.optional (pythonOlder "3.14") zstandard;
optional-dependencies = {
metrics = [ prometheus-client ];
valkey = [ valkey ] ++ valkey.optional-dependencies.libvalkey;
};
pythonImportsCheck = [ "django_vtasks" ];
env = {
DATABASE_URL = "postgresql://postgres@%2Fbuild%2Frun%2Fpostgresql";
VALKEY_URL = "redis://127.0.0.1:6379";
};
nativeCheckInputs = [
django # must come first as vtasks only works with django 6
dj-database-url
django-valkey
postgresql
postgresqlTestHook
psycopg
pytest-asyncio
pytest-django
pytestCheckHook
redisTestHook # contains valkey
];
meta = {
description = "Very fast valkey/postgres django tasks backend";
homepage = "https://gitlab.com/glitchtip/django-vtasks";
changelog = "https://gitlab.com/glitchtip/django-vtasks/-/releases/${src.tag}";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [
defelo
felbinger
];
broken = lib.versionOlder (lib.versions.major django.version) "6";
};
}
|