Skip to content

Commit 69638bf

Browse files
Configuring with pyproject.toml (#1436)
* Move to pyproject toml * Update pyproject.toml Co-authored-by: Aliaksei Urbanski <[email protected]> * Update scripts/build_pypi_package.sh Co-authored-by: Aliaksei Urbanski <[email protected]> * Merge remote-tracking branch 'upstream/main' into pyproject-toml-configuration * Maintain pip show command --------- Co-authored-by: Aliaksei Urbanski <[email protected]>
1 parent ef883ad commit 69638bf

15 files changed

+166
-165
lines changed

.github/workflows/ci-build.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ jobs:
3636
- name: Install dependencies
3737
run: |
3838
pip install -U pip wheel
39-
pip install -e ".[testing]"
40-
pip install -e ".[optional]"
39+
pip install -r requirements/testing.txt
40+
pip install -r requirements/optional.txt
4141
- name: Run validation (black/flake8/pytest)
4242
run: |
4343
python setup.py validate

.github/workflows/pytype.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ jobs:
2121
- name: Install dependencies
2222
run: |
2323
pip install -U pip
24-
pip install -e ".[testing]"
25-
pip install -e ".[optional]"
24+
pip install -r requirements/testing.txt
25+
pip install -r requirements/optional.txt
2626
# As pytype can change its behavior in newer versions, we manually upgrade it
2727
# 2023.9.11 fails due to errors that only happen on GH Actions
2828
pip install "pytype==2023.5.24"

pyproject.toml

Lines changed: 68 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,69 @@
1-
# black project prefers pyproject.toml
2-
# that's why we have this file in addition to other setting files
1+
[build-system]
2+
requires = ["setuptools", "pytest-runner"]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "slack_sdk"
7+
dynamic = ["version", "readme", "authors"]
8+
description = "The Slack API Platform SDK for Python"
9+
license = { text = "MIT" }
10+
requires-python = ">=3.6"
11+
keywords = [
12+
"slack",
13+
"slack-api",
14+
"web-api",
15+
"slack-rtm",
16+
"websocket",
17+
"chat",
18+
"chatbot",
19+
"chatops",
20+
]
21+
classifiers = [
22+
"Development Status :: 5 - Production/Stable",
23+
"Intended Audience :: Developers",
24+
"Topic :: Communications :: Chat",
25+
"Topic :: System :: Networking",
26+
"Topic :: Office/Business",
27+
"License :: OSI Approved :: MIT License",
28+
"Programming Language :: Python",
29+
"Programming Language :: Python :: 3 :: Only",
30+
"Programming Language :: Python :: 3.6",
31+
"Programming Language :: Python :: 3.7",
32+
"Programming Language :: Python :: 3.8",
33+
"Programming Language :: Python :: 3.9",
34+
"Programming Language :: Python :: 3.10",
35+
"Programming Language :: Python :: 3.11",
36+
"Programming Language :: Python :: 3.12",
37+
"Programming Language :: Python :: Implementation :: CPython",
38+
"Programming Language :: Python :: Implementation :: PyPy",
39+
]
40+
41+
42+
[project.urls]
43+
Documentation = "https://slack.dev/python-slack-sdk/"
44+
45+
[tool.setuptools.packages.find]
46+
include = ["slack*", "slack_sdk*"]
47+
48+
[tool.setuptools.dynamic]
49+
version = { attr = "slack_sdk.version.__version__" }
50+
readme = { file = ["README.md"], content-type = "text/markdown" }
51+
52+
[tool.distutils.bdist_wheel]
53+
universal = true
54+
355
[tool.black]
4-
line-length = 125
56+
line-length = 125
57+
58+
[tool.pytest.ini_options]
59+
testpaths = ["tests"]
60+
log_file = "logs/pytest.log"
61+
log_file_level = "DEBUG"
62+
log_format = "%(asctime)s %(levelname)s %(message)s"
63+
log_date_format = "%Y-%m-%d %H:%M:%S"
64+
filterwarnings = [
65+
"ignore:\"@coroutine\" decorator is deprecated since Python 3.8, use \"async def\" instead:DeprecationWarning",
66+
"ignore:The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.:DeprecationWarning",
67+
"ignore:slack.* package is deprecated. Please use slack_sdk.* package instead.*:UserWarning",
68+
]
69+
asyncio_mode = "auto"

pytest.ini

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

requirements/optional.txt

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# pip install -r requirements/optional.txt
2+
# async modules depend on aiohttp
3+
aiodns>1.0
4+
# We recommend using 3.7.1+ for RTMClient
5+
# https://github.com/slackapi/python-slack-sdk/issues/912
6+
aiohttp>=3.7.3,<4
7+
# used only under slack_sdk/*_store
8+
boto3<=2
9+
# InstallationStore/OAuthStateStore
10+
# Since v3.20, we no longer support SQLAlchemy 1.3 or older.
11+
# If you need to use a legacy version, please add our v3.19.5 code to your project.
12+
SQLAlchemy>=1.4,<3
13+
# Socket Mode
14+
# websockets 9 is not compatible with Python 3.10
15+
websockets>=9.1,<10; python_version=="3.6"
16+
websockets>=10,<11; python_version>"3.6"
17+
websocket-client>=1,<2

requirements/testing.txt

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# pip install -r requirements/testing.txt
2+
pytest>=7.0.1,<8
3+
pytest-asyncio<1 # for async
4+
Flask-Sockets>=0.2,<1
5+
Flask>=1,<2 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
6+
Werkzeug<2 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
7+
itsdangerous==1.1.0 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
8+
Jinja2==3.0.3 # https://github.com/pallets/flask/issues/4494
9+
pytest-cov>=2,<3
10+
# while flake8 5.x have issues with Python 3.12, flake8 6.x requires Python >= 3.8.1,
11+
# so 5.x should be kept in order to stay compatible with Python 3.6/3.7
12+
flake8>=5.0.4,<7
13+
# Don't change this version without running CI builds;
14+
# The latest version may not be available for older Python runtime
15+
black>=22.8.0; python_version=="3.6"
16+
black==22.10.0; python_version>"3.6"
17+
click==8.0.4 # black is affected by https://github.com/pallets/click/issues/2225
18+
psutil>=5,<6
19+
# used only under slack_sdk/*_store
20+
boto3<=2
21+
moto>=3,<4 # For AWS tests

scripts/build_pypi_package.sh

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
#!/bin/bash
2+
3+
script_dir=`dirname $0`
4+
cd ${script_dir}/..
5+
rm -rf ./slack_sdk.egg-info
6+
7+
pip install -U pip && \
8+
pip install twine build && \
9+
rm -rf dist/ build/ slack_sdk.egg-info/ && \
10+
python -m build --sdist --wheel && \
11+
twine check dist/*

scripts/deploy_to_prod_pypi_org.sh

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
11
#!/bin/bash
22

3-
python setup.py upload
3+
script_dir=`dirname $0`
4+
cd ${script_dir}/..
5+
rm -rf ./slack_sdk.egg-info
6+
7+
pip install -U pip && \
8+
pip install twine build && \
9+
rm -rf dist/ build/ slack_sdk.egg-info/ && \
10+
python -m build --sdist --wheel && \
11+
twine check dist/* && \
12+
twine upload dist/*

scripts/deploy_to_test_pypi_org.sh

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
script_dir=`dirname $0`
4+
cd ${script_dir}/..
5+
rm -rf ./slack_sdk.egg-info
6+
7+
pip install -U pip && \
8+
pip install twine build && \
9+
rm -rf dist/ build/ slack_sdk.egg-info/ && \
10+
python -m build --sdist --wheel && \
11+
twine check dist/* && \
12+
twine upload --repository testpypi dist/*

scripts/run_integration_tests.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ cd ${script_dir}/..
88

99
test_target="$1"
1010
python_version=`python --version | awk '{print $2}'`
11-
pip install -e .
11+
pip install -U pip && \
12+
pip install -r requirements/testing.txt && \
13+
pip install -r requirements/optional.txt && \
1214

1315
if [[ $test_target != "" ]]
1416
then

0 commit comments

Comments
 (0)