1{ lib
2, stdenv
3, buildPythonPackage
4, pythonOlder
5, fetchFromGitHub
6, gevent
7, pika
8, prometheus-client
9, pylibmc
10, pytestCheckHook
11, redis
12, watchdog
13, watchdog-gevent
14}:
15
16buildPythonPackage rec {
17 pname = "dramatiq";
18 version = "1.15.0";
19 format = "setuptools";
20
21 disabled = pythonOlder "3.7";
22
23 src = fetchFromGitHub {
24 owner = "Bogdanp";
25 repo = "dramatiq";
26 rev = "refs/tags/v${version}";
27 hash = "sha256-uhradhLIyfHf1meAr7ChuGnvm62mX/lkQQ2Pe7hBWtY=";
28 };
29
30 propagatedBuildInputs = [
31 prometheus-client
32 ];
33
34 passthru.optional-dependencies = {
35 all = [
36 gevent
37 pika
38 pylibmc
39 redis
40 watchdog
41 watchdog-gevent
42 ];
43 gevent = [
44 gevent
45 ];
46 memcached = [
47 pylibmc
48 ];
49 rabbitmq = [
50 pika
51 ];
52 redis = [
53 redis
54 ];
55 watch = [
56 watchdog
57 watchdog-gevent
58 ];
59 };
60
61 nativeCheckInputs = [ pytestCheckHook pika redis pylibmc ];
62
63 postPatch = ''
64 sed -i ./setup.cfg \
65 -e 's:--cov dramatiq::' \
66 -e 's:--cov-report html::' \
67 -e 's:--benchmark-autosave::' \
68 -e 's:--benchmark-compare::' \
69 '';
70
71 disabledTests = [
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 ] ++ lib.optionals stdenv.isDarwin [
94 # Takes too long for darwin ofborg
95 "test_retry_exceptions_can_specify_a_delay"
96 ];
97
98 pythonImportsCheck = [ "dramatiq" ];
99
100 meta = with lib; {
101 description = "Background Processing for Python 3";
102 homepage = "https://github.com/Bogdanp/dramatiq";
103 license = licenses.gpl3Only;
104 maintainers = with maintainers; [ traxys ];
105 };
106}