1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5
6 # build-system
7 setuptools,
8
9 # dependencies
10 slack-sdk,
11
12 # optional-dependencies
13 # - async
14 aiohttp,
15 websockets,
16 # - adapter
17 bottle,
18 chalice,
19 cherrypy,
20 django,
21 falcon,
22 fastapi,
23 flask,
24 gunicorn,
25 moto,
26 pyramid,
27 sanic,
28 sanic-testing,
29 starlette,
30 tornado,
31 uvicorn,
32 websocket-client,
33 werkzeug,
34
35 # tests
36 docker,
37 pytest-asyncio,
38 pytestCheckHook,
39}:
40
41buildPythonPackage rec {
42 pname = "slack-bolt";
43 version = "1.23.0";
44 pyproject = true;
45
46 src = fetchFromGitHub {
47 owner = "slackapi";
48 repo = "bolt-python";
49 tag = "v${version}";
50 hash = "sha256-Aq7vLkrTeBVsY+xVwQhFmSqq8ik0yHEmPANtKyJZKTw=";
51 };
52
53 postPatch = ''
54 substituteInPlace pyproject.toml \
55 --replace-fail '"pytest-runner==6.0.1",' ""
56 '';
57
58 build-system = [ setuptools ];
59
60 dependencies = [ slack-sdk ];
61
62 optional-dependencies = {
63 async = [
64 aiohttp
65 websockets
66 ];
67 adapter = [
68 bottle
69 chalice
70 cherrypy
71 django
72 falcon
73 fastapi
74 flask
75 gunicorn
76 moto
77 pyramid
78 sanic
79 sanic-testing
80 starlette
81 tornado
82 uvicorn
83 websocket-client
84 werkzeug
85 ];
86 };
87
88 pythonImportsCheck = [ "slack_bolt" ];
89
90 nativeCheckInputs = [
91 docker
92 pytest-asyncio
93 pytestCheckHook
94 ]
95 ++ lib.flatten (builtins.attrValues optional-dependencies);
96
97 preCheck = ''
98 export HOME="$(mktemp -d)"
99 '';
100
101 __darwinAllowLocalNetworking = true;
102
103 disabledTestPaths = [
104 # boddle is not packaged as of 2023-07-15
105 "tests/adapter_tests/bottle/"
106 ];
107
108 disabledTests = [
109 # Require network access
110 "test_failure"
111 # TypeError
112 "test_oauth"
113 ];
114
115 meta = {
116 description = "Framework to build Slack apps using Python";
117 homepage = "https://github.com/slackapi/bolt-python";
118 changelog = "https://github.com/slackapi/bolt-python/releases/tag/${src.tag}";
119 license = lib.licenses.mit;
120 maintainers = with lib.maintainers; [ samuela ];
121 };
122}