1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 pythonOlder,
6 fetchFromGitHub,
7 gevent,
8 pika,
9 prometheus-client,
10 pylibmc,
11 pytestCheckHook,
12 pytest-cov-stub,
13 redis,
14 setuptools,
15 watchdog,
16 watchdog-gevent,
17}:
18
19buildPythonPackage rec {
20 pname = "dramatiq";
21 version = "1.18.0";
22 pyproject = true;
23
24 disabled = pythonOlder "3.9";
25
26 src = fetchFromGitHub {
27 owner = "Bogdanp";
28 repo = "dramatiq";
29 tag = "v${version}";
30 hash = "sha256-noq2tWi7IUdYmRB9N3MN9oWrnNaYBgXFumOpcGw8Jn0=";
31 };
32
33 build-system = [ setuptools ];
34
35 dependencies = [ prometheus-client ];
36
37 optional-dependencies = {
38 all = [
39 gevent
40 pika
41 pylibmc
42 redis
43 watchdog
44 watchdog-gevent
45 ];
46 gevent = [ gevent ];
47 memcached = [ pylibmc ];
48 rabbitmq = [ pika ];
49 redis = [ redis ];
50 watch = [
51 watchdog
52 watchdog-gevent
53 ];
54 };
55
56 nativeCheckInputs = [
57 pytestCheckHook
58 pytest-cov-stub
59 pika
60 redis
61 pylibmc
62 ];
63
64 postPatch = ''
65 sed -i ./setup.cfg \
66 -e 's:--benchmark-autosave::' \
67 -e 's:--benchmark-compare::' \
68 '';
69
70 disabledTests = [
71 # Requires a running redis
72 "test_after_process_boot_call_has_no_blocked_signals"
73 "test_cli_can_be_reloaded_on_sighup"
74 "test_cli_can_watch_for_source_code_changes"
75 "test_cli_fork_functions_have_no_blocked_signals"
76 "test_consumer_threads_have_no_blocked_signals"
77 "test_middleware_fork_functions_have_no_blocked_signals"
78 "test_redis_broker_can_connect_via_client"
79 "test_redis_broker_can_connect_via_url"
80 "test_redis_process_100k_messages_with_cli"
81 "test_redis_process_10k_fib_with_cli"
82 "test_redis_process_1k_latency_with_cli"
83 "test_worker_threads_have_no_blocked_signals"
84 # Requires a running rabbitmq
85 "test_rabbitmq_broker_can_be_passed_a_list_of_parameters_for_failover"
86 "test_rabbitmq_broker_can_be_passed_a_list_of_uri_for_failover"
87 "test_rabbitmq_broker_can_be_passed_a_semicolon_separated_list_of_uris"
88 "test_rabbitmq_broker_connections_are_lazy"
89 "test_rabbitmq_process_100k_messages_with_cli"
90 "test_rabbitmq_process_10k_fib_with_cli"
91 "test_rabbitmq_process_1k_latency_with_cli"
92 # AssertionError
93 "test_cli_scrubs_stale_pid_files"
94 "test_message_contains_requeue_time_after_retry"
95 ]
96 ++ lib.optionals stdenv.hostPlatform.isDarwin [
97 # Takes too long for darwin ofborg
98 "test_retry_exceptions_can_specify_a_delay"
99 ];
100
101 pythonImportsCheck = [ "dramatiq" ];
102
103 meta = with lib; {
104 description = "Background Processing for Python 3";
105 homepage = "https://github.com/Bogdanp/dramatiq";
106 license = licenses.gpl3Only;
107 maintainers = with maintainers; [ traxys ];
108 };
109}