1{
2 lib,
3 aiohttp,
4 bottle,
5 buildPythonPackage,
6 chalice,
7 cherrypy,
8 django,
9 docker,
10 falcon,
11 fastapi,
12 fetchFromGitHub,
13 fetchpatch,
14 flask,
15 flask-sockets,
16 gunicorn,
17 moto,
18 numpy,
19 pyramid,
20 pytest-asyncio,
21 pytestCheckHook,
22 pythonOlder,
23 sanic,
24 setuptools,
25 sanic-testing,
26 slack-sdk,
27 starlette,
28 tornado,
29 uvicorn,
30 websocket-client,
31 websockets,
32 werkzeug,
33}:
34
35buildPythonPackage rec {
36 pname = "slack-bolt";
37 version = "1.18.1";
38 pyproject = true;
39
40 disabled = pythonOlder "3.7";
41
42 src = fetchFromGitHub {
43 owner = "slackapi";
44 repo = "bolt-python";
45 rev = "refs/tags/v${version}";
46 hash = "sha256-UwVStemFVA4hgqnSpCKpQGwLYG+p5z7MwFXXnIhrvNk=";
47 };
48
49 postPatch = ''
50 substituteInPlace setup.py \
51 --replace-fail "pytest-runner==5.2" ""
52 '';
53
54 patches = [
55 # moto >=5 support, https://github.com/slackapi/bolt-python/pull/1046
56 (fetchpatch {
57 name = "moto-support.patch";
58 url = "https://github.com/slackapi/bolt-python/commit/69c2015ef49773de111f184dca9668aefac9e7c0.patch";
59 hash = "sha256-KW7KPeOqanV4n1UOv4DCadplJsqsPY+ju4ry0IvUqpA=";
60 })
61 ];
62
63 build-system = [ setuptools ];
64
65 dependencies = [ slack-sdk ];
66
67 passthru.optional-dependencies = {
68 async = [
69 aiohttp
70 websockets
71 ];
72 adapter = [
73 bottle
74 chalice
75 cherrypy
76 django
77 falcon
78 fastapi
79 flask
80 flask-sockets
81 gunicorn
82 moto
83 pyramid
84 sanic
85 sanic-testing
86 starlette
87 tornado
88 uvicorn
89 websocket-client
90 werkzeug
91 ];
92 };
93
94 nativeCheckInputs = [
95 docker
96 pytest-asyncio
97 pytestCheckHook
98 ] ++ lib.flatten (builtins.attrValues passthru.optional-dependencies);
99
100 preCheck = ''
101 export HOME="$(mktemp -d)"
102 '';
103
104 disabledTestPaths = [
105 # boddle is not packaged as of 2023-07-15
106 "tests/adapter_tests/bottle/"
107 # Tests are blocking at some point. Blocking could be performance-related.
108 "tests/scenario_tests_async/"
109 "tests/slack_bolt_async/"
110 ];
111
112 disabledTests = [
113 # Require network access
114 "test_events"
115 "test_interactions"
116 "test_lazy_listener_calls"
117 "test_lazy_listeners"
118 "test_failure"
119 ];
120
121 pythonImportsCheck = [ "slack_bolt" ];
122
123 meta = with lib; {
124 description = "A framework to build Slack apps using Python";
125 homepage = "https://github.com/slackapi/bolt-python";
126 changelog = "https://github.com/slackapi/bolt-python/releases/tag/v${version}";
127 license = licenses.mit;
128 maintainers = with maintainers; [ samuela ];
129 };
130}