1{
2 stdenv,
3 lib,
4 buildPythonPackage,
5 fetchPypi,
6 pythonOlder,
7
8 # build-system
9 setuptools,
10
11 # dependencies
12 billiard,
13 kombu,
14 vine,
15 click,
16 click-didyoumean,
17 click-repl,
18 click-plugins,
19 tzdata,
20 python-dateutil,
21
22 # optional-dependencies
23 google-cloud-storage,
24 moto,
25 msgpack,
26 pymongo,
27 pyyaml,
28
29 # tests
30 pytest-celery,
31 pytest-click,
32 pytest-subtests,
33 pytest-timeout,
34 pytest-xdist,
35 pytestCheckHook,
36 nixosTests,
37}:
38
39buildPythonPackage rec {
40 pname = "celery";
41 version = "5.4.0";
42 pyproject = true;
43
44 disabled = pythonOlder "3.8";
45
46 src = fetchPypi {
47 inherit pname version;
48 hash = "sha256-UEoZFA6NMCnVrK2IMwxUHUw/ZMeJ2F+UdWdi2Lyn5wY=";
49 };
50
51 build-system = [ setuptools ];
52
53 dependencies = [
54 billiard
55 click
56 click-didyoumean
57 click-plugins
58 click-repl
59 kombu
60 python-dateutil
61 tzdata
62 vine
63 ];
64
65 optional-dependencies = {
66 gcs = [ google-cloud-storage ];
67 mongodb = [ pymongo ];
68 msgpack = [ msgpack ];
69 yaml = [ pyyaml ];
70 };
71
72 nativeCheckInputs =
73 [
74 moto
75 pytest-celery
76 pytest-click
77 pytest-subtests
78 pytest-timeout
79 pytest-xdist
80 pytestCheckHook
81 ]
82 # based on https://github.com/celery/celery/blob/main/requirements/test.txt
83 ++ optional-dependencies.yaml
84 ++ optional-dependencies.msgpack
85 ++ optional-dependencies.mongodb
86 ++ optional-dependencies.gcs;
87
88 disabledTestPaths = [
89 # test_eventlet touches network
90 "t/unit/concurrency/test_eventlet.py"
91 # test_multi tries to create directories under /var
92 "t/unit/bin/test_multi.py"
93 "t/unit/apps/test_multi.py"
94 # requires moto<5
95 "t/unit/backends/test_s3.py"
96 ];
97
98 disabledTests =
99 [
100 "msgpack"
101 "test_check_privileges_no_fchown"
102 # seems to only fail on higher core counts
103 # AssertionError: assert 3 == 0
104 "test_setup_security_disabled_serializers"
105 # fails with pytest-xdist
106 "test_itercapture_limit"
107 "test_stamping_headers_in_options"
108 "test_stamping_with_replace"
109 ]
110 ++ lib.optionals stdenv.isDarwin [
111 # too many open files on hydra
112 "test_cleanup"
113 "test_with_autoscaler_file_descriptor_safety"
114 "test_with_file_descriptor_safety"
115 ];
116
117 pythonImportsCheck = [ "celery" ];
118
119 passthru.tests = {
120 inherit (nixosTests) sourcehut;
121 };
122
123 meta = with lib; {
124 description = "Distributed task queue";
125 mainProgram = "celery";
126 homepage = "https://github.com/celery/celery/";
127 changelog = "https://github.com/celery/celery/releases/tag/v${version}";
128 license = licenses.bsd3;
129 maintainers = with maintainers; [ fab ];
130 };
131}