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 ] ++ lib.flatten (builtins.attrValues optional-dependencies);
95
96 preCheck = ''
97 export HOME="$(mktemp -d)"
98 '';
99
100 __darwinAllowLocalNetworking = true;
101
102 disabledTestPaths = [
103 # boddle is not packaged as of 2023-07-15
104 "tests/adapter_tests/bottle/"
105 ];
106
107 disabledTests = [
108 # Require network access
109 "test_failure"
110 # TypeError
111 "test_oauth"
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/${src.tag}";
118 license = lib.licenses.mit;
119 maintainers = with lib.maintainers; [ samuela ];
120 };
121}