about summary refs log tree commit diff
path: root/pkgs/development/python-modules/celery-singleton/default.nix
blob: bb3ac446a60058e374ccb9090da0ed05d11d78ce (plain) (blame)
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
{ lib
, buildPythonPackage
, fetchpatch
, fetchFromGitHub
, poetry-core
, celery
, redis
, pytestCheckHook
, pytest-celery
}:

buildPythonPackage rec {
  pname = "celery-singleton";
  version = "0.3.1";
  format = "pyproject";

  src = fetchFromGitHub {
    owner = "steinitzu";
    repo = "celery-singleton";
    rev = version;
    hash = "sha256-fHlakxxjYIADELZdxIj6rvsZ/+1QfnKvAg3w5cdzvDc=";
  };

  postPatch = ''
    # Disable coverage reporting in tests
    substituteInPlace setup.cfg \
      --replace "--cov" "" \
      --replace "--no-cov-on-fail" ""
  '';

  patches = [
    # chore(poetry): use poetry-core
    # https://github.com/steinitzu/celery-singleton/pull/54
    (fetchpatch {
      name = "use-poetry-core.patch";
      url = "https://github.com/steinitzu/celery-singleton/pull/54/commits/634a001c92a1dff1fae513fc95d733ea9b87e4cf.patch";
      hash = "sha256-lXN4khwyL96pWyBS+iuSkGEkegv4HxYtym+6JUcPa94=";
    })
  ];

  nativeBuildInputs = [
    poetry-core
  ];

  propagatedBuildInputs = [
    celery
    redis
  ];

  checkInputs = [
    pytestCheckHook
    pytest-celery
  ];

  pytestFlagsArray = [ "tests" ];

  # Tests require a running Redis backend
  disabledTests = [
    "TestLock"
    "TestUnlock"
    "TestClear"
    "TestSimpleTask"
    "TestRaiseOnDuplicateConfig"
    "TestUniqueOn"
  ];

  pythonImportsCheck = [ "celery_singleton" ];

  meta = with lib; {
    description = "Seamlessly prevent duplicate executions of celery tasks";
    homepage = "https://github.com/steinitzu/celery-singleton";
    changelog = "https://github.com/steinitzu/celery-singleton/blob/${src.rev}/CHANGELOG.md";
    license = licenses.mit;
    maintainers = with maintainers; [ onny ];
  };
}