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