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