Skip to content

Commit 1a7115f

Browse files
committed
Update setup.py and apply black formatter
1 parent c464e37 commit 1a7115f

File tree

1 file changed

+78
-39
lines changed

1 file changed

+78
-39
lines changed

setup.py

Lines changed: 78 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -16,10 +16,17 @@
1616
with codecs.open(os.path.join(here, "README.md"), encoding="utf-8") as readme:
1717
long_description = readme.read()
1818

19-
tests_require = ["pytest>=5,<6", "pytest-cov>=2,<3", "codecov>=2,<3", "flake8>=3,<4", "black", "psutil"]
19+
tests_require = [
20+
"pytest>=5,<6",
21+
"pytest-cov>=2,<3",
22+
"codecov>=2,<3",
23+
"flake8>=3,<4",
24+
"black",
25+
"psutil",
26+
]
2027

21-
needs_pytest = {'pytest', 'test', 'ptr'}.intersection(sys.argv)
22-
pytest_runner = ['pytest-runner'] if needs_pytest else []
28+
needs_pytest = {"pytest", "test", "ptr"}.intersection(sys.argv)
29+
pytest_runner = ["pytest-runner"] if needs_pytest else []
2330

2431

2532
class BaseCommand(Command):
@@ -88,9 +95,9 @@ class ValidateCommand(BaseCommand):
8895
description = "Run Python static code analyzer (flake8), formatter (black) and unit tests (pytest)."
8996

9097
user_options = [
91-
('unit-test-target=', 'i', 'tests/{unit-test-target}'),
92-
('utt=', 'i', 'tests/{utt}'),
93-
('test-target=', 'i', 'tests/{test-target}')
98+
("unit-test-target=", "i", "tests/{unit-test-target}"),
99+
("utt=", "i", "tests/{utt}"),
100+
("test-target=", "i", "tests/{test-target}"),
94101
]
95102

96103
def initialize_options(self):
@@ -102,27 +109,37 @@ def run(self):
102109
with open("./slack/web/client.py", "r") as original:
103110
source = original.read()
104111
import re
105-
async_source = "# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" \
106-
"#\n" \
107-
"# *** DO NOT EDIT THIS FILE ***\n" \
108-
"#\n" \
109-
"# 1) Modify slack/web/client.py\n" \
110-
"# 2) Run `python setup.py validate`\n" \
111-
"#\n" \
112-
"# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n" \
113-
"\n" \
114-
+ source
112+
113+
async_source = (
114+
"# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
115+
"#\n"
116+
"# *** DO NOT EDIT THIS FILE ***\n"
117+
"#\n"
118+
"# 1) Modify slack/web/client.py\n"
119+
"# 2) Run `python setup.py validate`\n"
120+
"#\n"
121+
"# !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!\n"
122+
"\n" + source
123+
)
115124
async_source = re.sub(" def ", " async def ", async_source)
116125
async_source = re.sub("from asyncio import Future\n", "", async_source)
117-
async_source = re.sub("return self.api_call\(", "return await self.api_call(", async_source)
118-
async_source = re.sub("Union\[Future, SlackResponse\]", "AsyncSlackResponse", async_source)
126+
async_source = re.sub(
127+
"return self.api_call\(", "return await self.api_call(", async_source
128+
)
129+
async_source = re.sub(
130+
"Union\[Future, SlackResponse\]", "AsyncSlackResponse", async_source
131+
)
119132
async_source = re.sub(
120133
"from slack.web.base_client import BaseClient, SlackResponse",
121-
"from slack.web.async_base_client import AsyncBaseClient, AsyncSlackResponse", async_source)
134+
"from slack.web.async_base_client import AsyncBaseClient, AsyncSlackResponse",
135+
async_source,
136+
)
122137
async_source = re.sub(
123138
"class WebClient\(BaseClient\):",
124-
"class AsyncWebClient(AsyncBaseClient):", async_source)
125-
with open('./slack/web/async_client.py', 'w') as output:
139+
"class AsyncWebClient(AsyncBaseClient):",
140+
async_source,
141+
)
142+
with open("./slack/web/async_client.py", "w") as output:
126143
output.write(async_source)
127144

