1{
2 lib,
3 buildPythonPackage,
4 fetchpatch,
5 fetchFromGitHub,
6 poetry-core,
7 celery,
8 redis,
9 pytestCheckHook,
10 pytest-celery,
11}:
12
13buildPythonPackage rec {
14 pname = "celery-singleton";
15 version = "0.3.1";
16 format = "pyproject";
17
18 src = fetchFromGitHub {
19 owner = "steinitzu";
20 repo = "celery-singleton";
21 rev = version;
22 hash = "sha256-fHlakxxjYIADELZdxIj6rvsZ/+1QfnKvAg3w5cdzvDc=";
23 };
24
25 postPatch = ''
26 # Disable coverage reporting in tests
27 substituteInPlace setup.cfg \
28 --replace "--cov" "" \
29 --replace "--no-cov-on-fail" ""
30 '';
31
32 patches = [
33 # chore(poetry): use poetry-core
34 # https://github.com/steinitzu/celery-singleton/pull/54
35 (fetchpatch {
36 name = "use-poetry-core.patch";
37 url = "https://github.com/steinitzu/celery-singleton/pull/54/commits/634a001c92a1dff1fae513fc95d733ea9b87e4cf.patch";
38 hash = "sha256-lXN4khwyL96pWyBS+iuSkGEkegv4HxYtym+6JUcPa94=";
39 })
40 ];
41
42 nativeBuildInputs = [ poetry-core ];
43
44 propagatedBuildInputs = [
45 celery
46 redis
47 ];
48
49 checkInputs = [
50 pytestCheckHook
51 pytest-celery
52 ];
53
54 pytestFlagsArray = [ "tests" ];
55
56 # Tests require a running Redis backend
57 disabledTests = [
58 "TestLock"
59 "TestUnlock"
60 "TestClear"
61 "TestSimpleTask"
62 "TestRaiseOnDuplicateConfig"
63 "TestUniqueOn"
64 ];
65
66 pythonImportsCheck = [ "celery_singleton" ];
67
68 meta = with lib; {
69 description = "Seamlessly prevent duplicate executions of celery tasks";
70 homepage = "https://github.com/steinitzu/celery-singleton";
71 changelog = "https://github.com/steinitzu/celery-singleton/blob/${src.rev}/CHANGELOG.md";
72 license = licenses.mit;
73 maintainers = with maintainers; [ onny ];
74 };
75}