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