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