Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuring with pyproject.toml #1436

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/ci-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,8 @@ jobs:
- name: Install dependencies
run: |
pip install -U pip wheel
pip install -e ".[testing]"
pip install -e ".[optional]"
pip install -r requirements/testing.txt
pip install -r requirements/optional.txt
- name: Run validation (black/flake8/pytest)
run: |
python setup.py validate
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/pytype.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
- name: Install dependencies
run: |
pip install -U pip
pip install -e ".[testing]"
pip install -e ".[optional]"
pip install -r requirements/testing.txt
pip install -r requirements/optional.txt
# As pytype can change its behavior in newer versions, we manually upgrade it
# 2023.9.11 fails due to errors that only happen on GH Actions
pip install "pytype==2023.5.24"
Expand Down
71 changes: 68 additions & 3 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,4 +1,69 @@
# black project prefers pyproject.toml
# that's why we have this file in addition to other setting files
[build-system]
requires = ["setuptools", "pytest-runner"]
build-backend = "setuptools.build_meta"

[project]
name = "slack_sdk"
dynamic = ["version", "readme", "authors"]
description = "The Slack API Platform SDK for Python"
license = { text = "MIT" }
requires-python = ">=3.6"
keywords = [
"slack",
"slack-api",
"web-api",
"slack-rtm",
"websocket",
"chat",
"chatbot",
"chatops",
]
classifiers = [
"Development Status :: 5 - Production/Stable",
"Intended Audience :: Developers",
"Topic :: Communications :: Chat",
"Topic :: System :: Networking",
"Topic :: Office/Business",
"License :: OSI Approved :: MIT License",
"Programming Language :: Python",
"Programming Language :: Python :: 3 :: Only",
"Programming Language :: Python :: 3.6",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: Implementation :: CPython",
"Programming Language :: Python :: Implementation :: PyPy",
]


[project.urls]
Documentation = "https://slack.dev/python-slack-sdk/"

[tool.setuptools.packages.find]
include = ["slack*", "slack_sdk*"]

[tool.setuptools.dynamic]
version = { attr = "slack_sdk.version.__version__" }
readme = { file = ["README.md"], content-type = "text/markdown" }

[tool.distutils.bdist_wheel]
universal = true

[tool.black]
line-length = 125
line-length = 125

[tool.pytest.ini_options]
testpaths = ["tests"]
log_file = "logs/pytest.log"
log_file_level = "DEBUG"
log_format = "%(asctime)s %(levelname)s %(message)s"
log_date_format = "%Y-%m-%d %H:%M:%S"
filterwarnings = [
"ignore:\"@coroutine\" decorator is deprecated since Python 3.8, use \"async def\" instead:DeprecationWarning",
"ignore:The loop argument is deprecated since Python 3.8, and scheduled for removal in Python 3.10.:DeprecationWarning",
"ignore:slack.* package is deprecated. Please use slack_sdk.* package instead.*:UserWarning",
]
asyncio_mode = "auto"
10 changes: 0 additions & 10 deletions pytest.ini

This file was deleted.

17 changes: 17 additions & 0 deletions requirements/optional.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# pip install -r requirements/optional.txt
# async modules depend on aiohttp
aiodns>1.0
# We recommend using 3.7.1+ for RTMClient
# https://github.com/slackapi/python-slack-sdk/issues/912
aiohttp>=3.7.3,<4
# used only under slack_sdk/*_store
boto3<=2
# InstallationStore/OAuthStateStore
# Since v3.20, we no longer support SQLAlchemy 1.3 or older.
# If you need to use a legacy version, please add our v3.19.5 code to your project.
SQLAlchemy>=1.4,<3
# Socket Mode
# websockets 9 is not compatible with Python 3.10
websockets>=9.1,<10; python_version=="3.6"
websockets>=10,<11; python_version>"3.6"
websocket-client>=1,<2
21 changes: 21 additions & 0 deletions requirements/testing.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# pip install -r requirements/testing.txt
pytest>=7.0.1,<8
pytest-asyncio<1 # for async
Flask-Sockets>=0.2,<1
Flask>=1,<2 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
Werkzeug<2 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
itsdangerous==1.1.0 # TODO: Flask-Sockets is not yet compatible with Flask 2.x
Jinja2==3.0.3 # https://github.com/pallets/flask/issues/4494
pytest-cov>=2,<3
# while flake8 5.x have issues with Python 3.12, flake8 6.x requires Python >= 3.8.1,
# so 5.x should be kept in order to stay compatible with Python 3.6/3.7
flake8>=5.0.4,<7
# Don't change this version without running CI builds;
# The latest version may not be available for older Python runtime
black>=22.8.0; python_version=="3.6"
black==22.10.0; python_version>"3.6"
click==8.0.4 # black is affected by https://github.com/pallets/click/issues/2225
psutil>=5,<6
# used only under slack_sdk/*_store
boto3<=2
moto>=3,<4 # For AWS tests
11 changes: 11 additions & 0 deletions scripts/build_pypi_package.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
#!/bin/bash

script_dir=`dirname $0`
cd ${script_dir}/..
rm -rf ./slack_sdk.egg-info

pip install -U pip && \
pip install twine build && \
rm -rf dist/ build/ slack_sdk.egg-info/ && \
python -m build --sdist --wheel && \
twine check dist/*
11 changes: 10 additions & 1 deletion scripts/deploy_to_prod_pypi_org.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
#!/bin/bash

python setup.py upload
script_dir=`dirname $0`
cd ${script_dir}/..
rm -rf ./slack_sdk.egg-info

pip install -U pip && \
pip install twine build && \
rm -rf dist/ build/ slack_sdk.egg-info/ && \
python -m build --sdist --wheel && \
twine check dist/* && \
twine upload dist/*
12 changes: 12 additions & 0 deletions scripts/deploy_to_test_pypi_org.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
#!/bin/bash

script_dir=`dirname $0`
cd ${script_dir}/..
rm -rf ./slack_sdk.egg-info

pip install -U pip && \
pip install twine build && \
rm -rf dist/ build/ slack_sdk.egg-info/ && \
python -m build --sdist --wheel && \
twine check dist/* && \
twine upload --repository testpypi dist/*
4 changes: 3 additions & 1 deletion scripts/run_integration_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ cd ${script_dir}/..

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

if [[ $test_target != "" ]]
then
Expand Down
4 changes: 3 additions & 1 deletion scripts/run_unit_tests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,9 @@ cd ${script_dir}/..

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

if [[ $test_target != "" ]]
then
Expand Down
4 changes: 2 additions & 2 deletions scripts/run_validation.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@
script_dir=`dirname $0`
cd ${script_dir}/..
pip install -U pip && \
pip install -e ".[testing]" && \
pip install -e ".[optional]" && \
pip install -r requirements/testing.txt && \
pip install -r requirements/optional.txt && \
black slack_sdk/ slack/ tests/ integration_tests/ && \
python setup.py codegen && \
python setup.py validate
4 changes: 4 additions & 0 deletions scripts/uninstall_all.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash

pip uninstall -y slack-sdk && \
pip freeze | grep -v "^-e" | xargs pip uninstall -y
7 changes: 5 additions & 2 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
[aliases]
test=pytest
; Legacy package configuration, prefer pyproject.toml over setup.cfg or setup.py
[metadata]
url=https://github.com/slackapi/python-slack-sdk
author=Slack Technologies, LLC
author_email=opensource@slack.com
Loading
Loading