nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 azure-identity,
5 azure-storage-blob,
6 billiard,
7 buildPythonPackage,
8 click-didyoumean,
9 click-plugins,
10 click-repl,
11 click,
12 cryptography,
13 exceptiongroup,
14 fetchFromGitHub,
15 gevent,
16 google-cloud-firestore,
17 google-cloud-storage,
18 kombu,
19 moto,
20 msgpack,
21 pymongo,
22 redis,
23 pydantic,
24 pytest-celery,
25 pytest-click,
26 pytest-timeout,
27 pytest-xdist,
28 pytestCheckHook,
29 python-dateutil,
30 pyyaml,
31 setuptools,
32 tzlocal,
33 vine,
34 # The AMQP REPL depends on click-repl, which is incompatible with our version
35 # of click.
36 withAmqpRepl ? false,
37}:
38
39buildPythonPackage rec {
40 pname = "celery";
41 version = "5.6.2";
42 pyproject = true;
43
44 src = fetchFromGitHub {
45 owner = "celery";
46 repo = "celery";
47 tag = "v${version}";
48 hash = "sha256-S84hLGwVVgxnUB6wnqU58tN56t/tQ79ZUni/iP5sx94=";
49 };
50
51 patches = lib.optionals (!withAmqpRepl) [
52 ./remove-amqp-repl.patch
53 ];
54
55 build-system = [ setuptools ];
56
57 dependencies = [
58 billiard
59 click
60 click-didyoumean
61 click-plugins
62 exceptiongroup
63 kombu
64 python-dateutil
65 tzlocal
66 vine
67 ]
68 ++ lib.optionals withAmqpRepl [
69 click-repl
70 ];
71
72 optional-dependencies = {
73 auth = [ cryptography ];
74 azureblockblob = [
75 azure-identity
76 azure-storage-blob
77 ];
78 gevent = [ gevent ];
79 gcs = [
80 google-cloud-firestore
81 google-cloud-storage
82 ];
83 mongodb = [ pymongo ];
84 msgpack = [ msgpack ];
85 yaml = [ pyyaml ];
86 redis = [ redis ];
87 pydantic = [ pydantic ];
88 };
89
90 nativeCheckInputs = [
91 moto
92 pytest-celery
93 pytest-click
94 pytest-timeout
95 pytest-xdist
96 pytestCheckHook
97 ]
98 ++ lib.concatAttrValues optional-dependencies;
99
100 disabledTestPaths = [
101 # test_eventlet touches network
102 "t/unit/concurrency/test_eventlet.py"
103 # test_multi tries to create directories under /var
104 "t/unit/bin/test_multi.py"
105 "t/unit/apps/test_multi.py"
106 # Test requires moto<5
107 "t/unit/backends/test_s3.py"
108 ];
109
110 disabledTests = [
111 "msgpack"
112 "test_check_privileges_no_fchown"
113 "test_uses_utc_timezone"
114 # seems to only fail on higher core counts
115 # AssertionError: assert 3 == 0
116 "test_setup_security_disabled_serializers"
117 # Test is flaky, especially on hydra
118 "test_ready"
119 # Tests fail with pytest-xdist
120 "test_itercapture_limit"
121 "test_stamping_headers_in_options"
122 "test_stamping_with_replace"
123 # pymongo api compat
124 # TypeError: InvalidDocument.__init__() missing 1 required positional argumen...
125 "test_store_result"
126 "test_store_result_with_request"
127
128 # Celery tries to look up group ID (e.g. 30000)
129 # which does not reliably succeed in the sandbox on linux,
130 # so it throws a security error as if we were running as root.
131 # https://github.com/celery/celery/blob/0527296acb1f1790788301d4395ba6d5ce2a9704/celery/platforms.py#L807-L814
132 "test_regression_worker_startup_info"
133 "test_check_privileges"
134
135 # Flaky: Unclosed temporary file handle under heavy load (as in nixpkgs-review)
136 "test_check_privileges_without_c_force_root_and_no_group_entry"
137 ]
138 ++ lib.optionals stdenv.hostPlatform.isDarwin [
139 # Too many open files on hydra
140 "test_cleanup"
141 "test_with_autoscaler_file_descriptor_safety"
142 "test_with_file_descriptor_safety"
143 ];
144
145 pythonImportsCheck = [ "celery" ];
146
147 meta = {
148 description = "Distributed task queue";
149 homepage = "https://github.com/celery/celery/";
150 changelog = "https://github.com/celery/celery/blob/${src.tag}/Changelog.rst";
151 license = lib.licenses.bsd3;
152 maintainers = with lib.maintainers; [ fab ];
153 mainProgram = "celery";
154 };
155}