X Tutup
Skip to content

Commit 9a65573

Browse files
authored
Migrate to slack_sdk 3.0.0a1 (slackapi#29)
1 parent 3ecccc9 commit 9a65573

File tree

209 files changed

+5
-32883
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

209 files changed

+5
-32883
lines changed

.travis.yml

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,13 @@ python:
88
- "nightly" # nightly build
99
install:
1010
- python setup.py install
11+
- pip install -U pip
1112
- pip install "pytest>=5,<6"
1213
script:
13-
# codegen for slack_sdk
14-
- python setup.py codegen
15-
# FIXME: the result can be different depending on OS platforms (e.g., macOS vs Linux)?
16-
# - if git status --porcelain | grep .; then git --no-pager diff; exit 1; fi
1714
# testing without aiohttp
1815
- travis_retry pytest tests/scenario_tests/
19-
- travis_retry pytest tests/slack_sdk_tests/
2016
# testing with aiohttp
2117
- pip install "pytest-asyncio<1" "aiohttp>=3,<4"
2218
- travis_retry pytest tests/scenario_tests_async/
23-
- travis_retry pytest tests/slack_sdk_tests_async/
24-
- export SLACKCLIENT_SKIP_DEPRECATION=1
25-
- travis_retry pytest tests/slack_sdk_tests_legacy/
2619
# run all tests just in case
2720
- travis_retry python setup.py test

setup.py

Lines changed: 4 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
#!/usr/bin/env python
22
import os
3-
import subprocess
4-
import sys
53
from glob import glob
64
from os.path import splitext, basename
75

@@ -15,96 +13,13 @@
1513

1614
here = os.path.abspath(os.path.dirname(__file__))
1715

18-
codegen_dependencies = [
19-
"black==19.10b0",
20-
]
21-
2216
test_dependencies = [
2317
"pytest>=5,<6",
2418
"pytest-asyncio<1", # for async
2519
"aiohttp>=3,<4", # for async
20+
"black==19.10b0",
2621
]
2722

28-
29-
class CodegenCommand(setuptools.Command):
30-
user_options = []
31-
32-
@staticmethod
33-
def status(s):
34-
"""Prints things in bold."""
35-
print("\033[1m{0}\033[0m".format(s))
36-
37-
def initialize_options(self):
38-
pass
39-
40-
def finalize_options(self):
41-
pass
42-
43-
def _run(self, s, command):
44-
try:
45-
self.status(s + "\n" + " ".join(command))
46-
subprocess.check_call(command)
47-
except subprocess.CalledProcessError as error:
48-
sys.exit(error.returncode)
49-
50-
def run(self):
51-
self._run("Installing required dependencies ...",
52-
[sys.executable, "-m", "pip", "install"] + codegen_dependencies)
53-
54-
header = "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" \
55-
"#\n" \
56-
"# *** DO NOT EDIT THIS FILE ***\n" \
57-
"#\n" \
58-
"# 1) Modify slack/web/client.py\n" \
59-
"# 2) Run `python setup.py codegen`\n" \
60-
"#\n" \
61-
"# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" \
62-
"\n"
63-
with open("./src/slack_sdk/web/client.py", "r") as original:
64-
source = original.read()
65-
import re
66-
async_source = header + source
67-
async_source = re.sub(" def ", " async def ", async_source)
68-
async_source = re.sub("from asyncio import Future\n", "", async_source)
69-
async_source = re.sub("return self.api_call\(", "return await self.api_call(", async_source)
70-
async_source = re.sub("-> SlackResponse", "-> AsyncSlackResponse", async_source)
71-
async_source = re.sub(
72-
"from .base_client import BaseClient, SlackResponse",
73-
"from .async_base_client import AsyncBaseClient, AsyncSlackResponse", async_source)
74-
# from slack_sdk import WebClient
75-
async_source = re.sub(
76-
"class WebClient\(BaseClient\):",
77-
"class AsyncWebClient(AsyncBaseClient):", async_source)
78-
async_source = re.sub(
79-
"from slack_sdk import WebClient",
80-
"from slack_sdk.web.async_client import AsyncWebClient", async_source)
81-
async_source = re.sub(
82-
"= WebClient\(",
83-
"= AsyncWebClient(", async_source)
84-
with open('./src/slack_sdk/web/async_client.py', 'w') as output:
85-
output.write(async_source)
86-
87-
legacy_source = header + "from asyncio import Future\n" + source
88-
legacy_source = re.sub("-> SlackResponse", "-> Union[Future, SlackResponse]", legacy_source)
89-
legacy_source = re.sub(
90-
"from .base_client import BaseClient, SlackResponse",
91-
"from .legacy_base_client import LegacyBaseClient, SlackResponse", legacy_source)
92-
legacy_source = re.sub(
93-
"class WebClient\(BaseClient\):",
94-
"class LegacyWebClient(LegacyBaseClient):", legacy_source)
95-
legacy_source = re.sub(
96-
"from slack_sdk import WebClient",
97-
"from slack_sdk.web.legacy_client import LegacyWebClient", legacy_source)
98-
legacy_source = re.sub(
99-
"= WebClient\(",
100-
"= LegacyWebClient(", legacy_source)
101-
with open('./src/slack_sdk/web/legacy_client.py', 'w') as output:
102-
output.write(legacy_source)
103-
104-
self._run("Running black (code formatter) ... ",
105-
[sys.executable, "-m", "black", f"{here}/src"])
106-
107-
10823
setuptools.setup(
10924
name="slack_bolt",
11025
version=__version__,
@@ -120,7 +35,9 @@ def run(self):
12035
setup_requires=["pytest-runner==5.2"],
12136
# python setup.py test
12237
tests_require=test_dependencies,
123-
install_requires=[],
38+
install_requires=[
39+
"slack_sdk==3.0.0a1",
40+
],
12441
extras_require={
12542
# pip install -e ".[testing]"
12643
# python -m pytest tests/scenario_tests/test_async_events.py
@@ -153,7 +70,4 @@ def run(self):
15370
"Operating System :: OS Independent",
15471
],
15572
python_requires='>=3.6',
156-
cmdclass={
157-
"codegen": CodegenCommand,
158-
},
15973
)

src/slack/__init__.py

Lines changed: 0 additions & 15 deletions
This file was deleted.

src/slack/deprecation.py

Lines changed: 0 additions & 16 deletions
This file was deleted.

src/slack/errors.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

src/slack/rtm/__init__.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/slack/rtm/client.py

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/slack/signature/__init__.py

Lines changed: 0 additions & 5 deletions
This file was deleted.

src/slack/web/__init__.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/slack/web/classes/__init__.py

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)
X Tutup