128145
self._run(
@@ -132,7 +149,9 @@ def run(self):
132149
self._run("Running black…", [sys.executable, "-m", "black", f"{here}/slack"])
133150
self._run("Running flake8…", [sys.executable, "-m", "flake8", f"{here}/slack"])
134151

135-
target = (self.utt or self.unit_test_target or self.test_target).replace("tests/", "")
152+
target = (self.utt or self.unit_test_target or self.test_target).replace(
153+
"tests/", ""
154+
)
136155
self._run(
137156
"Running pytest…",
138157
[
@@ -152,9 +171,13 @@ class RunIntegrationTestsCommand(BaseCommand):
152171
description = "Run integration tests (pytest)."
153172

154173
user_options = [
155-
('integration-test-target=', 'i', 'integration_tests/{integration-test-target}'),
156-
('itt=', 'i', 'integration_tests/{itt}'),
157-
('test-target=', 'i', 'integration_tests/{test-target}')
174+
(
175+
"integration-test-target=",
176+
"i",
177+
"integration_tests/{integration-test-target}",
178+
),
179+
("itt=", "i", "integration_tests/{itt}"),
180+
("test-target=", "i", "integration_tests/{test-target}"),
158181
]
159182

160183
def initialize_options(self):
@@ -163,7 +186,9 @@ def initialize_options(self):
163186
self.test_target = ""
164187

165188
def run(self):
166-
target = (self.itt or self.integration_test_target or self.test_target).replace("integration_tests/", "")
189+
target = (self.itt or self.integration_test_target or self.test_target).replace(
190+
"integration_tests/", ""
191+
)
167192
self._run(
168193
"Running pytest…",
169194
[
@@ -183,11 +208,15 @@ class RunAllTestsCommand(ValidateCommand):
183208
description = ValidateCommand.description + "\nRun integration tests (pytest)."
184209

185210
user_options = [
186-
('unit-test-target=', 'i', 'tests/{unit-test-target}'),
187-
('utt=', 'i', 'tests/{utt}'),
188-
('integration-test-target=', 'i', 'integration_tests/{integration-test-target}'),
189-
('itt=', 'i', 'integration_tests/{itt}'),
190-
('test-target=', 'i', 'integration_tests/{test-target}')
211+
("unit-test-target=", "i", "tests/{unit-test-target}"),
212+
("utt=", "i", "tests/{utt}"),
213+
(
214+
"integration-test-target=",
215+
"i",
216+
"integration_tests/{integration-test-target}",
217+
),
218+
("itt=", "i", "integration_tests/{itt}"),
219+
("test-target=", "i", "integration_tests/{test-target}"),
191220
]
192221

193222
def initialize_options(self):
@@ -199,7 +228,9 @@ def initialize_options(self):
199228

200229
def run(self):
201230
ValidateCommand.run(self)
202-
target = (self.itt or self.integration_test_target or self.test_target).replace("integration_tests/", "")
231+
target = (self.itt or self.integration_test_target or self.test_target).replace(
232+
"integration_tests/", ""
233+
)
203234
self._run(
204235
"Running pytest…",
205236
[
@@ -216,11 +247,12 @@ def run(self):
216247
setup(
217248
name="slackclient",
218249
version=__version__,
219-
description="Slack API clients for Web API and RTM API",
250+
description="Slack API clients for Web API and RTM API (Legacy) - "
251+
+ "Please use https://pypi.org/project/slack-sdk/ instead.",
220252
long_description=long_description,
221253
long_description_content_type="text/markdown",
222-
url="https://github.com/slackapi/python-slackclient",
223-
author="Slack Technologies, Inc.",
254+
url="https://github.com/slackapi/python-slack-sdk",
255+
author="Slack Technologies, LLC",
224256
author_email="[email protected]",
225257
python_requires=">=3.6.0",
226258
include_package_data=True,
@@ -237,14 +269,21 @@ def run(self):
237269
"Programming Language :: Python :: 3.6",
238270
"Programming Language :: Python :: 3.7",
239271
"Programming Language :: Python :: 3.8",
272+
"Programming Language :: Python :: 3.9",
273+
"Programming Language :: Python :: 3.10",
240274
],
241275
keywords="slack slack-web slack-rtm chat chatbots bots chatops",
242276
packages=find_packages(
243-
exclude=["docs", "docs-src", "integration_tests", "tests", "tests.*", "tutorial"]
277+
exclude=[
278+
"docs",
279+
"docs-src",
280+
"integration_tests",
281+
"tests",
282+
"tests.*",
283+
"tutorial",
284+
]
244285
),
245-
install_requires=[
246-
"aiohttp>3.5.2,<4.0.0" # TODO: move to extras_require in v3
247-
],
286+
install_requires=["aiohttp>3.5.2,<4.0.0"], # TODO: move to extras_require in v3
248287
extras_require={"optional": ["aiodns>1.0"]},
249288
setup_requires=pytest_runner,
250289
test_suite="tests",

0 commit comments

Comments
 (0)